Repository navigation
feat(coverage): decide the touched-function CRAP verdict - #3460
Conversation
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
e89dc85 to
e45cb65
Compare
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
e45cb65 to
8203d7f
Compare
|
The code in 8203d7f looks right to me and I found no defect that should stop the merge, but one piece of evidence is still missing: the PR-side CRAP step stays continue-on-error until #3454, so the 14 green checks never reach the blocking exit. I have not run the tests, tsc or fallow, so the 40 passing tests and the clean lint are not confirmed by me. I also have not checked that fallow's Could the four problem kinds ( Not blocking, and you can take or leave these: run.ts decides "enumeration missing" and then passes an empty Set, and model.ts re-derives it from The open inline thread on the per-path comparison and the three below are fixed at this head, so you can resolve them: zero files turning into null, exemption parse failures and empty enumeration returning no unscoped entries. The new file listed as unscoped thread is benign in CI, where coverage runs on the same checkout with |
8203d7f to
6b4fd81
Compare
6b4fd81 to
46845a9
Compare
|
Fixed at The blocking exit is proven in #3454, as you allowed. 19 cases drive Your three unknowns, measured against this checkout's real coverage run and the captured fallow 3.32 report:
One relativizer: The stamp is the better design and I did not attempt it here: it makes the whole stale class unreachable and catches what my four detectors only approximate (new files, sub-threshold estimates). It needs |
`check:coverage-crap --base <ref>` scores the functions this change touched against the Istanbul map `pnpm test:coverage` already writes, and says when the report cannot answer that question at all rather than reporting no findings. This commit is the model and the run: the verdict, its reasons, and the renderer. CI keeps reporting only until the layer above flips it. The model owns every reason a run is untrustworthy, including a missing lcov enumeration, so a caller cannot decide that fact by passing an empty set. One relativizer turns a coverage map key, an lcov path, and a diff path into the same key; three that disagreed meant a map from another checkout matched nothing.
46845a9 to
03a37c7
Compare
|
The PR is ready at 03a37c7. The two issues from the earlier review are fixed: the per-path comparison now holds at model.ts:299, and an empty lcov listing becomes null in run.ts:96-99 and reaches enumeration_missing at model.ts:287. All 22 checks pass. I found no conflicts. Nothing blocks merge. Not blocking, and you can take or leave these: (1) scripts/coverage-crap/run.ts:149-151 is a leftover comment that repeats the one after it and still describes the old per-file rule, so delete it; (2) the empty-lcov-to-null rule now lives in readEnumeratedPaths and nothing at this head tests it, so make sure #3454 lands that case or add one run() case here; (3) the header in scripts/lib/repo-path.ts calls it "the one rule", but scripts/depgraph/affected-run.ts:113 and scripts/mutation/modules.ts:147 still relativize on their own, so narrow it to coverage reports and diffs. The CRAP step stays continue-on-error until #3454, so a green Coverage job does not exercise the blocking exit. #3454 should land its run() proof of the blocking exit, both enumeration_missing variants, and --diff-file reaching fallow before it removes continue-on-error. I did not run tests, tsc or fallow here. I also did not reproduce your measurements of repo-relative finding.path and untested files appearing in both lcov and the map. On the other review threads, the cubic threads on the unrecorded set difference (#3460 (comment)), zero files becoming null (#3460 (comment)), exemption parse failures (#3460 (comment)) and null enumeratedPaths giving unscoped [] (#3460 (comment)) are fixed at this head, so you can resolve them. The thread on a new file listed as unscoped (#3460 (comment)) is benign: it only happens with a stale local coverage/ directory, and CI runs coverage on the same checkout with src/** included, so you can resolve it too. |
Summary
Gives
check:coverage-crap --base <ref>an exit code that means something. It is report-only today: it prints the functions a diff touches and exits 0 whatever it finds.It now returns 1 when a touched function scores CRAP ≥ 30 — including one that already scored that high — and when the reports cannot be trusted: no coverage map, a malformed map, a map missing a file the same run's
coverage/lcov.infoenumerated, a touched file the sanitizer dropped or the run never recorded, and a touched function the map predates. Each names the files and the command that clears it.--allstays the advisorymainbacklog.Completeness is per path, not a count: two coverage runs mixed into one directory give equal counts over different files. Attribution reuses the rename-aware diff, so a pure move owes nothing.
Part of #3426. Stack: this PR → #3454, which flips CI to blocking. Review follow-ups: the model owns
enumeration_missing, so no caller decides it by passing a set; and one relativizer covers map keys, lcov paths and diff paths — three that disagreed meant a foreign map matched nothing.Validation
03a37c7b8, onmainafter refactor(daemon): split the /rpc request-end handler into its four questions #3452 and the G2 stack merged: 40 tests;check:affected --base origin/main --run,check:fallow --base,tsc --strictgreen.