You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e0d5dec
Browse filesBrowse the repository at this point in the historyBrowse files
fix(drivers): classify a locked DuckDB store, and stop treating a lock as a broken install
Review round on #1198. Fifteen threads, four of them the same defect.
**A lock on an explicitly read-only open was reported as an unclassified
failure.** `connect()` only wrapped a lock error on the retry path, and an
explicit `config.readonly` open never reaches that path — correctly, since
DuckDB's file lock is exclusive against read-only opens too, so retrying
`READ_ONLY` when we already asked for `READ_ONLY` would just repeat the same
failure. But the `else` rethrew DuckDB's raw text, and
`categorizeConnectionError` matches only the wrapper's `locked by another
process` wording, so a plain lock collision came out as `other` — the same
shape as a wrong password. Now wrapped (still not retried). `:memory:` is
excluded for the same reason the retry excludes it: no other process can hold
it, so the wrapper's text would be false.
**`categorizeConnectionError` now also matches DuckDB's raw text** —
`conflicting lock` and `could not set lock` — so a lock that reaches it
unwrapped from any other path is still classified.
**A locked store is no longer rendered as a broken client.** It stays
`infrastructure` (nothing about the connection's config is wrong, and a harness
must not score it as a task failure) but is now also `recoverable`, and
`warehouse_test` renders it as `STORE LOCKED` with the remedy the driver's own
message already gives — close the conflicting connection and retry — instead of
the stop-and-report copy meant for an install that will never work.
**Also fixed**
- `setTimeout` clamps a delay past 2^31-1 to about 1ms, so a deliberately huge
`open_timeout_ms` became an immediate deadline — the exact inversion this
change exists to prevent. Clamped before it reaches the timer.
- The deadline message named only `ALTIMATE_DUCKDB_OPEN_TIMEOUT_MS`, which
`config.open_timeout_ms` overrides. It now names both, and which one wins.
- A deadline that fires because the open callback never arrives left the native
handle open. When the callback does arrive late, `onOpen` closes it; when it
never arrives that branch never runs, so the timeout closes it too. Both paths
are idempotent.
- Dropped a dead `msg.includes("duckdb_locked")` clause: `msg` is lowercased, so
`locked` already matches it.
- The `drivers` CI path filter did not list the two DuckDB E2E files its own
step runs, so a PR touching only those files got no execution anywhere — the
driver job skipped, and the main job runs them with the gate unset.
- `Registry.reset()` is synchronous and `close()` is not, so resetting leaked a
native handle per connector. Added `Registry.closeAll()`, used by `reload()`
and by the E2E suite.
- The E2E suite deleted `ALTIMATE_TELEMETRY_DISABLED` on teardown instead of
restoring what it found.
- `bun.lock` did not record the `trustedDependencies` addition.
**Tests**
- `driver-security.test.ts`: an explicitly read-only open that hits a lock is
wrapped, and attempted exactly once with `READ_ONLY`. Fails without the fix.
- `connections.test.ts`: eight cases pinning the classification — DuckDB's
verbatim lock text (which contains `lock` but never `locked`), the wrapper's
text, the open deadline, and which categories are infrastructure vs
recoverable. These run in the normal suite, ungated.
- `duckdb-lock-helper.ts`: holds a write lock from a separate OS process.
In-process is not a test — DuckDB's lock is per-process.
- E2E: read-only and read-write opens against a foreign lock both report a lock
and keep DuckDB's PID detail; the store is usable once the lock is released
(which guards the helper itself); an over-large budget does not become 1ms;
`warehouse_test` reports `store_locked` + recoverable and renders
`STORE LOCKED` rather than stop-and-report.
Gates: typecheck 13/13 (it caught a real error in the new helper, so it does
cover `packages/opencode/test`); markers ok against `origin/main`; drivers
141 pass 0 fail; `test/altimate` 4222 pass 0 fail; gated DuckDB E2E 19 pass
0 fail. Lint is 5863 warnings / 1 error: the error is the pre-existing
`consistent-return` in `packages/http-recorder/test/record-replay.test.ts`, and
the warning count is +1 from an un-awaited `mock.module` in the new test, which
is how every other `mock.module` in that file is written.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VqnuBDGkh1ZT65Ti7e6DHZ
// Verbatim DuckDB output. It contains "lock" but never "locked", which is
31
+
// why matching only the driver's own wrapper wording missed it.
32
+
constRAW_DUCKDB_LOCK=
33
+
'IO Error: Could not set lock on file "/tmp/warehouse.duckdb": Conflicting lock is held in '+
34
+
"/usr/bin/node (PID 65001) by user someone. See also https://duckdb.org/docs/stable/connect/concurrency"
35
+
36
+
test("the raw DuckDB lock message never contains the substring 'locked'",()=>{
0 commit comments