test(client): cover the out-of-process CRAP functions through their public seams
Merged
TH
8d ago+730+730+012345678901234567890123456789-164-164-012345678901234567890123456789
Summary
Closes #3415, part of the umbrella burn-down #3414.
Five out-of-process functions sat above the CRAP threshold. Each is now reached through its module's public entry point — no new production exports, no test-only injection:
| Function | CRAP before | after |
|---|---|---|
readWorkerOptions | 110 | 10 |
normalizeCloseCode | 46.9 | 11 |
parseDevicePort | 30 | 5 |
handleBridgeHttpRequest | 30 | 5 |
stopCompanionProcess | 44.2 | 11 |
Two findings are exempted rather than covered, because no test can move the number:
packages/platform-web/src/agent-browser-audio-probe.ts(7 fns) — the functions are serialized into a string evaluated inside the browser page, so Node coverage never records them.packages/capture-kit/src/png-worker.ts(runJob) — Vitest v8 coverage does not mergenode:worker_threadscoverage; it measures 0% however much of the worker runs.
Instead of covering runJob, png-worker-client.test.ts now proves each job kind really runs off-thread: a pending job ref()s the worker, so process.getActiveResourcesInfo() reports a MessagePort, which the silent sync fallback cannot produce.
Exemptions use health.thresholdOverrides in fallow-crap.json, which is CRAP-scoped, so complexity findings stay with check:fallow.
Validation
check:coverage-crap --all→ no function at or above 30;--base origin/main→ cleancheck:fallow --base origin/main→ no issues in the changed filescheck:affected --runon the pushed SHA → all runnable checks passedtsc -b,oxlint,pnpm formatclean