Repository navigation
Burn down coverage-based CRAP findings and make the touched-function check blocking #3414
Description
Purpose
#3408 made CRAP come from measured test coverage. The first whole-repo report on main (Coverage job on 5f84627d8, pnpm check:coverage-crap --all) lists 59 functions at or above CRAP 30, 49 of them at 0% coverage. This umbrella burns that list down, then makes the check blocking for the functions a PR touches.
CRAP = CC² × (1 − coverage)³ + CC. A function at CC ≤ 4 can never reach 30, and full coverage reduces the score to CC. So a finding is fixed by testing its uncovered branches through the owning module's real entry point, or by splitting it when CC itself is ≥ 30 (docs/agents/testing.md: no test-only exports or test-only DI).
pnpm test:coverage # writes coverage/coverage-istanbul.json
pnpm check:coverage-crap --all # every function >= 30
pnpm check:coverage-crap --base origin/main # only functions the branch touchesA child is done when its functions are absent from --all on its PR head, and CI's Report coverage-based CRAP step lists no touched function.
Children
Each child owns disjoint files and ships one PR (Closes #<child>).
- CRAP: test or exempt out-of-process code (companion worker, PNG worker, browser audio probe) #3415: out-of-process code (companion worker, PNG worker, browser-evaluated audio probe) — test(client): cover the out-of-process CRAP functions through their public seams #3429
- CRAP: Apple perf capture and screen-recording runner transport #3416: Apple perf capture and runner transport (root host) — test(platform-runtime): cover Apple perf capture and runner transport branches #3432
- CRAP: platform-apple core (launch diagnostics, CoreDevice, install artifact) #3417:
platform-applecore (launch diagnostics, CoreDevice, install artifact) — test(platform-apple): cover core launch diagnostics, CoreDevice normalization, runner-file copy, and IPA hint resolution #3434 - CRAP: platform-apple macOS host provider and xctestrun products #3418:
platform-applemacOS host provider and xctestrun products — test(platform-apple): cover macOS host app discovery and xctestrun product collectors #3435 - CRAP: Android, HarmonyOS, Linux and provisioning diagnostics #3419: Android, HarmonyOS, Linux, provisioning — test(android,harmonyos,linux,provision-kit): cover boot-failure and toolchain probe branches #3433
- CRAP: CLI auth, connection, proxy and replay-test formatting #3420: CLI commands (auth, connection, proxy, replay-test format) — test(cli): cover auth, connection status, proxy startup, and replay shard formatting #3437
- CRAP: remote artifact transfer and Metro process stop #3421: remote transfer and Metro — test(remote): cover remote artifact transfer and Metro process stop CRAP findings #3436
- CRAP: command input, interaction and system output branches #3422: commands (cli-grammar, interaction, system) — test(commands): cover gesture, settle-baseline, appstate, alert-wait, and JSON-object branches #3438
- CRAP: shared packages (capture-kit diffing and overlay, maestro, selectors, limrun) #3423: shared packages (capture-kit, maestro, selectors, limrun) — test(capture-kit,maestro,selectors,provider-limrun): cover shared-package CRAP functions through public entries #3440
- CRAP: daemon handlers and server (needs splits) #3424: daemon (splits; coordinate with the daemon extraction) — G1 tests test(daemon): cover lock-target matrix, auth-hook rejections, archive root inference, and longpress duration #3447, G2 session-state stack refactor(daemon): extract boot handling from session-state dispatcher #3455→refactor(daemon): extract shutdown handling from session-state dispatcher #3456→refactor(daemon): extract appstate Apple-session and device-runtime responses #3457→refactor(daemon): extract appstate target admission into its own module #3458, G3 http-server refactor(daemon): split the /rpc request-end handler into its four questions #3452
- CRAP: find why 6 files are unscored (vitest#11541 negative counts) #3425: investigation of the 6 unscored files — not vitest#11541; fixed by dependency patches in fix(coverage): keep merged v8 coverage scoreable (wrapper length + async branch counts) #3448
- CRAP: newly scored platform-apple simulator boot retry and macOS helper file listing #3451: newly scored files after fix(coverage): keep merged v8 coverage scoreable (wrapper length + async branch counts) #3448 (simulator boot retry, macOS helper listing) — test(apple): cover simulator boot retry and the macOS helper source walk #3459 (stacked on fix(coverage): keep merged v8 coverage scoreable (wrapper length + async branch counts) #3448)
- CRAP follow-ups: test-quality fixes from child PR reviews #3461: test-quality follow-ups from child PR reviews — test(client,perf): make companion tunnel and perf-capture assertions discriminating #3463, test(android,linux,apple): flake, dead-assertion, and fixture fixes from CRAP reviews #3462
- CRAP: make the touched-function check blocking #3426: make the touched-function check blocking — feat(coverage): decide the touched-function CRAP verdict #3460, ci(coverage): fail a PR whose touched functions score CRAP 30 or more #3454 (blocking on main since 2026-10-12)
Sequencing
- Run at most two implementation workers at once. Serialize full gates (
pnpm check:affected --run,pnpm test:coverage) across the machine (AGENTS.md: concurrent suites cause contention timeouts). - Order: CRAP: test or exempt out-of-process code (companion worker, PNG worker, browser audio probe) #3415 and CRAP: find why 6 files are unscored (vitest#11541 negative counts) #3425 first; then CRAP: Apple perf capture and screen-recording runner transport #3416 and CRAP: Android, HarmonyOS, Linux and provisioning diagnostics #3419; then CRAP: platform-apple core (launch diagnostics, CoreDevice, install artifact) #3417 and CRAP: platform-apple macOS host provider and xctestrun products #3418; then CRAP: CLI auth, connection, proxy and replay-test formatting #3420 and CRAP: remote artifact transfer and Metro process stop #3421; then CRAP: command input, interaction and system output branches #3422 and CRAP: shared packages (capture-kit diffing and overlay, maestro, selectors, limrun) #3423. CRAP: daemon handlers and server (needs splits) #3424 waits for coordination with the daemon extraction.
- CRAP: find why 6 files are unscored (vitest#11541 negative counts) #3425 must land before CRAP: make the touched-function check blocking #3426, because files that become scorable can add new findings.
- Open feat(macos): claim one app per native macOS app session #3323 touches
platform-apple/src/os/macos/host-provider.ts(CRAP: platform-apple macOS host provider and xctestrun products #3418) andcore/app-launch.ts/os/macos/helper.ts(CRAP: find why 6 files are unscored (vitest#11541 negative counts) #3425). Rebase onto it, or coordinate, before editing those files.
Rules for every child
- Test through public interfaces. No production exports for tests and no test-only DI (
docs/agents/testing.md). Test helpers go in*.fixtures.ts. - Stay within the owned files. A new fixture or module is named after its owning module, so children don't collide in shared packages.
- Keep each PR under the 1,000-line gross budget (
docs/agents/pull-requests.md). Runpnpm check:affected --runon the pushed head. - Don't bulk-regenerate fallow baselines. A split that moves a function can owe a path-keyed health-baseline move.
Activity
test(platform-apple): cover core launch diagnostics, CoreDevice norma…
thymikee commentedon Oct 11, 2026
Plan for G, H and I (2026-10-11)
A–F2 are done. Their PRs are merged, or approved and waiting on merge (#3436, #3440). The remaining work, as decided with Codex:
@vitest/coverage-v8so the wrapper offset no longer depends on merge order, andast-v8-to-istanbulso async implicit-else counts come out right.src/daemon→packages/daemonmove.session-state.ts. The dispatcher, the boot and shutdown handlers, and the app-state selection, response and query paths each get their own function.http-server.tsrequest-end handler into envelope parsing, authorized request preparation, and invocation/response. One owner keeps request lifetime, cancellation and cleanup.mainstays report-only.Order: H2 + G1, then G2 + G3, then I. At most two workers at a time.
refactor(coverage): drop the test-only fallow seam and isolate the su…
test(coverage): pin what a deletion-only edit is charged (#3492)
test(coverage): fix what the deletion pins claimed
test(coverage): fix what the deletion pins claimed (#3501)