fix(test): stop processes a test run leaves in its temp directory
Summary
Test runs left fixture processes running for weeks. On one host, 13 orphaned fake daemons and a validation command group were still alive 5ā16 days after their runs ended.
Vitest global teardown and the node --test wrapper removed the run directory without stopping processes that still held it as TMPDIR. Teardown now stops leftover process trees and lists them on stderr. A root is a Node process in the run directory whose parent is neither the run owner nor another run process. Its descendants are stopped with it. This covers subreapers and a PID 1 runner. Shared tools such as adb or an emulator run another executable, so teardown leaves them alone. The wrapper stops leftovers only after its child exits, including after a forwarded Ctrl-C. Teardown always removes the directory.
The check-affected execution tests now kill the recorded command group when they fail before learning its PID.
6 files, test tooling only. No linked issue.
Validation
pnpm check:tmpdir-leaks:test: 28/28 at 598c4b1. The new wrapper tests (a fixture tree with a surviving non-Node tool, and an interrupted wrapper) fail at b985f53.pnpm check:affected --run --head b985f53176: passed (66 checks).- At 8a3d724 and 598c4b1 the local
unitcheck failed, at load average 40ā73. At 598c4b1 all 1,849 test files pass; the only failures are unhandled errors fromexplicit-lifecycle-fixture.ts. Those errors reproduce with the base teardown files, and the changed code runs only after all workers exit. The CI unit lane at this head is the evidence. - CI covers the Linux
/procpath.
š¤ Generated with Claude Code