Context
Bun corpus position 4040, js/third_party/pg-gateway/pglite.test.ts, currently stops at unsupported mixed type/value module syntax. The upstream test creates a PGlite database, serves its PostgreSQL protocol through pg-gateway/node, and queries it through Bun.SQL using prepared, parameterized, simple, and unsafe paths.
Required contract
- Rewrite the mixed
node:netimport without retaining the type-onlyAddressInfobinding. - Provide
pg-gateway/node.fromNodeSocketwith trust-auth startup/message lifecycle behavior. - Extend the PGlite bootstrap adapter with initialization, DDL/insert state, and protocol-query behavior.
- Route Bun.SQL tagged, bound,
.simple(), and.unsafe()queries through the in-memory gateway. - Preserve SQL option fields and async disposal.
- Wrap gateway startup/query failures with stable code, operation/phase, sanitized endpoint/database context, original cause, and operation stack frames.
Acceptance
- Position 4040 passes 1/1 with the real copied upstream source.
- Permanent coverage checks all four query paths and structured/redacted gateway diagnostics.
- The focused and cumulative results are recorded in #66.