test: restore OpenBestAvailable tests from bgjackma's PR #3143#3150
Merged
test: restore OpenBestAvailable tests from bgjackma's PR #3143#3150
Conversation
Adds OpenBestAvailable(ctx, beadsDir) which routes to the correct storage backend based on metadata.json, mirroring the CLI's newDoltStoreFromConfig logic: - CGO builds: embedded mode (default) with exclusive flock, or server mode when dolt_mode=server - Non-CGO builds: server mode only, returns clear error for embedded Returns (Storage, Unlocker, error) so callers manage the flock lifetime. This fixes the problem where library users of OpenFromConfig silently got an empty shadow database instead of the actual embedded store. Amp-Thread-ID: https://ampcode.com/threads/T-019d736a-46a6-7178-91f3-854f36dd474b Co-authored-by: Amp <amp@ampcode.com>
seanmartinsmith
pushed a commit
to seanmartinsmith/beads
that referenced
this pull request
Apr 10, 2026
…3143 (gastownhall#3150) * feat: add OpenBestAvailable to public API (gastownhall#3143) Adds OpenBestAvailable(ctx, beadsDir) which routes to the correct storage backend based on metadata.json, mirroring the CLI's newDoltStoreFromConfig logic: - CGO builds: embedded mode (default) with exclusive flock, or server mode when dolt_mode=server - Non-CGO builds: server mode only, returns clear error for embedded Returns (Storage, Unlocker, error) so callers manage the flock lifetime. This fixes the problem where library users of OpenFromConfig silently got an empty shadow database instead of the actual embedded store. Amp-Thread-ID: https://ampcode.com/threads/T-019d736a-46a6-7178-91f3-854f36dd474b Co-authored-by: Amp <amp@ampcode.com> * test: add OpenBestAvailable tests from PR gastownhall#3143 Restores test coverage that was dropped when PR gastownhall#3149 reimplemented the feature without carrying over the tests from bgjackma's original PR gastownhall#3143. Tests are adapted for the current (Storage, Unlocker, error) return signature. Co-authored-by: Brock Jackman <brockj@lyft.com> --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: Brock Jackman <brockj@lyft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restores test coverage that was dropped when PR #3149 reimplemented the OpenBestAvailable feature without carrying over @bgjackma's tests from the original PR #3143.
What was lost:
TestOpenBestAvailable_ServerMode— verifies server-mode routing worksTestOpenBestAvailable_ServerMode_FailsWithoutServer— verifies fail-fast without a serverTestOpenBestAvailable_NoCGO_EmbeddedMode_ReturnsError— verifies clear error in !cgo embedded modeTestOpenBestAvailable_NoCGO_NoMetadata_ReturnsError— verifies default (no metadata) requires CGOTestOpenBestAvailable_NoCGO_ServerMode_FailsWithoutServer— verifies server mode works without CGOTests are adapted from Brock's original for the current
(Storage, Unlocker, error)return signature.Co-authored-by: Brock Jackman brockj@lyft.com