Repository navigation
fix(report): retain Baseline coverage for regrouped clones - #773
Merged
Merged
Conversation
Record hashed clone line occurrences so deleting a copy cannot expose surviving duplicates to the Budget. Count each uncovered line once, and reject Baseline edits that grant new coverage. Closes #765
Convert unchanged group IDs to line coverage. Verify the upgrade against the base commit before accepting it in state check.
5 tasks done
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.
Summary
Duplication Baselines cover hashed clone line occurrences, so a surviving duplicate keeps its coverage when overlapping Clone groups combine.
A normal
codeint baseline updaterecords occurrence anchors for existing Clone group IDs at the same Metric version.codeint state checkverifies the upgrade against the base commit and rejects added coverage.Closes #765
Tier
Tier 3 from
cargo xtask risk-tier --base origin/main.The check detects the assertion changed to expect the new measurement cache version.
Task
codeint state checkand reject widened coverage.Fail-first test
baseline::duplication_baseline_covers_surviving_overlapping_clone_spansran before the fix and failed on main atbf7df913.codeint: the production duplication ratio 0.7018 is over its Budget 0baseline::duplication_baseline_update_upgrades_legacy_groups_without_adding_finding_idsran before the upgrade implementation and failed withplain Baseline update must add clone line anchors.Checks
cargo test --locked -p codeint --test integration baseline::cargo test --locked -p codeint-config --lib state_check::d71f39529cabb9eebd60f04f74a4c04b48f4e5e1codeint checkandcodeint diff origin/main)a6096a65. Two subsequent base merges needed no conflict resolution.Safety proof
It then adds an occurrence under an unchanged ID and verifies that state check rejects it.
Adding a new copy also fails its zero Budget and reports only its uncovered line share.
Runtime evidence
PASS at
d71f39529cabb9eebd60f04f74a4c04b48f4e5e1.The integration tests run the real CLI in temporary Git repositories with the three-file reproduction and a zero Duplication Budget.
The Baseline passes before the edit, then clone lines fall from 56 to 40 and the check and diff both pass.
The legacy upgrade test reads the written Baseline, confirms unchanged Finding IDs and Metric version, and exercises the state gate against a committed legacy file.
Temporary Git repositories are removed by the test harness.
Reproduce with
cargo test --locked -p codeint --test integration baseline::duplication_baseline.Gaps