|
| 1 | +# Node SQLite migration proof |
| 2 | + |
| 3 | +## Claim |
| 4 | + |
| 5 | +The five gitcrawl SQLite query subprocesses now use Node 24's synchronous |
| 6 | +`node:sqlite` API in read-only mode without changing their parsed row, scalar, |
| 7 | +empty-result, or caller-level error contracts. The cluster-intake workflow no |
| 8 | +longer installs the obsolete `sqlite3` executable. |
| 9 | + |
| 10 | +## Host equivalence |
| 11 | + |
| 12 | +`run-proof.mjs` creates a real portable gitcrawl database with committed rows |
| 13 | +still resident in its WAL sidecar. It extracts the three old source files from |
| 14 | +`origin/main`, verifies their five old `sqlite3` invocations, and executes the |
| 15 | +same scalar and JSON queries through the host `sqlite3` CLI and the new |
| 16 | +`node:sqlite` helper. Their parsed JSON bytes and scalar text must be identical. |
| 17 | + |
| 18 | +Run after `pnpm run build:all`: |
| 19 | + |
| 20 | +```sh |
| 21 | +node docs/proof/node-sqlite-migration/run-proof.mjs |
| 22 | +``` |
| 23 | + |
| 24 | +The machine-readable result is `equivalence.json`. |
| 25 | + |
| 26 | +## Contract decisions |
| 27 | + |
| 28 | +JSON query rows intentionally remain ordinary JavaScript objects containing |
| 29 | +numbers. Statements read SQLite integers as BigInts and explicitly normalize |
| 30 | +them with `Number()`, matching the old `sqlite3 -json` plus `JSON.parse` path, |
| 31 | +including its precision loss above `Number.MAX_SAFE_INTEGER`. Scalar queries |
| 32 | +retain exact decimal text; their existing callers continue to apply `Number()`. |
| 33 | + |
| 34 | +Every query opens `DatabaseSync(dbPath, { readOnly: true })`, so committed WAL |
| 35 | +rows remain visible while a missing database is no longer created as a side |
| 36 | +effect. Related-context still catches query failures: a missing configured path |
| 37 | +returns `[]`/`false` before a query, and a corrupt store returns `[]`/`null`. |
| 38 | +Both importer entry points still fail nonzero for missing or corrupt stores. |
| 39 | + |
| 40 | +## Container and gates |
| 41 | + |
| 42 | +The seven local gates passed on Node 24.19.0 and pnpm 11.10.0: |
| 43 | + |
| 44 | +1. Host old/new equivalence proof: three scalar and three JSON query cases, |
| 45 | + including missing/corrupt error evidence. |
| 46 | +2. Focused real-database fixtures: 6 passed, 0 failed. |
| 47 | +3. `pnpm run build:all`: all three TypeScript projects passed. |
| 48 | +4. `pnpm run test:no-build`: 3,333 tests; 3,324 passed, 9 skipped, 0 failed. |
| 49 | +5. `pnpm run lint`: all four lint lanes passed. |
| 50 | +6. `pnpm run format:check`: 663 files passed. |
| 51 | +7. `pnpm run check:static`: active-surface, dashboard boundary, docs, limits, |
| 52 | + and format checks passed. |
| 53 | + |
| 54 | +The committed `container-proof.sh` requires a fresh PR checkout whose image has |
| 55 | +no `sqlite3` binary. It installs the repository's pinned pnpm through Corepack, |
| 56 | +downloads jq 1.8.1, verifies the selected jq binary against the official |
| 57 | +published checksum, runs the focused real-database fixtures through only the |
| 58 | +new path, and then runs the full `pnpm check` gate. |
| 59 | + |
| 60 | +Container provenance and secret-scanned stdout are committed alongside this |
| 61 | +proof after the required `--fresh-pr` run. Crabbox resolved `provider=aws` and |
| 62 | +ran pushed head `31386dccd6ee9f77fe480ab6c705253647f4aaf2` in lease |
| 63 | +`cbx_3ddd8eadc1bb` (`amber-barnacle-28b5`), run `run_61e78be4ed53`. The |
| 64 | +`node:24-bookworm` command exited 0 after 187,543 ms: all 6 focused fixtures |
| 65 | +passed, then full `pnpm check` passed 3,333 tests with 3,325 passed, 8 skipped, |
| 66 | +and 0 failed at 81.60% line, 74.06% branch, and 87.40% function coverage. |
| 67 | +`sqlite3` was absent before and after the rsync-only system dependency setup. |
| 68 | + |
| 69 | +The full 571,547-byte stdout capture has SHA-256 |
| 70 | +`28669d632e2d5387d901c76504611ab37a19bd23de0c29453767e2bf5efe5c76`. |
| 71 | +TruffleHog 3.96.0 scanned that exact file with zero verified or unverified |
| 72 | +secrets; `container-stdout.log` retains the proof-bearing stdout lines. Full |
| 73 | +machine-readable details, including the three discarded harness attempts, are |
| 74 | +in `container-provenance.json` and `container-secret-scan.json`. |
| 75 | + |
| 76 | +The run's project-local Crabbox 0.38.3-5 wrapper timed out while releasing the |
| 77 | +otherwise successful lease. Crabbox 0.41.1 then explicitly released |
| 78 | +`cbx_3ddd8eadc1bb`; a provider-specific lease listing returned empty. |
| 79 | + |
| 80 | +## Limits and Bay impact |
| 81 | + |
| 82 | +Fixtures are disposable local files; no proof command contacts Gitcrawl, |
| 83 | +GitHub APIs, Worker storage, or another production service. The host needs |
| 84 | +`sqlite3` only for old-path equivalence. The container intentionally cannot run |
| 85 | +the old path because the binary is absent. |
| 86 | + |
| 87 | +OpenClaw Bay is unaffected. This changes local read-only store access and one |
| 88 | +workflow bootstrap step, not lifecycle publication, queue control, status |
| 89 | +telemetry, dashboard data, or Bay's observer-only boundary. |
0 commit comments