Repository navigation
feat(ci): report CRAP from measured test coverage (report-only) - #3408
Conversation
|
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 13 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
b87b400 to
18b3fa7
Compare
|
The code looks fine at 18b3fa7, but I can't call it ready yet because the CI proof is still pending. All 10 checks are queued or running, with no failures so far. The Coverage job runs the new reporter, the coverage-crap-model and coverage-crap steps, and the Not blocking, and you can take or leave these: the comment at Simplicity question: fallow already has Review threads from cubic-dev-ai: none of the five apply at this head, so please resolve all of them. Command escaping and its test (#3408 (comment)) is fixed. |
18b3fa7 to
27dbf79
Compare
|
Thanks. The CI proof is in, and every non-blocking item is taken, at CI at 18b3fa7. All 22 checks are green, including Coverage and Repo Guards. The Coverage job ran both new steps: The two fallow behaviors (3.32.0, measured locally):
Taken:
Simplicity question. I kept the custom rendering. All five cubic threads were already resolved. |
There was a problem hiding this comment.
All reported issues were addressed across 7 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
27dbf79 to
d867005
Compare
|
Repo Guards fails at Check import-direction DAG because |
|
The code in d867005 looks good, and both earlier fixes are in. The cafe.ts regression test now runs through run(), and the report steps in ci.yml use !cancelled() && steps.run-coverage.outcome == 'success'. Coverage, the job that runs this change, is green at this head. Repo Guards fails at the import-direction step on src/daemon/platform-services.ts and src/daemon/device/claim-recovery-gateway.ts, which this PR does not touch, and you report that main fails the same way. Smoke is still running and does not reach any changed path. I did not run the coverage-changed or coverage-crap tests locally, and I did not re-measure fallow's --max-crap behavior. I relied on your numbers and on Coverage being green. The PR has no conflicts. Repo Guards stays red until #3412 lands on main, so please re-run it here after that. On the other threads: the cubic-dev-ai threads #3408 (comment) (quotePath), #3408 (comment) (annotation escaping) and #3408 (comment) (report step conditions) are fixed at this head, so you can resolve them. The thread #3408 (comment) on the duplicated 30 threshold is benign and can be resolved. I did not re-check #3408 (comment) (run.ts exit handling) or #3408 (comment) (CONTRIBUTING wording), since both are outside this change. |
check:coverage-crap reads the Istanbul map the coverage run now also writes (coverage/coverage-istanbul.json, a name fallow does not pick up on its own), drops file records with impossible hit counts (vitest#11541 merges a module loaded both through the runner and natively into negative counts, and fallow refuses the whole map on one), and asks fallow 3.32 to score CRAP only from measured coverage. It scores the functions the diff against --base touches, or every function with --all, and is report-only: a job-summary table plus warning annotations for touched functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up. Annotation properties and messages are escaped as workflow-command data, so a path or function name with a newline, `:`, `,` or `%` cannot end the command early. The entry point sets process.exitCode instead of calling process.exit(), so a large --all report written to a pipe is not truncated. The threshold is passed to fallow as --max-crap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…scores at or above 30 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n a real fallow report Review follow-up. readChangedLinesDiff in scripts/lib/repo-git.ts is the one zero-context base...HEAD diff both changed-line gates score, so the CRAP report now pairs renames at 90% like the changed-line coverage gate. The report parser moves into the model and is tested on a captured fallow 3.32 health report, including an estimated finding it must drop. The sanitizer comment says which counts it can detect: negative ones, not zeroed ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Git quotes non-ASCII paths in diff headers by default, so a change to a file such as src/café.ts never matched its coverage record and the changed-line gate skipped its lines. readChangedLinesDiff runs with core.quotePath=false, which also covers the CRAP report's diff scope; a coverage-changed run test pins the case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 continue-on-error so a tooling error never fails the job, and the threshold lives only in run.ts (--max-crap). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d867005 to
96b1174
Compare
Summary
CRAP now comes from measured test coverage instead of an estimate from which tests import what. Report-only for now: the first runs produce the list to fix.
check:fallowstops scoring CRAP (health.maxCrap: 0). The estimate disagreed with measured coverage on most findings.coverage/coverage-istanbul.json. That name is notcoverage-final.json, so local fallow runs never pick it up by accident.pnpm check:coverage-crapdrops file records with impossible hit counts and runs fallow 3.32 withfallow-crap.json, which enables only the CRAP rule. Vitest's v8 provider produces negative counts for modules loaded twice (vitest#11541), and fallow rejects the whole map on one; today 7 files are dropped, and the report names them. Findings outside the map (tests, scripts) are excluded rather than estimated.main(--all). It never fails on a score.crap_*counts, which can no longer match.Today on main: 58 functions at or above 30. Code that runs only out of process (workers, browser-evaluated scripts) measures 0%, so expect a few false positives to exempt before gating.
17 files, +585/−373, mostly baseline cleanup.
Validation
Tested
96b117457on main8a2580d10:pnpm check:affected --runpassed (all runnable checks). A full local coverage run (1,692 files) fedcheck:coverage-crap --all(58 findings) and--base origin/main(none touched). CRAP tests 12/12; coverage-changed 23/23.🤖 Generated with Claude Code