fix(memory): normalize readonly SQLite URI paths - #125
Merged
Conversation
21 tasks
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.
What
file:///C:/...), preserving URI escaping for spaces, Unicode,#, and%.mode=ro,immutable=1, and the existing readonly mutation guards. No fallback to a writable connection, schema migration, or file-format change.Why
Closes #123.
The readonly URI construction introduced by #119 passes a Windows filename such as
C:/.../mnemon.dbdirectly tourl.URL.Path. It serializes asfile://C:/..., turning the drive into an invalid SQLite URI authority. Relative directory paths produce the same problem on other platforms. The driver reports the open failure asSQL logic error: out of memory (1)even for a tiny database.SQLite's URI rules require the Windows drive to be part of the absolute path and drive-relative filenames to be resolved before conversion.
Normalize the path and retain the readonly snapshot contract so downstream callers, including dsh-mnemon's browse/metadata paths, do not need to remove
--readonlyand allow incidental writes.Validation
Local validation ran on macOS arm64 with Go 1.25.4.
masterwith the reported SQLite error and pass with this fix.make testpasses, includinggo vet ./...and all deterministic packages.go test -race -shuffle=on ./internal/memory/store ./cmd/memory -count=3passes.bash scripts/e2e_test.shpasses all 167 assertions, using the built CLI and synthetic data with the optional embedding endpoint disabled.7bc609b5fbd609e68e88e3ea842307226af41c12:go build -o mnemon.exe .andgo test ./cmd ./cmd/agency ./cmd/memory ./internal/memory/store -count=1, including the drive-letter and drive-relative regression cases.The broader Agency daemon/process/Docker integration tier and paid-provider live tier were not run; those boundaries are unchanged.
Release-note impact
Release preparation includes the v0.2.7 entry in
CHANGELOG.md.Fix
--readonly recallfailing on Windows drive-letter paths and on relative--data-dirpaths. Readonly recall continues to preserve the immutable snapshot without updating counters/oplog or creating sidecars. The existing limitation for databases actively changed by another process is unchanged.Checklist
make test)