Repository navigation
Commit c06a851
test(drivers): assert the DuckDB store is a live engine, not just an open-looking connection
Every existing assertion in `duckdb-open-e2e.test.ts` can be satisfied by a
connection that is not really there. A row count can legitimately be zero, and
an absent error string can mean the error was swallowed rather than that none
occurred — which is live on `main` today: `register.ts`'s `sql.execute` catches
everything and returns `{ row_count: 0, error }` instead of throwing, and
`formatResult` renders "(0 rows)" without ever reading `error`. So "(0 rows)"
and "the driver is dead" are indistinguishable to anything downstream.
`md5()` is not. A dead connection cannot return one row, and a live one cannot
return the right digest without hashing the input, so this is a check whose
correct answer cannot be produced without touching the thing under test.
Added in two places:
- The `beforeAll` gate, which already refused to run against a fake driver but
did so on a row count a stub can trivially return. The digest is the half a
stub cannot satisfy by returning a plausible shape, and it gates the whole
file.
- An explicit test after the store-open assertions, asserting both that exactly
one row came back and that the digest is correct.
The expected digest is computed independently (`hashlib.md5`, cross-checked
against `md5(1)`), never by asking DuckDB — deriving it from the system under
test would make the assertion circular.
Not hypothetical for this PR: during the driver A/B, two binaries looked clean
across transcripts, traces and 563 lines of debug output — zero ENOENT, zero
fault lines — while failing to load the driver entirely. A probe of this shape
is what caught it, after four earlier probe designs passed while proving
nothing.
**Verified the assertion is load-bearing rather than decorative**, since a
liveness check that cannot fail is exactly the defect it exists to prevent:
- DuckDB independently returns `517f58256b5ba4642643b3e884d91d15` for the
nonce, matching the digest computed outside it.
- A wrong digest fails the `beforeAll` gate and aborts the entire file
(0 pass, 1 fail).
- A wrong digest in the test alone, with the gate left intact, fails that test
(13 pass, 1 fail).
- Appending `WHERE false` to reproduce the "(0 rows)" shape that reads as
success downstream also fails the test (13 pass, 1 fail) — the swallowed-error
case specifically.
Gates unchanged: typecheck 13/13; markers ok against `origin/main`; drivers 142
pass 0 fail; `test/altimate` 4224 pass 0 fail (one additional skip, the new
gated test); gated E2E 22 pass 0 fail on six consecutive runs; lint 5864
warnings / 1 error, byte-identical to the previous commit — the error remains
the pre-existing `consistent-return` in
`packages/http-recorder/test/record-replay.test.ts`.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VqnuBDGkh1ZT65Ti7e6DHZ1 parent 6ac0c64 commit c06a851
1 file changed
Lines changed: 41 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
38 | 61 | | |
39 | 62 | | |
40 | 63 | | |
| |||
55 | 78 | | |
56 | 79 | | |
57 | 80 | | |
| 81 | + | |
58 | 82 | | |
59 | 83 | | |
60 | | - | |
61 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
62 | 87 | | |
63 | 88 | | |
64 | 89 | | |
| |||
84 | 109 | | |
85 | 110 | | |
86 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
87 | 126 | | |
88 | 127 | | |
89 | 128 | | |
| |||
0 commit comments