Repository navigation
test(db): reapply DSN pragmas after OpenMemory deserializes its template - #3042
Merged
Merged
Conversation
synchronous and cache_size are per-schema, so Deserialize reset them to SQLite's defaults (2 and -2000) on every OpenMemory copy, while the DSN asks for 1 and -16000. OpenMemory now runs the DSN's pragmas again after loading the template, and the test checks every DSN pragma on the copy instead of only foreign_keys, so a pragma added to the DSN later is covered too. Refs vavallee#2982 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Francis Rath <fr@ncis.no>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
vavallee
approved these changes
Oct 6, 2026
vavallee
left a comment
Owner
There was a problem hiding this comment.
Thanks, that's exactly the fix I had in mind, and reading the list out of the DSN means nobody has to remember to keep two lists in sync. OpenMemory's pool is a single connection so the reapplied pragmas land on the only connection there is. Merged current main into it locally (including the sync.Once driver fix from #3037) and go test ./internal/db -count=2 is green. The codecov patch miss is just the two error branches, fine by me. Merging.
vavallee
added a commit
that referenced
this pull request
Oct 8, 2026
Fold the 41 changelog.d fragments into a v1.41.0 section with upgrade notes for proxy auth, NZB content failure blocklisting, the Fix match default and the queued library scan, credit contributors the fragments did not name (#2615, #3042, #3053, #3057, #2995, #3098), and clear changelog.d. Claude-Session: https://claude.ai/code/session_016fJcCVbNnKsmj2MAAMwWj9 Signed-off-by: vavallee <vavallee@protonmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.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.
Summary
Follow-up to #2983, from @vavallee's review:
synchronousandcache_sizeare per-schema, soDeserializereset them on everyOpenMemorycopy (to 2 and -2000), while the DSN asks for 1 and -16000.OpenMemorynow runs the DSN's pragmas again after loading the template, so a copy matches what a plain open gives.Refs #2982
Implementation notes
connectionPragmas()reads the pragma list out ofconnectionPragmaDSN, so the values live in one place and a pragma added to the DSN later is reapplied (and tested) without anyone remembering to.foreign_keys, and its comment no longer claims they all survive the copy.Openis unchanged.How it was verified
The updated test fails on
mainfor the reason in the review:and passes here. The extra pragmas cost nothing measurable:
go test -race -run '^TestDownloadClient' ./internal/apiis 4.0s.Checklist
Signed-off-bythat matches its author (git commit -s)docs/DEPLOYMENT.md: N/ATest plan
go test ./internal/dbmake testmake test-race(all six shards green, no races reported)🤖 Generated with Claude Code