Repository navigation
fix(probes): report a replaced line once, not again as a base-side twin (#7807) - #15218
Conversation
…in (#7807) A removed line is classified without its context, so a tail expression such as `x * 5` reads static_unknown while its replacement `x * 10` reads return_value. The family check refused the pair, and the old text was reported a second time as deleted behavior next to the replacement's own finding. Generalize the #14325 bare-literal rule: a removed static_unknown line is dropped when its block replacement (equal runs, by position) carries a modeled-family probe whose before is the whole removed text. A deletion with no replacement keeps its probe. Re-blessed 38 fixtures. Each removes only a base_deleted static_unknown twin of a replaced line (40 findings), and every other finding is byte identical. Two SPEC expected-classes blocks drop the removed id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVjG4FbMTpVcr4dSrg3
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 35 minutes. View limit details
|
There was a problem hiding this comment.
Code Review
This pull request addresses issue #7807 by ensuring that ripr check no longer reports a replaced line twice. Specifically, in crates/ripr/src/analysis/probes/diff.rs, any removed line classified as StaticUnknown is skipped if its block replacement's modeled probe already carries the entire removed text as before. A comprehensive unit test has been added to verify this behavior, and numerous golden test fixtures have been updated to reflect the removal of these duplicate findings. I have no additional feedback to provide as the implementation is clean and well-tested.
…ement (#7807) The full lib suite showed that an operator swap read as call_deletion would lose its static_unknown twin, leaving only a weaker model. The twin is now dropped only when the replacement probe is return_value or error_path, the families that model the value at the removed line's position. The #6675 control (a changed operator keeps the twin) holds, and all 38 re-blessed goldens still match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVjG4FbMTpVcr4dSrg3
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY for head 99bf653.
Inspected: the full diff, including the rule and replaced_value_is_paired in analysis/probes/diff.rs, its neighbours (has_matching_added_line, the #6675 reorder rule, the #14325 literal rule), the new unit test, both SPEC.md edits, the changelog fragment and all 38 re-blessed fixtures. Each fixture's check.json was compared with the new output by finding id: 40 base_deleted static_unknown twins are removed, nothing is added, and every other finding is byte-identical.
Semantic check: the twin is dropped only when the positional replacement probe is return_value or error_path and carries the whole removed text as before. The first head dropped twins beside any modeled family. The full lib suite caught the #6675 case, where an operator swap is read as call_deletion, and 99bf653 restores it.
Proof on 794dbf5: lib 20342 passed with 1 failure, the case above. cli_smoke 808 passed.
On 99bf653: goldens check, clippy --lib --tests and fmt pass.
Gap: the lib-test build was OOM-killed locally on this head, so the focused tests are left to hosted qualification.
Generated by Claude Code
…#7807) Review repairs: - The represented removed lines are computed once per file from one replacement_counterparts map, instead of rebuilding that map for every added line of every candidate (quadratic in replaced tails). - A removed line that holds a second statement (`*state = 1; x * 5`, a ';' before its end) is never treated as represented by the value probe, which models only the returned expression. Unit control added; without the check it fails. - Register the unit test under RIPR-SPEC-0001. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVjG4FbMTpVcr4dSrg3
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY for head f10c289.
Inspected: the full diff since 99bf653, which repairs the three Devin findings.
represented_value_replacementsbuilds one counterparts map per file and returns a set, so the cost is no longer quadratic.- A removed line with a
;before its end is never represented. This is the deleted-write case, and it has a unit control that fails without the check. - A traceability shard registers the unit test under RIPR-SPEC-0001.
The rule is otherwise unchanged: a return_value or error_path positional replacement whose before is the whole removed text.
Proof on this head:
- focused lib tests: 3 passed (new test, #14325 literal test, #6675 reorder control);
cargo xtask goldens check: passes;cargo fmt --checkandcheck-traceability: pass.
Earlier on 794dbf5: lib 20342 passed, with the #6675 failure fixed since. cli_smoke 808 passed.
Gap: the full lib suite and precommit on this head are left to hosted qualification.
Generated by Claude Code
Requested by Steven Zimmerman · project thread
Governing issue or accepted claim: #7807
Acceptance delta (one sentence): Some replaced lines read
static_unknownonly because the old text is classified without context, as when a tailx * 5becomesx * 10. When the replacement's probe models the value at that position (return_valueorerror_path), such a line is reported once, by that probe, instead of also as a deleted base-side behavior; a deletion with no replacement, or a replacement modeled by another family, keeps its finding.Refs #7807
Summary
The duplicates first cited on #7807 are already gone on main (see the reverify comment). A related shape remained. Changing
x * 5tox * 10, orinputtoinput.rotate_left(3), gave areturn_valuefinding for the new line and a secondstatic_unknownfinding for the old text, marked "Not a candidate edit target (base_deleted)".The cause is that the removed line is classified without its context, so it reads the catch-all
static_unknown, while its replacement readsreturn_value.has_matching_added_linerequires the same family, so the pair was refused.Production delta
analysis/probes/diff.rs, newreplaced_value_is_paired, next to the #14325 bare-literal rule. A removedstatic_unknownline is dropped only when both of these hold:replaced_line_counterpart: same block, equal runs, by position). Line identity decides this, not text, so the same text deleted elsewhere keeps its probe.return_valueorerror_pathprobe whosebeforeis the whole removed text.Any other replacement family keeps the twin. For example, the #6675 operator swap is read as
call_deletion, which is a weaker model. The full lib suite found that case on the first commit, and 99bf653 narrows the rule to cover it.Evidence/support delta
a_replaced_tail_expression_adds_no_base_side_static_unknown_twin.x * 5→x * 10adds no removed-side probe, and the added probe carriesbefore == "x * 5". Control: the same text deleted outright in a later hunk keeps its own probe.reordered_replacement_does_not_repeat_the_removed_static_unknown: a changed operator read ascall_deletionkeeps the removedstatic_unknownprobe.expected/check.jsonwith the new output by finding id:static_unknownwith thebase_deletednote;return_valueorerror_path:4 * x→3 * x,x * 2→x * 3,n + 1→n + 2;n as u8→(n & 0xff) as u8,flag→false,a | b→a & b;.unwrap()→?(14 error-path fixtures);let rhs = match …→let Some(rhs) = … else.SPEC.mdexpected-classesblocks drop the removed id:rust_const_expectation_literal_controlandrust_helper_expectation_literal_control.Proof
Local evidence gaps:
check-file-policytimed out at 15 minutes while building test binaries.Hosted qualification on the exact head is the proof for both.
Non-goals
This PR does not change family classification on the removed side, the pairing of lines whose families agree, or #7890's short-name path.
Claim Boundary
Probe seeding for Rust only. Static evidence; nothing here claims runtime test results.
Rollback
Revert the commits and the re-blessed goldens; no schema or config change.
🤖 Generated with Claude Code
https://claude.ai/code/session_016EQRVjG4FbMTpVcr4dSrg3