Skip to content

fix(dolt): resolve shared-server CLI dir from shared root#3223

Open
s-a-c wants to merge 1 commit intogastownhall:mainfrom
s-a-c:fix/shared-server-cli-dir
Open

fix(dolt): resolve shared-server CLI dir from shared root#3223
s-a-c wants to merge 1 commit intogastownhall:mainfrom
s-a-c:fix/shared-server-cli-dir

Conversation

@s-a-c
Copy link
Copy Markdown

@s-a-c s-a-c commented Apr 12, 2026

Summary

In shared-server mode, CLIDir() can resolve from the authoritative shared Dolt root instead of the per-project .beads/dolt/<db> path.

This change is intentionally limited to shared-server mode. It does not change generic external-server behavior.

What changed

  • update internal/storage/dolt/store.go
    • when serverMode is true and IsSharedServerMode() is true, resolve CLIDir() via doltserver.ResolveDoltDir(beadsDir)
    • preserve the old dbPath behavior everywhere else
  • add direct path-resolution coverage in internal/storage/dolt/open_test.go
  • add shared-server routing-guard coverage in internal/storage/dolt/credentials_test.go
  • add a workflow-style integration regression in internal/storage/dolt/git_remote_shared_server_test.go

Why this scope

Shared-server mode has a local, authoritative Dolt root. Generic external-server mode does not necessarily have that property, so this PR avoids changing that behavior.

The goal here is to fix the shared-server CLI path case without claiming to solve the broader external-server path-authority problem.

Verification

  • CGO_ENABLED=0 go test ./internal/storage/dolt -run 'TestCLIDirUsesSharedDoltRootInSharedServerMode|TestCLIDirUsesDbPathOutsideSharedServerMode|TestCredentialCLIRoutingSharedServerUsesSharedDoltRoot|TestCloudAuthCLIRoutingSharedServerUsesSharedDoltRoot'
  • CGO_ENABLED=0 go test -count=1 -tags integration ./internal/storage/dolt -run 'TestCredentialCLIRoutingE2ESharedServer|TestCredentialCLIRoutingE2E|TestGitRemoteExternalServerRouting'

Both passed in a clean branch containing only this scoped slice.

Closes #3219

Limit CLI path resolution changes to shared-server mode, where the local machine has an authoritative shared Dolt root. Add direct path tests, routing-guard tests, and an end-to-end shared-server push workflow regression test.

Co-authored-by: s-a-c <71233932+s-a-c@users.noreply.github.com>

Co-authored-by: gh copilot via gpt 5.4 medium <gh-copilot-via-gpt-5-4-medium@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes how DoltStore.CLIDir() resolves the working directory for dolt CLI subprocesses in shared-server mode by deriving the path from the authoritative shared Dolt root (instead of the per-project .beads/dolt/<db> layout). This aligns CLI-based operations (e.g., remote, push, pull) with where the shared server actually stores database repos.

Changes:

  • Update DoltStore.CLIDir() to resolve from doltserver.ResolveDoltDir(beadsDir) when serverMode + shared-server mode are enabled.
  • Add unit coverage for shared-server vs non-shared-server CLIDir() resolution.
  • Add routing/guard tests and an integration regression test validating shared-server credential-bearing CLI routing through the shared Dolt root.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/storage/dolt/store.go Adjusts CLIDir() to use the shared Dolt root for shared-server mode, preserving legacy behavior elsewhere.
internal/storage/dolt/open_test.go Adds direct tests asserting CLIDir() path resolution in shared-server vs non-shared-server mode.
internal/storage/dolt/credentials_test.go Adds tests ensuring credential/cloud-auth CLI routing resolves remotes via the shared Dolt root in shared-server mode.
internal/storage/dolt/git_remote_shared_server_test.go Adds an integration test proving end-to-end shared-server credential routing succeeds even when the per-project CLI dir is stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI-path commands fail in shared Dolt server mode (push/pull/remote)

2 participants