Skip to content

test(sqlite): fix Node 26 node-next-compat SQLite failures - #34661

Merged
OrcaWin merged 1 commit into
mainfrom
fix/node26-sqlite-compat-tests
Oct 28, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
fix/node26-sqlite-compat-tests

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

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

Problem

The nightly node-next-compat.yml has failed every day since 2026-09-26. Each night two SQLite tests fail on the Node 26 lane. The Node 24 lane passes.

Test Error First failing Node 26
sync-database-portability.test.ts › rejects explicit undefined bindings before modifying rows AssertionError: expected [Function] to throw an error 2026-09-26 (run 36234782836) 26.10.0
profile-state-streaming-validation.test.ts › accepts extra columns that shadow every SQLite rowid alias Error: cannot add rowid alias: rowid (thrown by ALTER TABLE ... ADD COLUMN rowid) ~2026-10-15 (run 38718018848) 26.12.0

Other Node 26 failures I saw were intermittent and unrelated: the palette-match perf budget, ssh-remote-commands, and bounded-output-sink. None of them repeat across nights.

Root cause

These are Node 26 changes to node:sqlite. They are not native-module ABI problems. I reproduced both locally with npx node@26 (26.12.1):

Behavior Node 24.22.1 / 26.8.1 (SQLite 3.53.4) Node 26.12.1 (SQLite 3.54.0)
ALTER TABLE t ADD COLUMN rowid ... ok cannot add rowid alias: rowid
CREATE TABLE u(a, rowid, _rowid_, oid) ok ok
stmt.run(undefined) throws ERR_INVALID_ARG_TYPE binds NULL

Decision

Product code is not affected. Desktop runs on Electron 43, and orcad runs on the bundled Node pin (NODE_RUNTIME_PIN 24.22.1). Neither uses the user's system Node.

Validation

  • Locally on Node 26.12.1, the original rowid test fails and the new one passes. Both files pass on 24.22.1.
  • pnpm check:changed --maxWorkers=2 passes.
  • node-next-compat was dispatched on this branch; the result is in the comments below.

Node 26.12 bundles SQLite 3.54, which rejects ALTER TABLE ADD COLUMN for
rowid aliases; rebuild the shadowing table with CREATE TABLE instead.

Node 26.10 binds explicit undefined as NULL. The deleted test only pinned
node:sqlite's own validation (a parity guard for the removed Bun adapter);
SqliteBindings already rejects undefined at compile time.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
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: 1dac8ee5-e2a5-41a3-9907-23e64059f28d
Commits

Reviewing files that changed from the base of the PR and between 4f9b331 and 51c41d6.

Files selected for processing: 2
  • src/main/persistence/profile-state/profile-state-streaming-validation.test.ts
  • src/main/sqlite/sync-database-portability.test.ts
Files with no reviewable changes: 1
  • src/main/sqlite/sync-database-portability.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Walkthrough

The persistence test now rebuilds the automation-runs table to add columns that shadow rowid, _rowid_, and oid, then checks that each alias returns 'shadow'. The SQLite portability tests no longer include the test for explicit undefined bindings.

Priority: Low

Merge Risk: Minimal · up to 51c41

The SQLite compatibility test changes are structurally sound and introduce no established merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description provides useful problem, root-cause, decision, and validation details, but it does not follow the required template and omits the required linked issue, ELI5, What Changed, Why, Visual… Update the description to include all required template sections. Add a valid issue reference under “Linked Issue” using “Fixes #”, state “N/A” with a reason for Visual Proof, complete the testing and checklist items, and provide the…
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the test-only SQLite fixes for Node 26 compatibility failures.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Full details: Description check

Explanation

The description provides useful problem, root-cause, decision, and validation details, but it does not follow the required template and omits the required linked issue, ELI5, What Changed, Why, Visual Proof or N/A, checklist, and other repository sections.

Resolution

Update the description to include all required template sections. Add a valid issue reference under “Linked Issue” using “Fixes #<issue>”, state “N/A” with a reason for Visual Proof, complete the testing and checklist items, and provide the required repository and AI-disclosure information.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • 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.

@OrcaWin

OrcaWin commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

node-next-compat dispatched on this branch: https://github.com/stablyai/orca/actions/runs/40616630336 passed. All Node 24 and Node 26 (26.12.1) unit shards and relay integration jobs succeeded.

@OrcaWin
OrcaWin merged commit e5f1eef into main Oct 28, 2026
64 checks passed
nplez1 added a commit to nplez1/orca that referenced this pull request Oct 29, 2026
#247)

* fix(lint): drive the two #198 flaky-pattern reds with fake timers

`lint:ast-grep-gates` carried a known-red entry for each of two files PR #198
merged: four `Date.now()` reads in `check-details-cache.test.ts` and a 250 ms
real-time wait in `checks-list-expanded-details.test.tsx`. Both are the fork's
own work, and `local/lint-known-red.json` had them down as `foreign-red`.

Both are now fixed where the ratchet asked for them:

- the cache suite pins the clock with `vi.useFakeTimers()` + `vi.setSystemTime()`,
  which is what the TTL cases needed — `checkDetailsNeedRefresh` compares a
  payload's `readAt` against the wall clock, so they were really asking how fast
  the machine ran them;
- the checks-list suite drives `useDelayedFlag`'s 200 ms deferral with
  `vi.advanceTimersByTimeAsync(250)` instead of sleeping 250 real milliseconds to
  catch a label a fast machine never shows.

The claim recorded alongside the entries — that each `match` naming the rule and
the path means "a new finding in either file still fails the gate" — was false:
the ratchet prints one line per rule and file, and the regex is anchored on the
rule and the path alone, so a fifth `Date.now()` in the same file was masked.
The section in LOCAL-PATCHES.md now says so.

