feat(ci): report CRAP from measured test coverage (report-only)

Merged
TH
2mo ago
+585-373

Summary

CRAP now comes from measured test coverage instead of an estimate from which tests import what. Report-only for now: the first runs produce the list to fix.

  • check:fallow stops scoring CRAP (health.maxCrap: 0). The estimate disagreed with measured coverage on most findings.
  • The Vitest coverage run also writes coverage/coverage-istanbul.json. That name is not coverage-final.json, so local fallow runs never pick it up by accident.
  • pnpm check:coverage-crap drops file records with impossible hit counts and runs fallow 3.32 with fallow-crap.json, which enables only the CRAP rule. Vitest's v8 provider produces negative counts for modules loaded twice (vitest#11541), and fallow rejects the whole map on one; today 7 files are dropped, and the report names them. Findings outside the map (tests, scripts) are excluded rather than estimated.
  • CI's Coverage job reports touched functions on PRs (job summary plus warning annotations) and every function on main (--all). It never fails on a score.
  • The health baseline drops its 84 crap_* counts, which can no longer match.

Today on main: 58 functions at or above 30. Code that runs only out of process (workers, browser-evaluated scripts) measures 0%, so expect a few false positives to exempt before gating.

17 files, +585/โˆ’373, mostly baseline cleanup.

Validation

Tested 96b117457 on main 8a2580d10: pnpm check:affected --run passed (all runnable checks). A full local coverage run (1,692 files) fed check:coverage-crap --all (58 findings) and --base origin/main (none touched). CRAP tests 12/12; coverage-changed 23/23.

๐Ÿค– Generated with Claude Code