Skip to content

Commit 18b3fa7

Browse files
thymikeeclaude
andcommitted
chore(gates): run CRAP only on measured coverage
check:fallow's CRAP was estimated from imports and disagreed with measured coverage on most findings, so the base config turns it off (health.maxCrap 0) and fallow-crap.json re-enables it, CRAP only, for check:coverage-crap. The health baseline drops its crap_* counts, which can no longer match. The Coverage job runs the report on PRs (touched functions) and on main (--all), and the report's model tests run beside the changed-line coverage model. Both report steps add !cancelled() so a failed changed-line gate does not skip them, and the threshold lives only in run.ts (--max-crap). Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent d66c7dd commit 18b3fa7

6 files changed

Lines changed: 41 additions & 360 deletions

File tree

‎.fallowrc.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,9 @@
627627
"deadCodeBaseline": "fallow-baselines/dead-code.json",
628628
"healthBaseline": "fallow-baselines/health.json"
629629
},
630+
// CRAP needs measured coverage: estimated from imports it disagrees with measured scores on most
631+
// findings. fallow-crap.json re-enables it for the CI Coverage job, which supplies the coverage map.
632+
"health": { "maxCrap": 0 },
630633
"includeEntryExports": true,
631634
"ignoreExportsUsedInFile": {
632635
"type": true,

‎.github/workflows/ci.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ jobs:
298298
uses: ./.github/actions/run-gate
299299
with: { gate: coverage-model }
300300

301+
- name: Test coverage-based CRAP report
302+
uses: ./.github/actions/run-gate
303+
with: { gate: coverage-crap-model }
304+
301305
- name: Run coverage
302306
id: run-coverage
303307
env:
@@ -331,6 +335,26 @@ jobs:
331335
--base
332336
${{ github.event.pull_request.base.sha }}
333337
338+
# Report-only: scores the functions this PR touches with the coverage map the coverage step
339+
# wrote (fallow-crap.json), as a job summary and warning annotations. It fails only when it
340+
# cannot produce a report. `!cancelled()` keeps it running after a failed changed-line gate.
341+
- name: Report coverage-based CRAP
342+
if: ${{ !cancelled() && steps.run-coverage.outcome == 'success' && github.event_name == 'pull_request' }}
343+
uses: ./.github/actions/run-gate
344+
with:
345+
gate: coverage-crap
346+
args: |
347+
--base
348+
${{ github.event.pull_request.base.sha }}
349+
350+
# On main, the same report covers every function: the backlog of untested complex code.
351+
- name: Report coverage-based CRAP for the whole repository
352+
if: ${{ !cancelled() && steps.run-coverage.outcome == 'success' && github.event_name == 'push' }}
353+
uses: ./.github/actions/run-gate
354+
with:
355+
gate: coverage-crap
356+
args: --all
357+
334358
integration:
335359
name: Integration Tests
336360
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)