test(coverage): pin what a deletion-only edit is charged

Merged
TH
6d ago
+65-9

Summary

Answers the deletion-attribution question by measuring it: nothing to fix. Part of #3414.

Reproduced against real fallow with --diff-file before touching code — an edit that only deletes lines inside a surviving function scoring 42 exits 0. Not because readTouchedFiles ignores deletions: fallow's diff index holds added lines only, and it warns on a deletion-only diff ("parsed 0 added lines"). No line exists for a function span to intersect, so nothing reaches this CLI to attribute.

Charging deletions would mean loosening fallow's scoping, and I verified its filter is per function span, not per file: file-level attribution would block every ≥ 30 function in any file a PR touches one line of — a wider gate than #3454 shipped. So this pins the boundary instead: deletion inside the function, lines added elsewhere in the same file, deleting the function outright. Each proves with --all that the debt really is in the map. The first and third pass because removing code retires debt — as the whole-file and pure-rename exemptions already assume. The residual, a deletion leaving an untested complex function standing, goes uncharged in PR mode.

Validation

  • SHA 462826f94 on origin/main: 61 tests pass; check:affected --base origin/main --run green under the gate lock; format, lint, tsc --strict clean. Tests only, +74 lines.
  • Written from three probes: run()'s verdict, raw fallow health with and without --diff-file, and a span test separating per-function from per-file filtering. If fallow ever indexes deleted lines, case 1 fails.