* fix(test): route the two Bun-missed SQLite suites to Node

`findSqliteRuntimeTests` classifies a test by the imports it names, and it
cannot follow an indirect one. Two suites reach `node:sqlite` through modules
it does not know — `tests/e2e/helpers/persisted-profile-state.unit.test.ts`
imports the profile-state modules directly, and
`src/main/ai-vault-search/session-search-indexer.test.ts` reaches the driver
through the indexer, the schema and its fixture — so both ran in the Bun
project. Bun's `node:sqlite` on macOS cannot open a WAL database read-only once
`close()` has removed `-wal`/`-shm`, so they failed 2/3 and 1/42 there and pass
3/3 and 42/42 here.

Both are now in `NODE_RUNTIME_INCLUDE`, with the reason, and
`vitest-node-runtime-boundary.test.ts` pins the pair: nothing else would notice
their removal, because the only other evidence was the known-red manifest.

That also retires the two `Unable to read profile state database` entries.
Their `match` string is what a genuine profile-state open regression throws, so
while they were allowlisted the gate could not have seen one.

* fix(unit-gate): catch a dead allowlist entry, and prune nine

`local/gate-unit.mjs` derives staleness only from an entry that *matched a
failure*, so an entry naming a test that no longer exists can never be reported:
it sits in the manifest for ever, and only a 25-minute full run could have said
anything about it — and that run derives nothing from an entry nothing matched.

One such entry was there. `src/main/sqlite/sync-database-portability.test.ts >
SQLite runtime contract rejects explicit undefined bindings before modifying
rows` names a case upstream stablyai#34661 (`e5f1eef466`) deleted, because Node 26.10
binds an explicit `undefined` as NULL. Its recorded cause — "the bundled SQLite's
own binding behaviour" — was wrong, and `LOCAL-PATCHES.md` now says what actually
happened.

So the title is now checked against its file, statically, at PR time.
`titleExistsInSource` in `local/unit-gate-judgement.mjs` rebuilds a Vitest full
name — the `describe` chain and the case title joined by single spaces — from the
file's own title literals, treating an `it.each` substitution as a wildcard, and
`tests/tools/unit-gate.test.mjs` asserts the real manifest has no dead entry.

Nine entries are pruned with it, every one re-measured today:

- the four topology cases run in the Node project already, since upstream stablyai#33533
  (`a886dcd1fe9`) seated their fixture in the import scan; 3/3, 1/1 and 9/9 pass;
- `profile-state-streaming-validation`'s rowid case was rebuilt by stablyai#34661 to use
  `CREATE TABLE` over `ALTER TABLE … ADD COLUMN`; 16/16 pass;
- the two re-routed suites from the previous commit, and the now-deleted case.

What remains is 8 entries, all `host-toolchain`; the `sqlite-binding` class is
empty. Each prune carries its reason and the revision that closed it in
`prunedSince`, which keeps `observedRun`'s arithmetic honest.

* fix(unit-gate): close the review round on the guard and the timers

Adversarial review of the branch (Opus, high, over 6d7cb78..HEAD) found
nothing blocking and two should-fix gaps in the new guard, plus five MINOR and
four NIT. Each is addressed here.

Guard soundness — it reported live tests as dead in shapes this repo writes:

- `$name` off an `it.each` table row is a substitution like `%s`; the comment
  claimed it and the pattern did not have it. `%$` too.
- case tables are named `itRunsUnixShell.each(...)`, not `it.each(...)`, so the
  caller pattern now accepts any identifier starting with describe/it/test/suite.
  `src/main/cli/packaged-cli-assets.test.ts` is exactly that shape and would have
  reported its live title as dead.
- `src/main/runtime/orca-runtime.test.ts` imports every case from `*.spec`
  modules, so its titles are in files the entry does not name. `source` is now
  the file plus those modules, via `importedCaseSpecifiers`.

Guard precision — it called dead entries live:

- `it.skip` / `it.todo` never run, so a title behind one can never be a known
  red. Both now read as absent. A title surviving only in a comment still counts
  as present, and the doc comment says so.

Coverage for both directions (`tests/tools/unit-gate.test.mjs`, 29 → 31 tests):
nested describes, `$name`, an aliased table, a generic `.each`, an apostrophe in
a double-quoted title, a template-literal title, skip/todo, and a real
spec-imported title that must be found through the follow and not without it.

The deferred-label case also asserted only half of what its comment claims: it
now proves "Refreshing check details…" is absent at 199 ms and present at 250 ms,
which is the deferral `useDelayedFlag` exists for and costs milliseconds with the
clock faked.

Three LOCAL-PATCHES claims were wrong and are corrected: the prune split is seven
re-routed and two upstream-rebuilt (not six and three), the rowid diagnosis was
right about SQLite 3.54's `ADD COLUMN` refusal and wrong only about the cause
being fork-local, and the `local(lint)` entry count is now zero.

* fix(unit-gate): keep a literal %% in an each title a wildcard

The delta re-check (Opus, high, over R1..R2) came back clean with one MINOR
regression from that round's own fix: the widened substitution class dropped
`%%`, which Vitest renders as a single `%`, so a title written `shows 50%% done`
would have looked dead at `shows 50% done`. `%` is back in the class, and the
test pins `%%` and `%$` so neither can be dropped again.

The doc comment also claimed the comment-only shape was the *one* thing the
check cannot tell apart. It is not: a title behind `(cond ? it : it.skip)('t')`
is unresolved callee, not a skip, so it reads as present too. Both are stated.
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