Repository navigation
fix(infection): read a multi-line predicate's whole old chain before crediting a boundary (#7945) - #14232
Conversation
…crediting a boundary (#7945) rustfmt splits a long `&&`/`||` chain across lines (`if other > 0` over `&& 100 <= points`). A predicate probe's `before` was one removed line of that block, so the #7898 connective rule saw no operand change and an input at the surviving comparison's boundary read `exposed`. When a predicate's replacement block removes two or more consecutive old lines and one of them starts or ends with `&&`/`||` outside strings and comments, the probe's `before` is the whole block joined into its one-line spelling, so the existing shape cut and `same_connectives` rule decide as they do for a one-line edit. The chain's old lines are the predicate's old side and no longer get a deleted-line probe of their own, which read one operand of the chain as a predicate and credited an input at its boundary. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVkj7iR1PQXPKDQoLDi
There was a problem hiding this comment.
Code Review
This pull request addresses issue #7945 by ensuring that a predicate whose old side was split across multiple lines (e.g., by rustfmt) is compared against its entire old &&/|| chain. This prevents incorrect boundary credit when operands are added or dropped. The changes introduce family_before and removed_connective_block to reconstruct the multi-line chain, update the probe generation logic, add comprehensive unit tests, and update the specification documentation. I have no feedback to provide as there are no review comments.
|
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 21 minutes. View limit details
|
|
Local proof on exact head This completes the RED/GREEN pair for the five new tests (RED on main: 4 failed, 1 passed). The Proof section's "in progress" line is superseded by this result. Still not run locally: Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
reviewed_head_sha: a2f53bc
integration_basis: origin/main at branch point (abf2c72); merge-queue composition not yet evaluated
claim_boundary: #7945. A predicate whose old side spans several removed lines joined by && or || is compared against its whole old chain, so a dropped or added operand withholds boundary credit; an edit inside one operand of an unchanged multi-line chain keeps it. return_value probes on multi-line boolean chains, operand swaps and regrouping are outside this claim.
changed_surfaces_and_semantic_owners_inspected: family_before and removed_connective_block in crates/ripr/src/analysis/probes/diff.rs (the owner of a probe's before text), the three added-line probe sites that now call family_before, and the removed-line loop that consumes guard_edit_counterparts; diff_at and the five new cases in crates/ripr/tests/match_guard_edit.rs; the SPEC-0001 paragraph; five traceability lines; the changelog fragment.
blocking_findings: none on this head.
non_blocking_suggestions: (1) removed_connective_block has no unit test of its own; the integration cases reach it through the public path, and a direct case for the comment-holding block and the non-consecutive block would pin those two branches. (2) guard_edit_counterparts now also carries chain lines; its name still says guard edit. (3) When one replacement block holds a multi-line chain and an unrelated predicate, every added predicate in that run reads the whole block as its old side. That direction withholds credit and the chain lines lose their own deleted-line probe, so the cost is a missing advisory, not a promotion.
refuted_or_stale_findings: none; no review threads exist on this PR.
proof_and_ci_observed: I traced the helper. It returns nothing unless the block removes two or more consecutive old lines and a masked line starts or ends with a connective, so a one-line edit and a block without a connective keep removed_before unchanged. Masking keeps line count, and a missing masked line reads as empty. Each call site pushes its probe right after family_before, so a line is only marked represented when the predicate that holds it is emitted. The one promotion is the rewrapped chain with unchanged connectives, which follows the landed one-line rule (#7943) and is pinned by a positive twin beside three negatives and a one-line control. The worker observed 4 of the 5 new cases red on main and the retained log shows match_guard_edit at 34 passed, 0 failed on this head. cargo fmt --check exit 0 on this head.
proof_or_review_missing: cargo xtask precommit, the lib unit suite, Clippy, check-traceability, check-spec-format, fixtures, goldens and dogfood were not run locally on this head (the container cannot build them); an existing golden that rewraps a chain would first show in hosted qualification. CodeRabbit was quota-limited and no other provider has reviewed this head yet.
affected_currentness_dimensions: all dimensions reviewed at a2f53bc.
residual_assumptions_and_non_claims: static evidence only. CHANGELOG.md already names #7945 in an earlier delivered list although the issue reproduced on main; that entry is left for the issue reconciliation.
disposition: SOURCE_REVIEW_READY
This is the source review of record; it requests hosted qualification. The final merge review follows once those results are inspected.
Generated by Claude Code
ripr static exposure checkCommit Took 64s. |
…ent head (#7945) Review on #14232: a replacement block can hold more than one statement. Read whole, the first predicate's old `&&` matched the `&&` a second predicate gained in `same_connectives`, and the second predicate's `before` became the whole block (`d && c { return 1; } if points < 100`). `removed_connective_block` now returns `None` unless the masked block holds no `;`, no `}` and at most one `{`, so a multi-statement block keeps the single-line `removed_before` pairing from main and its lines keep their own probes. The spec sentence and doc comment that claimed such a block is compared whole are corrected. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVkj7iR1PQXPKDQoLDi
…sty corpus (#7945) Review on #14232 (RIPR-SPEC-0108): a confirmed false `exposed` graduates into the evidence-promotion honesty corpus. Adds `fixtures/rust_multi_line_dropped_conjunct` (the issue's repro) with goldens blessed from this tree's binary, and the pure-tier case `rust_multi_line_dropped_conjunct_not_promoted`, which requires one `infection_unknown` finding and no promotion. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVkj7iR1PQXPKDQoLDi
… fragment (#7945) `check-evidence-promotion-honesty` requires `expected/human-full.txt` for an `expected_class` case; bless only refreshes that file when it exists, so it is blessed here from this tree's binary. A changelog fragment holds one section, so the Internal / CI entry moves to its own file. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EQRVkj7iR1PQXPKDQoLDi
|
Repair for the two review findings, head 1. Multi-statement block (
2. Honesty corpus (RIPR-SPEC-0108) — commits
The Not run locally: Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
reviewed_head_sha: 64d1fd3
integration_basis: origin/main at branch point (abf2c72); merge-queue composition not yet evaluated
claim_boundary: #7945. A predicate whose old side is one statement head spanning several removed lines joined by && or || is compared against its whole old chain, so a dropped or added operand withholds boundary credit; an edit inside one operand of an unchanged multi-line chain keeps it. A removed block holding more than one statement head keeps the single-line pairing main already had. return_value probes on multi-line boolean chains, operand swaps and regrouping are outside this claim.
changed_surfaces_and_semantic_owners_inspected: family_before and removed_connective_block in crates/ripr/src/analysis/probes/diff.rs including the one-statement-head guard added in 56d268b; the three call sites; the removed-line loop; six cases in crates/ripr/tests/match_guard_edit.rs; the SPEC-0001 paragraph and fixture list; traceability; fixtures/rust_multi_line_dropped_conjunct (inputs, patch, three goldens, SPEC) and its row in the evidence-promotion-honesty corpus; both changelog fragments.
blocking_findings: none on this head.
non_blocking_suggestions: (1) removed_connective_block still has no unit test of its own. (2) guard_edit_counterparts now also carries chain lines; its name still says guard edit. (3) the fixture's expected/CHANGELOG.md carries two pending entries because the goldens were blessed twice.
refuted_or_stale_findings: this corrects the third suggestion in my earlier review of a2f53bc, which called the whole-block comparison of a multi-predicate block safe. Devin showed it was not: one predicate's old connective could match an operand another predicate gained. 56d268b narrows the rule to one statement head (no ;, no }, at most one { in the masked block). The second Devin finding (no honesty-corpus case) was valid and is repaired in 901f24a and 64d1fd3. The third (repeated scanning) is answered without change. All three threads are resolved.
proof_and_ci_observed: the guard runs on the masked text before any chain line is collected, so a multi-statement block returns nothing and marks no line represented. The worker observed the new two-predicate case red on the a2f53bc logic (the second predicate's old side held the first statement) and match_guard_edit at 35 passed, 0 failed with the guard; later commits change only fixtures, corpus, docs and changelog. The fixture golden reads one finding, infection_unknown, for the issue's repro, and the corpus row requires one finding, not clean, not promoted, class infection_unknown. The worker reports check-evidence-promotion-honesty, goldens check, check-fixture-contracts, check-traceability, check-changelog-fragments, check-spec-format, check-static-language and cargo fmt --check passing on the final tree, with goldens blessed by a ripr binary built from this branch.
proof_or_review_missing: in the red run the second predicate read weakly_exposed, so a false exposed was not reproduced for that exact shape. The local xtask binary was built from another branch of this session. cargo xtask precommit, the lib unit suite, Clippy and dogfood were not run locally; hosted qualification supplies them. CodeRabbit was quota-limited and no provider has reviewed this head yet.
affected_currentness_dimensions: production implementation, test stimulus, test oracle, public claim and generated relationships refreshed for 64d1fd3.
residual_assumptions_and_non_claims: static evidence only. CHANGELOG.md already names #7945 in an earlier delivered list; that entry is left for the issue reconciliation.
disposition: SOURCE_REVIEW_READY
This is the source review of record, re-posted for the repaired head; it requests hosted qualification. The final merge review follows once those results are inspected.
Generated by Claude Code
|
Generated by Claude Code |
Requested by Steven Zimmerman · project thread
Summary
if other > 0/&& 100 <= points/{) is now compared against its whole old&&/||chain. Dropping or adding an operand readsinfection_unknowninstead ofexposedfrom an input at the surviving comparison's boundary.if other > 0) as a predicate and credited the inputother = 0at its boundary.Closes #7945
Swarm / Source Boundary
dependency, or repo-ops development for
ripr-swarmSource-of-truth Links
Proposal: none
Spec: docs/specs/RIPR-SPEC-0001-static-exposure-loop.md (the #7898 connective-rule paragraph, which recorded this case as not yet covered)
ADR: none
Plan item: none
Governing issue or accepted claim: #7945
Acceptance delta (one sentence): A conjunct or disjunct dropped from a predicate whose old side spans several removed lines no longer earns boundary credit, while an edit inside one operand of an unchanged multi-line chain keeps it.
Candidate Relationships
Candidate branch (GitHub PR head is authoritative after publication): claude/project-thread-y2jtsk-7945
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): none
Accepted winner and losing candidate disposition (when decided): none
Scope
crates/ripr/src/analysis/probes/diff.rs:family_beforeandremoved_connective_block; the three added-line probe sites callfamily_beforeinstead ofremoved_before.crates/ripr/tests/match_guard_edit.rs:diff_ataccepts a multi-line old side; five new tests.Scope Classification
Production delta:
&&/||(outside strings and comments), the probe'sbeforeis the whole block joined into its one-line spelling. The existing shape cut andsame_connectivesrule (fix(infection): withhold boundary credit when a predicate edit adds or removes an operand #7943) then decide exactly as for a one-line edit.guard_edit_counterpartslist.Evidence/support delta:
&&, trailing&&,||), one positive twin (unchanged chain across lines readsexposed), one one-line control.Single acceptance criterion:
if other > 0/&& 100 <= pointstoif 100 < points, testtier(100, 0) == 0) yields noexposedfinding on the changed line, and its predicate readsinfection_unknownnamingother > 0 && 100 <= pointsas the old predicate.Non-goals:
return_valueprobes on multi-line boolean chains (exercised_bool_chain_return_sinkalso usessame_connectivesand still reads one old line).Support-tier Impact
Claim/proof notes:
Policy Impact
Ledger or exception notes:
Proof
Result, failures, or skipped proof:
exposedpredicate on the changed line; the positive twin read onlyinfection_unknown; the one-line control passed.beforehalf: 32 passed, 2 failed. The two failures were the leading-&&and trailing-&&tests, each failing only on the deleted-line probeif other > 0readingexposed; the added predicate already readinfection_unknownwithbefore: other > 0 && 100 <= points. That observation is what the second half (represented chain lines) addresses.cargo fmt --check: pass on this head.match_guard_editrun on this exact head: in progress at publication on the shared build machine; result will be added in a comment. Until then GREEN for the final head is not established locally.cargo xtask precommit,cargo test -p ripr --lib,cargo xtask check-file-policy, clippy, the workspace suite, fixtures and goldens. Before the restart, prebuiltxtask check-changelog-fragments,check-traceability,check-spec-format,check-static-languageandcheck-no-panic-familypassed on an equivalent tree that also carried a unit test this head omits.Claim Boundary
What may be claimed after this PR? What must not be claimed yet?
&&/||operand dropped from or added to a predicate whose old side spans several removed lines does not earn boundary credit.return_valuechains are covered; nor any runtime mutation outcome.Rollback
How can this PR be reverted safely?
Spec-Test-Code Traceability
a_conjunct_deleted_from_a_multi_line_if_is_not_credited,a_conjunct_deleted_from_a_trailing_operator_multi_line_if_is_not_credited,a_disjunct_deleted_from_a_multi_line_if_is_not_credited,a_multi_line_if_joined_with_its_chain_unchanged_reads_exposed,a_one_line_block_if_boundary_edit_reads_exposed)family_before,removed_connective_block)Static Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Gates
cargo fmt --checkGenerated by Claude Code