Skip to content

test: run session-search index tests on Node's SQLite - #35389

Merged
nwparker merged 1 commit into
mainfrom
nwparker/session-search-indexer-node-sqlite
Oct 28, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/session-search-indexer-node-sqlite

Conversation

@nwparker

@nwparker nwparker commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2

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 with Error: unable to open database file (from SyncDatabase.prepare), every run under Bun. It passed on Linux CI and under Node.

After: the 14 test files that use session-search-indexer-test-fixture run in the node-runtime project and pass.

Mechanism:

  • vitest-sqlite-runtime-scan.mjs sends tests that import SQLite or a SQLite test harness to the Node runtime.
  • It only sees direct imports. These tests import SyncDatabase as a type only; their fixture opens the database, so the scan missed them.
  • The fixture is now listed in SQLITE_HARNESSES, like the other SQLite harnesses.

Why

Root cause, checked directly: a WAL database closed by its writer, then opened readOnly:

  • Bun on macOS (system SQLite 3.51.0): unable to open database file
  • Node (bundled SQLite 3.53.4): reads fine

The 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:

  • Opening the read connection read-write in the fixture would hide the runtime mismatch.
  • Skipping on macOS is not allowed.

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.ts failed 3 runs out of 3 on macOS under Bun.

  • The scan's own tests pass: vitest-sqlite-runtime-cache, vitest-sqlite-runtime-boundary, and ci-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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 557f0277-b69c-4760-a9ec-e9584eb8c2e5
Commits

Reviewing files that changed from the base of the PR and between 2be70e5 and d82c13a.

Files selected for processing: 1
  • config/scripts/vitest-sqlite-runtime-scan.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker

Copy link
Copy Markdown
Contributor Author

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.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Adds session-search-indexer-test-fixture to SQLITE_HARNESSES, routing its test users to Node’s SQLite.

  • Session-search index tests that use the fixture run under Node.

Reviews (1) · Last reviewed commit: "test: run session-search index tests on ..." · Reviewed by Greptile

@nwparker
nwparker merged commit c1110e1 into main Oct 28, 2026
48 of 53 checks passed
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