test(client,perf): make companion tunnel and perf-capture assertions discriminating
Merged
TH
6d ago+224+224+012345678901234567890123456789-125-125-012345678901234567890123456789
Summary
Ships Area 1 of #3461 (test-quality fixes from #3429/#3432 reviews). Tests only; no production changes.
- Close-code test (
client-companion-tunnel-worker.test.ts): asserts each expected wire close per stream and adds a fractional3500.5bridge code. SincenormalizeOutgoingCloseCodepasses any 3000–4999 value through, this is the seam that makesnormalizeCloseCode's non-integer rejection observable: dropping that guard now fails with 3500 ≠ 3001. - Teardown chain (
client-metro-companion.test.ts): the seven chained scenarios becametest.eachcases, each with its ownprojectRoot, state file, pid, and outcome tables (previously case 7 reused case 6's state and pid). Mutation-checked individually: dropping EPERM-on-SIGTERM tolerance, the unreadable-command guard, theisProcessAliveearly return, ESRCH-on-SIGKILL tolerance, or turning EACCES into a swallowed code each fails exactly its own case. - EPERM comment: path corrected to
src/daemon/daemon-stop.ts(file verified; docs-only, no mutation). - Perf-capture kind rejection (
platform-runtime-perf-capture-host.test.ts): assertscode: 'INVALID_ARGS'alongside the message. Flipping the producer toCOMMAND_FAILEDnow fails the test.
Validation
Head 7f9500d0a. pnpm check:affected --run: passes locally under the machine lock. pnpm check:coverage-crap --all on the touched sources: no function at or above CRAP 30 (85.99% stmts). Per-check mutation evidence in the Summary; production tree restored clean after each.