Repository navigation
refactor(coverage): give the changed-lines diff one owner and pass it on stdin - #3561
Conversation
parseUnifiedDiff, ChangedFileDiff, and normalizePath now live in scripts/lib beside readChangedLinesDiff, the diff they parse, instead of inside the changed-line gate's model where the CRAP gate had to import across families. Both gates import from scripts/lib. Hand the diff to fallow health on stdin (--diff-stdin) instead of writing and reading coverage/fallow-crap.diff, so no artifact of an earlier run can supply a scope.
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
Size Report
Startup median (7 runs, lower is better):
|
|
This PR is ready at 3b208bf. CI is green, with 26 checks and none failing. The coverage-changed and coverage-crap gates and their moved tests run in the Coverage CI job, and the package.json change adds those tests to the |
Summary
parseUnifiedDiff,ChangedFileDiff, andnormalizePathmove fromscripts/coverage-changed/model.tstoscripts/lib(repo-git.tsbesidereadChangedLinesDiff, the diff they parse;repo-path.tsfor the path rule), with their tests moving alongside (scripts/lib/repo-git.test.ts,repo-path.test.ts, run by thecoverage-modelgate). The two changed-line gates stay separate — onlycoverage-changedhas a waiver label — but neither owns the diff format anymore.check:coverage-crapnow pipes the diff tofallow health --diff-stdin(fallow 3.32; documented as equivalent to--diff-file -) instead of writingcoverage/fallow-crap.diff. No artifact of an earlier run can supply a scope, andrun.test.tsseeds a stale artifact at that path with a debt-charging scope and proves the run ignores it and leaves it untouched.11 files, +174/−158. No behavior change; scope is exactly the two audit items.
Validation
Head
3b208bfb0.pnpm check:affected --runpassed on the head under the gate lock. Before/after proof for the stdin swap on a real git repo + real fallow 3.32 (fixture shaped likerun.test.ts, edited debt function): reports and exit codes byte-identical (diffclean, both exit 1 with the CRAP 56.0 finding); after the change the run writes onlyfallow-crap-coverage.jsonundercoverage/. Moved parser/tests are byte-identical (git diff -M90%+ byte-compare); both test suites (23 + 59) green at their new paths.format,lint,typecheck,check:gate-manifestgreen. CI owns the instrumented Coverage and CRAP verdicts on the PR head.