Skip to content

test: repair SQLite routing and daemon teardown failures - #29607

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/test-audit-adoption-daemon-teardown
Oct 16, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/test-audit-adoption-daemon-teardown

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

A terminal-daemon integration test can finish its assertions successfully and then fail cleanup when the daemon retires before cleanup can authenticate. Permit that specific loss of contact only after the operating system proves the recorded process has exited. Also route three real SQLite relay fixtures through Node, correcting the second failure found in the same workflow. Product behavior remains unchanged.

What Changed

Register the three legacy-relay CLI database suites in the existing SQLite/Node runtime list. Their 31 cases and the existing routing guard remain unchanged. The guard correctly caught their omission; suppressing it or mocking databases would hide the defect.

In the existing temp-profile teardown fixture, catch only the existing unverified-owner error and continue to the same bounded process-exit wait. A live process still fails at ten seconds. A verified different owner or any unexpected cleanup error still fails immediately. No PID-kill fallback or production code change.

Add four fault cases to the existing teardown suite: an exited process after lost contact, a live process after lost contact, a different owner and an unexpected error. The real pid records, child exit and OS exit probe remain; only authenticated cleanup's network outcome is injected at its existing module boundary. All fourteen prior exit-proof cases remain unchanged.

Why

The full workflow for #29324 failed after the upgraded Electron→Node adoption assertions, with “the expected daemon could not be verified.” Teardown kills shell processes before authenticating cleanup, allowing normal daemon retirement to race authentication. The log confirms the cleanup failure; it does not expose the underlying connection error, so natural retirement remains a source-supported explanation rather than a confirmed diagnosis.

Requiring OS exit proof fixes that legitimate cleanup path without treating a missing endpoint as process death, weakening production owner checks or adding a production test hook. Broadly swallowing errors would hide a replacement-owner conflict, so those failures retain their veto.

Linked Issue

Maintainer-directed CI audit; both failures observed in full PR run 38884178158 (shards 2 and 3). The teardown failure repeated in 38885690932, this time in the same-build adoption case. This PR supersedes the routing-only #29603 so both repairs can pass together.

Visual Proof

N/A — test fixture only; no visual or interaction change.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Linux, background launch, Node 24.21.0 / Bun 1.4.3:

  • SQLite routing: the same 42 cases change from 41 pass / 1 routing failure to 42 pass, with all 31 relay cases running under Node. All 97 relay/runtime-boundary sibling cases pass shuffled.
  • The exited/unverified regression fails with the original fixture and passes with this repair.
  • Removing the exit wait fails the live-process guard. Broadening the catch fails both different-owner and unexpected-error rows. Each fixture mutation was restored byte-for-byte.
  • All 26 cases in teardown, production cleanup policy, Electron→Node adoption and AppImage-copy suites pass shuffled (seed 104729). Real Electron daemon launch uses ELECTRON_RUN_AS_NODE; no windows are shown.
  • Node typecheck, changed-code quality, targeted lint/format and diff checks pass.
  • One same-three-case adoption before/after pair: wall 3,949 → 3,757 ms; module 2,477 → 2,207 ms. No speedup claim; hosted results follow below. The intermittent hosted failure did not reproduce in the unchanged local adoption run; the fault case gives deterministic regression proof.

The routing-only hosted run 38885690932 passes the routing guard and all 31 relay cases under Node, but remains blocked by the independently reproduced teardown failure. Its four selected modules total 8,835 → 10,452 ms versus the prior run; local wall 18,354 → 19,847 ms and module 16,569 → 17,928 ms. No speedup claim. The combined full workflow run 38886303240 passes all five unit shards and aggregate PR checks passed at the exact current head. Its 26 selected cases pass: teardown 183→283 ms, adoption 2,081 ms (failed teardown)→2,136 ms (pass), AppImage 2,129→2,298 ms, production cleanup policy 59→60 ms; summed module work 4,452→4,777 ms. These unpaired observations include four added cases and a failed baseline, so they support no speed claim. All five report inventories reconcile with zero duplicates, unhandled errors or omitted failures. A separate Windows ARM persistence check failed EBUSY while removing an unchanged serve-parity temp root; one same-head rerun passed, followed by every Linux compatibility check. The original failure remains recorded without a lock-holder diagnosis. All 38 check results were complete before merging the exact verified head.

Native macOS/Windows and real SSH were not run locally. The existing platform exit rules are unchanged.

Review

Independent preservation/source review approved the narrow error handling and unchanged original cases; executed controls are recorded. Production cleanup refusal tests remain intact, including the no-kill rule for an unverified or different owner.

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

Three changed paths: runtime routing configuration and two teardown test/support files; no production or remote wire changes. Exact existing error text intentionally scopes the allowed failure; a changed error class/message conservatively rejects cleanup until reviewed.

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)

@OrcaWin OrcaWin changed the title test: prove daemon exit after cleanup loses contact test: repair SQLite routing and daemon teardown failures Oct 16, 2026
@OrcaWin
OrcaWin changed the base branch from OrcaWin/fix-legacy-relay-sqlite-test-runtime to main October 16, 2026 10:22
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7b67a290-1925-4865-a9e0-03073d5155af
📥 Commits

Reviewing files that changed from the base of the PR and between bb441d1 and bf340ab.

📒 Files selected for processing: 3
  • config/scripts/vitest-sqlite-runtime-files.mjs
  • src/main/orcad/orcad-daemon-teardown-fixture.ts
  • src/main/orcad/orcad-daemon-teardown-linux.test.ts

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

📝 Walkthrough

The SQLite runtime include list now contains three legacy relay bridge tests. Profile-daemon teardown suppresses a DaemonEndpointOwnershipError only when its message matches the expected-daemon-verification text. Other cleanup errors still propagate, and teardown continues to wait for OS-confirmed process exit. New Linux tests cover exited and live processes, timeout behavior, and error propagation.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to bf340

No actionable issue is established; the change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Description check Passed The description is detailed and aligned with the template. It explains the test-only changes, rationale, scope, fault cases, testing results, platform limitations, and review considerations. The linke…
Title check Passed The title clearly summarizes the two main changes: repairing SQLite routing and daemon teardown test failures. It is concise, specific, and directly related to the pull request.
Full details: Description check

Explanation

The description is detailed and aligned with the template. It explains the test-only changes, rationale, scope, fault cases, testing results, platform limitations, and review considerations. The linked issue section does not provide a direct issue link, and the full checklist commands are not explicitly confirmed, but these omissions are non-critical because the author identifies the maintainer-directed audit and pending CI coverage.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 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 merged commit 7a77653 into main Oct 16, 2026
48 of 49 checks passed
34 added a commit to 34/orca that referenced this pull request Oct 20, 2026
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