Skip to content

fix(probes): report a replaced line once, not again as a base-side twin (#7807) - #15218

Merged
EffortlessSteven merged 3 commits into
mainfrom
claude/diff-7807-static-unknown-twin
Nov 19, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
claude/diff-7807-static-unknown-twin

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven Zimmerman · project thread

Governing issue or accepted claim: #7807
Acceptance delta (one sentence): Some replaced lines read static_unknown only because the old text is classified without context, as when a tail x * 5 becomes x * 10. When the replacement's probe models the value at that position (return_value or error_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 * 5 to x * 10, or input to input.rotate_left(3), gave a return_value finding for the new line and a second static_unknown finding 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 reads return_value. has_matching_added_line requires the same family, so the pair was refused.

Production delta

analysis/probes/diff.rs, new replaced_value_is_paired, next to the #14325 bare-literal rule. A removed static_unknown line is dropped only when both of these hold:

  • An added line is its replacement under the block pairing (replaced_line_counterpart: same block, equal runs, by position). Line identity decides this, not text, so the same text deleted elsewhere keeps its probe.
  • That added line carries a return_value or error_path probe whose before is 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

  • Unit test a_replaced_tail_expression_adds_no_base_side_static_unknown_twin. x * 5 → x * 10 adds no removed-side probe, and the added probe carries before == "x * 5". Control: the same text deleted outright in a later hunk keeps its own probe.
  • Existing control reordered_replacement_does_not_repeat_the_removed_static_unknown: a changed operator read as call_deletion keeps the removed static_unknown probe.
  • 38 fixtures were re-blessed, with a reason that cites RIPR-SPEC-0001. Comparing each expected/check.json with the new output by finding id:
    • 40 findings are removed, and every one is static_unknown with the base_deleted note;
    • no finding is added;
    • every remaining finding is byte-identical.
  • Each removed twin's replacement is return_value or error_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.
  • Two SPEC.md expected-classes blocks drop the removed id: rust_const_expectation_literal_control and rust_helper_expectation_literal_control.
  • Changelog fragment.

Proof

# first commit 794dbf56:
cargo test -j1 -p ripr --lib     # 20342 passed, 1 failed: the #6675 control above, now fixed by 99bf6532
cargo test -j1 -p ripr --test cli_smoke   # 808 passed
# head 99bf6532:
cargo xtask goldens check        # pass (all 38 re-blessed goldens still match)
cargo clippy -j1 -p ripr --lib --tests   # clean
cargo fmt --check
xtask check-fixture-contracts | check-changelog-fragments | check-static-language | check-spec-format | check-traceability   # pass

Local evidence gaps:

  • On head 99bf653 the lib-test build was OOM-killed twice in the session container, so the focused tests of the narrowed rule have not run locally.
  • check-file-policy timed 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

…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
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 148 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 676a2a21-b607-4a69-bd8d-d00bb9e1e412
Commits

Reviewing files that changed from the base of the PR and between c40fefc and f10c289.

Files selected for processing: 147

  • .ripr/traceability.d/7807-replaced-tail-twin.toml
  • changelog.d/7807-replaced-tail-no-base-twin.md
  • crates/ripr/src/analysis/probes/diff.rs
  • fixtures/declared_target_glob_public_call/expected/CHANGELOG.md
  • fixtures/declared_target_glob_public_call/expected/check.json
  • fixtures/declared_target_glob_public_call/expected/human.txt
  • fixtures/error_path_diagnostic_absent/expected/CHANGELOG.md
  • fixtures/error_path_diagnostic_absent/expected/check.json
  • fixtures/error_path_diagnostic_absent/expected/human-full.txt
  • fixtures/error_path_diagnostic_absent/expected/human.txt
  • fixtures/error_path_diagnostic_error/expected/CHANGELOG.md
  • fixtures/error_path_diagnostic_error/expected/check.json
  • fixtures/error_path_diagnostic_error/expected/human-full.txt
  • fixtures/error_path_diagnostic_error/expected/human.txt
  • fixtures/error_path_diagnostic_escaped/expected/CHANGELOG.md
  • fixtures/error_path_diagnostic_escaped/expected/check.json
  • fixtures/error_path_diagnostic_escaped/expected/human-full.txt
  • fixtures/error_path_diagnostic_escaped/expected/human.txt
  • fixtures/error_path_diagnostic_format/expected/CHANGELOG.md
  • fixtures/error_path_diagnostic_format/expected/check.json
  • fixtures/error_path_diagnostic_format/expected/human-full.txt
  • fixtures/error_path_diagnostic_format/expected/human.txt
  • fixtures/error_path_diagnostic_neutral/expected/CHANGELOG.md
  • fixtures/error_path_diagnostic_neutral/expected/check.json
  • fixtures/error_path_diagnostic_neutral/expected/human-full.txt
  • fixtures/error_path_diagnostic_neutral/expected/human.txt
  • fixtures/error_path_diagnostic_raw/expected/CHANGELOG.md
  • fixtures/error_path_diagnostic_raw/expected/check.json
  • fixtures/error_path_diagnostic_raw/expected/human-full.txt
  • fixtures/error_path_diagnostic_raw/expected/human.txt
  • fixtures/error_path_diagnostic_typed_argument/expected/CHANGELOG.md
  • fixtures/error_path_diagnostic_typed_argument/expected/check.json
  • fixtures/error_path_diagnostic_typed_argument/expected/human-full.txt
  • fixtures/error_path_diagnostic_typed_argument/expected/human.txt
  • fixtures/error_path_diagnostic_typed_message/expected/CHANGELOG.md
  • fixtures/error_path_diagnostic_typed_message/expected/check.json
  • fixtures/error_path_diagnostic_typed_message/expected/human-full.txt
  • fixtures/error_path_diagnostic_typed_message/expected/human.txt
  • fixtures/error_path_operand_error_lexeme/expected/CHANGELOG.md
  • fixtures/error_path_operand_error_lexeme/expected/check.json
  • fixtures/error_path_operand_error_lexeme/expected/human-full.txt
  • fixtures/error_path_operand_error_lexeme/expected/human.txt
  • fixtures/error_path_oracle_execution_called/expected/CHANGELOG.md
  • fixtures/error_path_oracle_execution_called/expected/check.json
  • fixtures/error_path_oracle_execution_called/expected/human-full.txt
  • fixtures/error_path_oracle_execution_called/expected/human.txt
  • fixtures/error_path_oracle_execution_direct/expected/CHANGELOG.md
  • fixtures/error_path_oracle_execution_direct/expected/check.json
  • fixtures/error_path_oracle_execution_direct/expected/human-full.txt
  • fixtures/error_path_oracle_execution_direct/expected/human.txt
  • fixtures/error_path_oracle_execution_false_branch/expected/CHANGELOG.md
  • fixtures/error_path_oracle_execution_false_branch/expected/check.json
  • fixtures/error_path_oracle_execution_false_branch/expected/human-full.txt
  • fixtures/error_path_oracle_execution_false_branch/expected/human.txt
  • fixtures/error_path_oracle_execution_no_assertion/expected/CHANGELOG.md
  • fixtures/error_path_oracle_execution_no_assertion/expected/check.json
  • fixtures/error_path_oracle_execution_no_assertion/expected/human-full.txt
  • fixtures/error_path_oracle_execution_no_assertion/expected/human.txt
  • fixtures/error_path_oracle_execution_reached_uncalled/expected/CHANGELOG.md
  • fixtures/error_path_oracle_execution_reached_uncalled/expected/check.json
  • fixtures/error_path_oracle_execution_reached_uncalled/expected/human-full.txt
  • fixtures/error_path_oracle_execution_reached_uncalled/expected/human.txt
  • fixtures/error_path_oracle_execution_shadowed/expected/CHANGELOG.md
  • fixtures/error_path_oracle_execution_shadowed/expected/check.json
  • fixtures/error_path_oracle_execution_shadowed/expected/human-full.txt
  • fixtures/error_path_oracle_execution_shadowed/expected/human.txt
  • fixtures/error_path_oracle_execution_uncalled/expected/CHANGELOG.md
  • fixtures/error_path_oracle_execution_uncalled/expected/check.json
  • fixtures/error_path_oracle_execution_uncalled/expected/human-full.txt
  • fixtures/error_path_oracle_execution_uncalled/expected/human.txt
  • fixtures/manual_let_else_pairing/expected/CHANGELOG.md
  • fixtures/manual_let_else_pairing/expected/check.json
  • fixtures/manual_let_else_pairing/expected/human.txt
  • fixtures/observation_verified_return_value/expected/CHANGELOG.md
  • fixtures/observation_verified_return_value/expected/check.json
  • fixtures/observation_verified_return_value/expected/human.txt
  • fixtures/owner_pin_written_alias_not_a_pin/expected/CHANGELOG.md
  • fixtures/owner_pin_written_alias_not_a_pin/expected/check.json
  • fixtures/owner_pin_written_alias_not_a_pin/expected/human.txt
  • fixtures/owner_pin_written_expected_not_a_pin/expected/CHANGELOG.md
  • fixtures/owner_pin_written_expected_not_a_pin/expected/check.json
  • fixtures/owner_pin_written_expected_not_a_pin/expected/human.txt
  • fixtures/owner_return_pin_identity_traps/expected/CHANGELOG.md
  • fixtures/owner_return_pin_identity_traps/expected/check.json
  • fixtures/owner_return_pin_identity_traps/expected/human.txt
  • fixtures/owner_return_pin_pointer_mask_rebound/expected/CHANGELOG.md
  • fixtures/owner_return_pin_pointer_mask_rebound/expected/check.json
  • fixtures/owner_return_pin_pointer_mask_rebound/expected/human.txt
  • fixtures/owner_return_pin_pointer_mask_unexercised/expected/CHANGELOG.md
  • fixtures/owner_return_pin_pointer_mask_unexercised/expected/check.json
  • fixtures/owner_return_pin_pointer_mask_unexercised/expected/human.txt
  • fixtures/rust_committed_golden_expected_file/expected/CHANGELOG.md
  • fixtures/rust_committed_golden_expected_file/expected/check.json
  • fixtures/rust_committed_golden_expected_file/expected/human-full.txt
  • fixtures/rust_committed_golden_expected_file/expected/human.txt
  • fixtures/rust_const_expectation_literal_control/SPEC.md
  • fixtures/rust_const_expectation_literal_control/expected/CHANGELOG.md
  • fixtures/rust_const_expectation_literal_control/expected/check.json
  • fixtures/rust_const_expectation_literal_control/expected/human-full.txt
  • fixtures/rust_const_expectation_literal_control/expected/human.txt
  • fixtures/rust_const_expectation_self_computed/expected/CHANGELOG.md
  • fixtures/rust_const_expectation_self_computed/expected/check.json
  • fixtures/rust_const_expectation_self_computed/expected/human-full.txt
  • fixtures/rust_const_expectation_self_computed/expected/human.txt
  • fixtures/rust_constant_tail_change/expected/CHANGELOG.md
  • fixtures/rust_constant_tail_change/expected/check.json
  • fixtures/rust_constant_tail_change/expected/human.txt
  • fixtures/rust_helper_expectation_literal_control/SPEC.md
  • fixtures/rust_helper_expectation_literal_control/expected/CHANGELOG.md
  • fixtures/rust_helper_expectation_literal_control/expected/check.json
  • fixtures/rust_helper_expectation_literal_control/expected/human-full.txt
  • fixtures/rust_helper_expectation_literal_control/expected/human.txt
  • fixtures/rust_helper_expectation_self_computed/expected/CHANGELOG.md
  • fixtures/rust_helper_expectation_self_computed/expected/check.json
  • fixtures/rust_helper_expectation_self_computed/expected/human-full.txt
  • fixtures/rust_helper_expectation_self_computed/expected/human.txt
  • fixtures/rust_indirect_owner_item_scope/expected/CHANGELOG.md
  • fixtures/rust_indirect_owner_item_scope/expected/check.json
  • fixtures/rust_indirect_owner_item_scope/expected/human-full.txt
  • fixtures/rust_indirect_owner_item_scope/expected/human.txt
  • fixtures/rust_lossy_post_operation_pin/expected/CHANGELOG.md
  • fixtures/rust_lossy_post_operation_pin/expected/check.json
  • fixtures/rust_lossy_post_operation_pin/expected/human-full.txt
  • fixtures/rust_lossy_post_operation_pin/expected/human.txt
  • fixtures/rust_returned_type_drop_local_guard/expected/CHANGELOG.md
  • fixtures/rust_returned_type_drop_local_guard/expected/check.json
  • fixtures/rust_returned_type_drop_local_guard/expected/human-full.txt
  • fixtures/rust_returned_type_drop_local_guard/expected/human.txt
  • fixtures/rust_test_case_arrow_coincident_row/expected/CHANGELOG.md
  • fixtures/rust_test_case_arrow_coincident_row/expected/check.json
  • fixtures/rust_test_case_arrow_coincident_row/expected/human-full.txt
  • fixtures/rust_test_case_arrow_coincident_row/expected/human.txt
  • fixtures/rust_test_written_expected_file/expected/CHANGELOG.md
  • fixtures/rust_test_written_expected_file/expected/check.json
  • fixtures/rust_test_written_expected_file/expected/human-full.txt
  • fixtures/rust_test_written_expected_file/expected/human.txt
  • fixtures/rust_test_written_expected_file_bound/expected/CHANGELOG.md
  • fixtures/rust_test_written_expected_file_bound/expected/check.json
  • fixtures/rust_test_written_expected_file_bound/expected/human-full.txt
  • fixtures/rust_test_written_expected_file_bound/expected/human.txt
  • fixtures/shared_target_assertion_return/expected/CHANGELOG.md
  • fixtures/shared_target_assertion_return/expected/check.json
  • fixtures/shared_target_assertion_return/expected/human-full.txt
  • fixtures/shared_target_assertion_return/expected/human.txt
  • fixtures/undeclared_target_glob_public_call/expected/CHANGELOG.md
  • fixtures/undeclared_target_glob_public_call/expected/check.json
  • fixtures/undeclared_target_glob_public_call/expected/human.txt
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
EffortlessSteven marked this pull request as ready for review November 19, 2026 12:49

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Devin Review

Comment thread crates/ripr/src/analysis/probes/diff.rs Resolved
Comment thread crates/ripr/src/analysis/probes/diff.rs Resolved
Comment thread crates/ripr/src/analysis/probes/diff.rs Resolved
…#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 EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOURCE_REVIEW_READY for head f10c289.

Inspected: the full diff since 99bf653, which repairs the three Devin findings.

  • represented_value_replacements builds 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 --check and check-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

@EffortlessSteven
EffortlessSteven added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 353f617 Nov 19, 2026
19 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/diff-7807-static-unknown-twin branch November 19, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants