The negative-control test had a 200ms margin against a real process exit,
which is too thin to rely on under a loaded CI runner.
stopInternal() races the shutdown RPC against waitForExit(), and the RPC
resolves as soon as the worker acks. It then allows only a further 500ms
before escalating to SIGTERM. The fixture exited 300ms after acking, so a
late timer or a slow exit propagation would have surfaced as SIGTERM and
failed the "signal must be null" assertion for a reason unrelated to the
guard under test.
Two deadlines were squeezing from opposite sides: the destroy had to land
before the fixture exited, and the fixture had to exit before the host
escalated. Widening one window narrows the other, so the fix is to stop
polling rather than to retune the constants.
The test now kills the command channel from a hook on the host's own
stdin.write, firing the moment the shutdown payload is flushed, instead of
waiting for status "stopping" via vi.waitFor. That removes both races: the
destroy lands immediately after the shutdown reaches the worker, and the
fixture's exit delay drops to 100ms, leaving 400ms of margin.
The hook is also a stronger precondition than the status poll it replaces.
sendMessage() is only reached for "shutdown" from inside stopInternal(),
which sets intentionalStop before it writes -- so firing there proves we are
inside the intentional-stop window rather than inferring it from an
observable status. The previous writableLength check is subsumed: the pipe
is destroyed from the write path itself, after the payload is handed off.
Added an explicit aliveAtDestroy assertion so the vacuous case is loud. If
the fixture ever exits before the pipe is killed, the guard is never
exercised and the old test would still have passed; now it fails with
"fixture exited before the command channel was killed".
Re-verified by mutation, not just by going green:
- manager reverted to the pre-fix parent aa6b6bcb (supervision block absent,
grep -c to zero, not a partial mutation) fails case 1 only, with
"worker was left alive and uncommandable after its command channel died";
- removing only the `intentionalStop ||` guard fails case 2 only, with
"expected 'SIGKILL' to be null".
Each mutation still reds exactly one test and leaves the other green. Suite
run 5x consecutively, clean. Server typecheck clean. Test-only change: no
source file is touched.