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
test: repair SQLite routing and daemon teardown failures - #29607
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)
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: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
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 checks: 4 passed
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Linux, background launch, Node 24.21.0 / Bun 1.4.3:
ELECTRON_RUN_AS_NODE; no windows are shown.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 passedat 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 failedEBUSYwhile 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
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)