3 Commits

Author SHA1 Message Date
Alex Dunmow
6c52e3077c fix: resolve check-safety Go lint failures in ninja bnp
- build.go: lowercase the capitalized error string (staticcheck ST1005)
- verify.go: rewrite range-over-strings.Split loop as slices.Contains,
  breaking a Go 1.26 `go fix` stringsseq/slicescontains conflict loop
- driver_test.go: check deferred db.Close() error (errcheck)
- dbvalue.go: reflect.TypeOf -> reflect.TypeFor (applied by golangci --fix)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 09:12:38 +08:00
Alex Dunmow
5880aa21ee test: modernize idiom in wasmguest tests (slices.Contains, any, new(v))
- driver_test.go: use slices.Contains instead of a hand-rolled loop
- sqlcgen_test.go: interface{} -> any in the generated-style DBTX shim
- caps_roundtrip_test.go: new(idParent.String()) instead of proto.String
  for the pointer literal

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 17:51:08 +08:00
Alex Dunmow
7881aeee05 feat(wasmguest): guest DB driver bnwasm (WO-WZ-004)
Guest-side database access over the db.* host calls (abiv1 db.proto),
two surfaces sharing one injected transport:

- database/sql driver registered as "bnwasm" (driver.go) — QueryContext/
  ExecContext/BeginTx over db.query/db.exec/db.tx_*; named args rejected.
- plugin.Pool (pool.go) handing out a pgx.Tx-shaped value (tx.go), so the
  pgx-flavored sqlc DBTX every current plugin generates against
  (sql_package: pgx/v5) is satisfied with no source edits. This is the
  primary path: their DBTX needs pgconn.CommandTag/pgx.Rows/pgx.Row, which
  database/sql cannot produce.

DbValue↔Go mapping (dbvalue.go) covers all 11 oneof arms both directions;
DbError surfaces as *pgconn.PgError (SQLSTATE preserved for errors.As);
nested tx/savepoints rejected with a clear error (no fleet plugin uses
them). The scan contract is pinned in the exported DbValueFixtures table
(dbvalue_fixtures.go) that the WO-WZ-007 host executor mirrors.

Tests: driver_test.go (fake host — every DbValue variant round-trips with
correct scan types, exec rows-affected, ordered host-call assertions for
tx commit/rollback sequences, post-rollback autocommit carries no handle)
and sqlcgen_test.go (vendored sqlc-style Queries + WithTx run against the
fake host). Native + wasip1 builds green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 14:41:45 +08:00