Repository navigation
test: run session-search index tests on Node's SQLite - #35389
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
STATUS: ready. Head d82c13a. CI-flake fix from the unit-shard triage; load rule run locally (pnpm tc, typecheck:ci, code-quality, anti-slop, oxlint, ast-grep scan and gates) plus the affected tests. Review requested from e9-reviewer. Not merged. |
[Low impact] The PR appears safe to merge. SummaryAdds
Reviews (1) · Last reviewed commit: "test: run session-search index tests on ..." · Reviewed by Greptile |
ELI5
The session-search index tests open the index database read-only to check its contents. One test does that after the indexer has closed. Unit tests run under Bun, and on macOS Bun uses the system's older SQLite, which refuses to open a write-ahead-log database read-only once its writer has closed. That test failed every time on Macs. These tests now run on Node, whose bundled SQLite is the one Orca actually ships in Electron.
What Changed
Before:
session-search-indexer.test.ts› "stops everything on close, including work already queued" failed on macOS withError: unable to open database file(fromSyncDatabase.prepare), every run under Bun. It passed on Linux CI and under Node.After: the 14 test files that use
session-search-indexer-test-fixturerun in thenode-runtimeproject and pass.Mechanism:
vitest-sqlite-runtime-scan.mjssends tests that import SQLite or a SQLite test harness to the Node runtime.SyncDatabaseas a type only; their fixture opens the database, so the scan missed them.SQLITE_HARNESSES, like the other SQLite harnesses.Why
Root cause, checked directly: a WAL database closed by its writer, then opened
readOnly:unable to open database fileThe production indexer runs on Electron's Node SQLite, so Node is the runtime these tests should exercise. This is also the rule the scan already enforces: "SQLite publication … use Node".
Alternatives considered:
Flag-off: test routing only.
User-risk: none.
Linked Issue
CI flake triage; reported failing locally on macOS by a reviewer.
Visual Proof
N/A. Test-only.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
All 14 fixture users now run as
|node-runtime|and pass (181 tests). Before,session-search-indexer.test.tsfailed 3 runs out of 3 on macOS under Bun.The scan's own tests pass:
vitest-sqlite-runtime-cache,vitest-sqlite-runtime-boundary, andci-shard-assignment.Checks run:
pnpm tc,pnpm run typecheck:ci,pnpm run check:code-quality:changed, anti-slop oxlint, oxlint, ast-grep scan and gates.Review
Agent skill upstream boundary
Notes
The scan's cache is keyed by the scan file's own hash, so every checkout re-classifies on its next run.
Status
Ready for review.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)