Skip to content

fix(infra): route SQLiteMeta through hanzoai/sqlite — one "sqlite" driver registrar - #22

Merged
hanzo-dev merged 1 commit into
mainfrom
fix/sqlite-single-registrar
Jul 27, 2026
Merged

fix(infra): route SQLiteMeta through hanzoai/sqlite — one "sqlite" driver registrar#22
hanzo-dev merged 1 commit into
mainfrom
fix/sqlite-single-registrar

Conversation

@zeekay

@zeekay zeekay commented Jul 27, 2026

Copy link
Copy Markdown
Member

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/mpcs mpcd is 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/sqlite is the ecosystem 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. go list -deps ./cmd/mpcd now 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 — measured journal_mode=delete, busy_timeout=0, foreign_keys=0. sqlite.PragmaDSN encodes 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-existing cmd/mpcd TestEmbeddedDispatcher_BLSRoundTrip / TestEmbeddedDispatcher_AuthGate failures (unknown procedure "bls.keygen"), which reproduce on an untouched origin/main worktree. No new failures.
  • New pkg/infra/sqlite_driver_test.go links base/core + orm/db alongside this store: reinstating the modernc import makes the test binary panic in init (verified), and it passes with the fix under both CGO_ENABLED=0 and =1.

Blocks hanzoai/mpc, which needs a tagged release carrying this.

https://claude.ai/code/session_01Azk4cknLD2FJYYaaVZ4yXP

…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>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@hanzo-dev
hanzo-dev merged commit 2fce62b into main Jul 27, 2026
0 of 5 checks passed
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.

1 participant