fix(infra): route SQLiteMeta through hanzoai/sqlite — one "sqlite" driver registrar - #22
Merged
Merged
Conversation
…gistrar
pkg/infra blank-imported modernc.org/sqlite, so any binary linking this store
next to another Hanzo store (base/core, orm/db, tasks' shard store — all of
which reach SQLite through github.com/hanzoai/sqlite) registered the "sqlite"
database/sql driver name twice and panicked during init:
panic: sql: Register called twice for driver sqlite
modernc.org/sqlite.init.0() modernc.org/sqlite@v1.51.0/sqlite.go:57
hanzoai/mpc's mpcd is exactly that binary; `go test ./...` there could not even
start. hanzoai/sqlite is the ecosystem's single registrar of that name (pure-Go
modernc under !cgo, hanzoai/csqlite+SQLCipher under cgo), so this store must go
through it — and so must base and orm, hence base v0.39.1 -> v1.5.8 and orm
v0.5.2 -> v0.6.16, the versions that route through it. mpcd's package graph now
has exactly one importer of a SQLite driver.
The hand-rolled DSN went with it. `?_journal_mode=WAL&_busy_timeout=5000&...`
is mattn syntax and the pure-Go backend this module actually linked dropped it
silently — measured journal_mode=delete, busy_timeout=0, foreign_keys=0, i.e.
no WAL, immediate SQLITE_BUSY under concurrent writers and no FK enforcement.
sqlite.PragmaDSN encodes the pragma set in the ACTIVE backend's syntax, so all
three apply under both backends.
Tests: sqlite_driver_test.go links base/core and orm/db alongside this store, so
a regression to a direct modernc import blows the test binary up in init;
TestSQLiteMeta_PragmasApplied reads the pragmas back off a file-backed WAL
store. Both pass under CGO_ENABLED=0 and CGO_ENABLED=1.
Co-authored-by: Hanzo Dev <dev@hanzo.ai>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
pkg/infra blank-imported
modernc.org/sqlite, so any binary linking this store next to another Hanzo store —base/core,orm/db, tasks shard store, all of which reach SQLite throughgithub.com/hanzoai/sqlite— registered the"sqlite"database/sqldriver name twice and panicked during init:hanzoai/mpcsmpcdis exactly that binary —go test ./...there could not start. Reproduced minimally with a two-import program (hanzoai/base/core+luxfi/mpc/pkg/infra).github.com/hanzoai/sqliteis the ecosystem single registrar of that name (pure-Go modernc under!cgo,hanzoai/csqlite+SQLCipher undercgo), so this store must go through it — and so must base and orm, hencebase v0.39.1 -> v1.5.8andorm v0.5.2 -> v0.6.16, the versions that route through it.go list -deps ./cmd/mpcdnow shows exactly one importer chain into a SQLite driver.The hand-rolled DSN went with it.
?_journal_mode=WAL&_busy_timeout=5000&...is mattn syntax and the pure-Go backend this module actually linked dropped it silently — measuredjournal_mode=delete,busy_timeout=0,foreign_keys=0.sqlite.PragmaDSNencodes the pragma set in the ACTIVE backend syntax.Verification
GOWORK=off go build ./...— OK.CGO_ENABLED=0 go build ./cmd/mpcd ./cmd/mpc— OK (CI parity).GOWORK=off go test ./...— same result before and after this change: only the pre-existingcmd/mpcdTestEmbeddedDispatcher_BLSRoundTrip/TestEmbeddedDispatcher_AuthGatefailures (unknown procedure "bls.keygen"), which reproduce on an untouchedorigin/mainworktree. No new failures.pkg/infra/sqlite_driver_test.golinksbase/core+orm/dbalongside this store: reinstating themoderncimport makes the test binary panic in init (verified), and it passes with the fix under bothCGO_ENABLED=0and=1.Blocks
hanzoai/mpc, which needs a tagged release carrying this.https://claude.ai/code/session_01Azk4cknLD2FJYYaaVZ4yXP