Skip to content

Prove portable SQLite claim and BLOB behavior - #48

Merged
kcsfelty merged 2 commits into
mainfrom
agent/search-contract-sqlite-conformance
Jul 21, 2026
Merged

Prove portable SQLite claim and BLOB behavior#48
kcsfelty merged 2 commits into
mainfrom
agent/search-contract-sqlite-conformance

Conversation

@kcsfelty

@kcsfelty kcsfelty commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add one shared low-level SQLite capability suite, executed through four persisted Node SQLite connections and a real Miniflare/workerd D1 binding
  • prove the observable conditional semantics of UPDATE ... RETURNING: concurrent submissions produce exactly one winning claimant, and a revision-only stale probe produces zero rows/changes
  • retain the existing separate child-process test as the evidence for native physical lock contention and bounded busy timeout; the shared suite does not claim to force lock overlap or scheduling order
  • prove scalar and BLOB bind/read round-trips in both runtimes
  • add the narrowly required readSqliteBytes() helper because Node returns Uint8Array while workerd D1 returns a JSON-compatible byte array; reject sparse and malformed byte arrays
  • document the Diamond handoff boundary: no search, ranking, auth, cursor, queue, lease, or vector semantics

Evidence

  • npm run check (165 tests, coverage 96.24% statements / 91.94% branches / 97.74% functions / 96.24% lines; build, bundled workerd, packed consumer, license and readiness gates pass)
  • npm run conformance (490/490 applicable W3C SPARQL 1.1 cases)
  • shared capability suite passes in persisted Node WAL and real workerd D1
  • existing bounded child-process contention test remains green

Strongest counterargument

The new helper expands the production API for what could remain an application-local conversion. The runtime evidence shows the row shapes genuinely differ, however, and leaving normalization to each consumer would undermine the shared adapter contract. The helper is deliberately only a dense, validated, copying byte conversion; it contains no domain behavior.

Production API impact

One additive root export: readSqliteBytes(value): Uint8Array. No existing behavior or type changed.

CI notes

The first W3C run passed its 490/490 summary and then failed the second EARL pass on a transient upstream manifest fetch; a fresh run is pending. The audit gate independently began failing on a newly published high-severity sharp/libvips advisory in dev-only Miniflare/Wrangler. Latest upstream Miniflare still pins vulnerable sharp@0.34.5; this PR does not force an unsupported major override or conceal that advisory.

@kcsfelty
kcsfelty force-pushed the agent/search-contract-sqlite-conformance branch from bb7b8a4 to 8013e2a Compare July 21, 2026 23:05
@kcsfelty
kcsfelty merged commit 4916d93 into main Jul 21, 2026
10 checks passed
@kcsfelty
kcsfelty deleted the agent/search-contract-sqlite-conformance branch July 21, 2026 23:08
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