test(coverage): fix what the deletion pins claimed

Merged
TH
2mo ago
+26-18

Summary

Stacked on #3502: this branch's Coverage job can only go green once that PR retires the three dead APPROVED_OVER_CEILING rows it inherits from post-#3483 main. Retarget to main after. Part of #3414.

Two review threads survived #3486 and #3492, both merged while their checks were queued.

run.test.ts named a case for "a function whose own lines did not change" while its fixture deletes a line inside it. Renamed to what it covers: additions below the span, a removal inside. The third case pinned its fixture rather than a rule, so it now keeps score at CRAP 42 while the source loses the function — what a forgotten pnpm test:coverage leaves — and asserts --all omits it: scoring walks the source, so neither scope reports a function that is gone.

CONTRIBUTING claimed removing code retires debt, and that a deletion's raised score reaches --all rather than the PR. Neither holds as written: dropping covered lines can raise a score, and a function the PR adds lines inside is scored at that value and blocks. The paragraph now says deletions are uncharged, and makes the --all claim conditional.

Validation

  • SHA 42b240396: 59 tests pass, including the --all assertion, which fails if a deleted function ever stops taking its score with it; check:affected --base crap/3426-retire-approval-rows --run green under the gate lock.
  • The stale-map behaviour the docs rest on was probed through run() in both scopes first, not reasoned about.
  • +44 lines, tests and prose only. No change to gate behaviour.