Repository navigation
refactor(test): type the respawn exit mock directly - #137258
Conversation
Declare the existing exit signature in vi.fn instead of double-asserting it at runtime injection. Keep the PID-less child, spawn adapter, and all existing lifecycle assertions. Validation: same 44 owner/sibling cases before and after; full changed gate and managed Codex P2 review passed. Production unchanged.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 3, 2026, 7:20 AM ET / 11:20 UTC. ClawSweeper reviewWhat this changesThe PR gives the CLI respawn test’s mocked non-returning exit callback its declared Vitest type directly and removes the redundant injection cast. Merge readiness✅ Ready for maintainer review The patch is a correct, behavior-neutral test cleanup; current main still contains the redundant cast, and this maintainer-owned PR should remain open for normal handling. Likely related people: steipete (recent respawn-area contributor) and Vincent Koc (shared respawn-runner contributor). Priority: P3 Review scores
Verification
How this fits togetherThe CLI entrypoint builds a respawn plan and delegates process startup and terminal exit handling to the shared respawn-child runner. This test checks that injected child-process runtime seam without changing CLI production behavior. flowchart LR
A[CLI entrypoint] --> B[Respawn plan]
B --> C[Shared child runner]
C --> D[Injected exit callback]
E[Respawn lifecycle test] --> C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests 0. Total 0 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Merge the direct mock typing cleanup while retaining the existing respawn lifecycle assertions and shared runner contract. Do we have a high-confidence way to reproduce the issue? Not applicable: the PR refactors a test mock’s static declaration rather than addressing a runtime defect. Is this the best way to solve the issue? Yes: declaring the existing non-returning callback type at mock creation removes an unnecessary double assertion and matches the shared runner’s explicit contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8a718610bd26. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…36761-session-mode-local-20260903 * commit '58187248c8cafd7b8cfbba3de8d001762fb08b48': improve(testing): add watchOS Gateway upgrade survivor (#137203) improve(ui): structure Devices rows with an actions menu and a facts panel (#137084) test(cli): reuse canonical pairing call guard (#137210) fix(sessions): prevent gateway stalls during large session cleanup (#126035) fix(qa): resolve Slack runtime dependency (#137283) fix: fence Session Observer catalog requests (#137243) fix(memory): make watcher pressure guidance actionable (#137181) test(entry): type the respawn exit mock directly (#137258) fix(release): install first-hop fixtures through the candidate registry (#137286) # Conflicts: # scripts/e2e/lib/upgrade-survivor/assertions.mjs
Declare the existing exit signature in vi.fn instead of double-asserting it at runtime injection. Keep the PID-less child, spawn adapter, and all existing lifecycle assertions. Validation: same 44 owner/sibling cases before and after; full changed gate and managed Codex P2 review passed. Production unchanged.
What Problem This Solves
The CLI respawn test double-asserted an untyped exit mock to its runtime contract, even though Vitest can declare that type directly.
Why This Change Was Made
Declare the existing
(code?: number) => neversignature invi.fnand pass the mock directly. The mock implementation, PID-less child, spawn adapter, and all lifecycle assertions remain unchanged.User Impact
No user-visible change. Production +0/−0; tests +2/−2. Existing Windows, CA, Gmail, terminal, signal, and child-cleanup coverage is preserved.
Evidence
entry.respawn,respawn-child-runner,child-process-bridge, and the canonicalexpecthelper suites.check-changedgate passed all 20 stages, including core-test typecheck, typed lint, and dead-export scans.