Repository navigation
0.3.11: a coverage problem says so at every door - #74
Merged
Merged
Conversation
- A `coverage_map` shard that exists and cannot be parsed is exit 2 at every
command and fails the plugin session. It was a warning, and the gate then
exited 1 for an I/O failure. A missing shard behaves as before.
- A map prefix loses only a leading `./`. `.lstrip("./")` turned `.tools/a`
into `tools/a`, which matched nothing.
- A TypeScript report that matches none of the scanned files says so on
stderr and in every stdout format, with its own counts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A malformed
coverage_mapshard is exit 2, a dot-prefixed map key matches, and a TypeScript report that matches nothing says so. This is PR 2 of 0.3.11.The findings
These were reproduced on the installed
0.3.10. A shard is one coverage file in a[tool.riskratchet.coverage_map]table.[],checkand the pytest plugin score that package at 0% and exit 1 with regressions.check --coverageon the same bytes exits 2, anddoctorsays FAIL.".tools/a" = ...scores every function under.tools/aat 0% line coverage.The fix
coverage.load_coverage_mapraisesValueErrorfor a shard that exists and can't be parsed._build_report_or_exitand the plugin's_report_or_failalready turn that into a setup error. A missing shard still goes throughon_errorand theallow_missing_coveragerule._normalize_prefixremoves only a leading./..lstrip("./")strips characters, so.tools/abecametools/a.RiskReportgainsts_coverage_checked_filesandts_coverage_unmatched_files. They aren't serialized.coverage_note()joins the Python note andTypeScript coverage matched 0 of N scanned files, so every renderer and the stderr warning print it. The two counts stay separate, so one backend matching everything doesn't hide the other matching nothing.Behavior change
A gate that passes today with a corrupt shard starts failing with exit 2. That needs
missing_coverage = "optimistic"or"skip"; under the default policy the gate already exits 1.allow_missing_coveragedoesn't cover it, because the shard is there. The release CHANGELOG states this under Changed.The following don't change: scores for a project whose shards parse and whose prefixes have no leading dot, the gate verdict in those projects,
SCORING_MODEL_VERSION, and all nine JSON schemas.Tests
The suite has 1413 passed and 2 skipped, with 93.46% coverage. 13 test cases fail against the pre-fix
src/: 5 commands for the malformed shard, the plugin, the loader, the.tools/aprefix, and 5 TypeScript note tests in the newtests/test_typescript_coverage_overlap.py. Three tests pinned the old warning (test_load_coverage_map_skips_unreadable_shard,test_load_coverage_map_without_callback_skips_silently, andtest_scan_with_malformed_coverage_map_shard_continues), and this PR rewrites them.Baseline bump rationale
regenerate-baseline.ymlregenerated the baseline in CI (run38063619367, commitf9bf5df). It goes from 576 to 577 entries, and thescoringblock doesn't change. 15 of the 576 existing entries change score. The largest rise is +3.75, underfail_regression_above = 5.models.py::RiskReport._coverage_notesat 2.0.RiskReport.coverage_note+3.75 andRiskReport.coverage_warning+2.5, which now handle two notes;_normalize_prefix+3.5, which gains a loop and a.case;analyze_typescript+1.34, which counts measurable files; andcoverage_overlap_note+1.0, which gains thelabelargument._load_shard-0.25.load_coverage_map,_coverage_shard_warn, and_ensure_coverage_map_existsat +1.0 each, where this PR edits a docstring or shifts the span, and 6 entries intypescript_engine.pyandcli.pybetween -2.0 and +1.0.🤖 Generated with Claude Code