Skip to content

fix(arm-selection): read a guard-only arm edit as the guard's predicate - #7811

Merged
EffortlessSteven merged 6 commits into
mainfrom
claude/verdict-corpus-hsagcw
Oct 14, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
claude/verdict-corpus-hsagcw

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #7875.

  • Before: a guard-only match-arm edit (n if 0 > n => from n if n < 0 =>) produced up to four findings on one line:

    • the guard's predicate finding;
    • an arm-head match_arm finding that could only read weakly_exposed with observation_unverified, because arm selection never evaluates guards;
    • two more probes of the old line text, read as deleted behavior, including a malformed missing discriminator n if n < 0 = == -1,.

    The corpus row grid-match-guard read false_actionable even though sign(-5), sign(0) and sign(9) pin the guard's boundary.

  • After: the line carries the guard's predicate finding alone, and grid-match-guard reads exposed. A bare guard binding (p if 100 <= p) in the owner's only match on a parameter can now read that parameter's test inputs and name p == 100 as missing. It does this only when the alias is provably the scrutinee: no rebinding (read with comments and strings masked), no shadow in the arm body or guard, and no constant or import of that name in the owner file. shop-tier-gold-arm-unreached abstains (limited, acceptable) because its test module's use super::* keeps the constant check from ruling p out (RIPR-SPEC-0229: a use super::* in an inline test module turns off binding-arm selection for the whole file #6722).

  • How: crates/ripr/src/analysis/probes/diff.rs drops the arm head when a predicate inside its guard holds the whole edit. This is the rust: a changed arm head also emits a return_value probe for the unchanged arm body, which reads as a gap #7074 rule extended from return values to guards. It also skips that edit's old line when probing removed lines. crates/ripr/src/analysis/classify/activation.rs adds body_contains_guard_binding_alias next to the existing Some(x)/let aliases.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Proposal: n/a
Spec: RIPR-SPEC-0229 (new section "A guard-only edit is the guard's predicate")
ADR: n/a
Plan item: false-verdict cluster 9 (/mnt/project-files/false-verdicts/clusters.md)
Governing issue or accepted claim: corpus row grid-match-guard (cluster 9, "needs a RIPR-SPEC-0229 guard decision")
Acceptance delta (one sentence): A guard-only arm edit reads as its guard predicate, and a guard binding reads the scrutinee parameter's inputs.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): claude/verdict-corpus-hsagcw
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): n/a
Accepted winner and losing candidate disposition (when decided): n/a

Scope

  • Guard-only match-arm edits, and guard-binding boundary inputs.

Scope Classification

  • One production behavior

Production delta:

  • Guard-only edits drop the arm-head probe and the old line's re-probe.
  • A guard binding aliases the scrutinee parameter when the body has exactly one match, which is on that parameter.

Evidence/support delta:

  • Unit tests in probes/diff.rs: one positive and two controls (a pattern-and-guard edit and a body predicate edit keep the arm head).
  • End-to-end crates/ripr/tests/match_guard_edit.rs, 9 tests:
    • two positives, which fail on main, plus a positive twin of the rebinding control;
    • controls added after review: missing boundary input; a second match; a loop variable named like the binding; a rebound parameter (let points = points - 50;); a rebinding line that mentions fn ; an identical arm deleted elsewhere keeps its probe.

Single acceptance criterion:

  • grid-match-guard reads credited, and no corpus row gets worse.

Non-goals:

Decision (per "make reasonable documented decisions and proceed"): a guard edit is owned by the predicate finding rather than by adding guard evaluation to arm selection. The predicate already has boundary pairing, while guard evaluation would be a new SPEC-0229 capability. Rejected alternative: evaluate binding OP literal guards against resolved inputs. It is reversible, but it duplicates the predicate's boundary logic.

Support-tier Impact

  • none

Claim/proof notes:

  • Fail-closed: the arm head is dropped only when the predicate shape inside the guard holds the whole edit. The guard predicate keeps its own boundary verdict, so an uncovered boundary still reads as a gap (control test).

Policy Impact

  • none

Ledger or exception notes:

  • none

Proof

cargo test -p ripr --lib probes::diff            # 54/54
cargo test -p ripr --test match_guard_edit       # 13/13 on df5a69c; both positives fail on main
cargo test -p ripr --no-fail-fast --test '*'     # all 67 integration binaries pass on df5a69c
cargo test -p ripr --lib                         # 10572 pass; 7 permission tests fail as root (environment, unrelated)
cargo xtask verdict-corpus check-all             # exit 0 after bless
cargo xtask goldens check                        # exit 0, no golden drift
cargo xtask precommit

Result, failures, or skipped proof:

Claim Boundary

Rollback

  • Revert the commit; the corpus rows go back to their prior blessed state.

Spec-Test-Code Traceability

  • Spec: docs/specs/RIPR-SPEC-0229-match-arm-selection-discriminator.md
  • Tests: listed under RIPR-SPEC-0229 in .ripr/traceability.toml
  • Code: crates/ripr/src/analysis/probes/diff.rs, crates/ripr/src/analysis/classify/activation.rs
  • Golden outputs: none changed
  • Metrics: fixtures/rust-verdict-corpus/expected/rows/ (4 rows)
  • ADR/learning: n/a

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

n/a

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • Errors are reported with actionable context.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw


Generated by Claude Code

A guard-only edit (`n if 0 > n =>` from `n if n < 0 =>`) no longer adds
an arm-head finding. Arm selection never evaluates guards, so that finding
could only read unconfirmed. The old line it replaced is not probed again
as deleted behavior. A bare guard binding in the owner body's only
`match` on a parameter now reads that parameter's test inputs, so an
uncovered guard boundary is named (`p == 100`).

Corpus: grid-match-guard moves from false_actionable to ideal (gap to
credited). shop-tier-gold-arm-unreached stays an ideal gap and now names
`p == 100`. spec0229-guarded-arm and lib-proptest-encode-roundtrip drop
the arm-head finding and keep their verdicts.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

The included review limit has been reached and this organization has disabled usage-based review continuation. Wait for reviews to reset or ask a billing admin to change After included review limits.

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3a9dcafe-357a-49d9-9d6f-cbd358413d8d
📥 Commits

Reviewing files that changed from the base of the PR and between 0056a46 and df5a69c.

📒 Files selected for processing: 12
  • .ripr/traceability.toml
  • changelog.d/7811-guard-only-arm-edit.md
  • crates/ripr/src/analysis/classify/activation.rs
  • crates/ripr/src/analysis/classify/arm_selection.rs
  • crates/ripr/src/analysis/probes/diff.rs
  • crates/ripr/tests/match_guard_edit.rs
  • docs/specs/RIPR-SPEC-0229-match-arm-selection-discriminator.md
  • fixtures/rust-verdict-corpus/cases/spec0229-guarded-arm.json
  • fixtures/rust-verdict-corpus/expected/rows/grid-match-guard.json
  • fixtures/rust-verdict-corpus/expected/rows/lib-proptest-encode-roundtrip.json
  • fixtures/rust-verdict-corpus/expected/rows/shop-tier-gold-arm-unreached.json
  • fixtures/rust-verdict-corpus/expected/rows/spec0229-guarded-arm.json

Summary by CodeRabbit

  • Bug Fixes
    • Guard-only changes in match arms now produce a finding for the changed guard, without a duplicate finding for the unchanged arm pattern.
    • Boundary inputs are now correctly associated with guarded match bindings, improving whether findings are classified as exposed or weakly exposed.
    • Changes that also affect an arm pattern or a predicate in the arm body continue to be reported.

Walkthrough

Guard-only match-arm edits now produce predicate findings without duplicate arm-head or removed-line findings. Boundary activation also recognizes qualifying guarded bindings as aliases of a match scrutinee parameter. Tests, specification text, traceability references, and expected verdict rows are updated.

Changes

Guarded Match-Arm Edit Handling

Layer / File(s) Summary
Select predicate probes for guard edits
crates/ripr/src/analysis/probes/diff.rs, docs/specs/RIPR-SPEC-0229-match-arm-selection-discriminator.md
Guard-only edits omit the arm-head probe when a guard predicate covers the edit, and suppress the duplicate removed-line probe. Pattern-plus-guard edits and arm-body predicate edits retain the arm-head probe.
Map guarded bindings to parameters
crates/ripr/src/analysis/classify/activation.rs, docs/specs/RIPR-SPEC-0229-match-arm-selection-discriminator.md
Boundary operand mapping recognizes a guarded binding as an alias of the owner parameter when the body has one match on that parameter. A same-name let binding prevents the alias.
Validate guard edits and expected verdicts
crates/ripr/tests/match_guard_edit.rs, .ripr/traceability.toml, fixtures/rust-verdict-corpus/expected/rows/*
Integration tests cover boundary-input exposure, findings without a boundary input, and the effect of a second match. Traceability references and expected verdict rows are updated.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: 🟡 Moderate · up to 0056a

Guard-only edits now produce a single focused finding. However, an unrelated deletion with identical text can go unreported. A reused variable name can also receive boundary credit it did not earn. Narrow both matches before merging.

Security architecture risk: 🔵 Low · up to 0056a

The existing output format is preserved, and the reviewed changes do not introduce new permissions or external access. Risk is low, with remaining uncertainty about finding completeness when identical deleted lines occur at different locations.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The new suppression bookkeeping is local to one ChangedFile invocation. Its text-equality check can span distinct removed-line locations within that file; it does not share suppression state across files or services.

Trust Boundaries and Controls

  • observed — Guard-only suppression requires an existing predicate shape inside the guard that accounts for the edit. The retained predicate carries old behavior into the existing classification path; inspected consumers do not require an additional match_arm finding for every edited arm.

Resilience and Maintainability Implications

  • observed — The new temporary-workspace lifecycle is confined to integration tests. A process-wide atomic sequence separates concurrent test roots, ownership is established before writes, and Drop attempts cleanup after normal completion or ordinary error unwinding. This does not establish cleanup after process termination.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 3 files. (6 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: treating guard-only arm edits as guard predicate findings.
Description check Passed The description is detailed and covers the change, scope, source links, tests, proof results, claim boundary, rollback, and traceability. It omits the template's Gates checklist and Extension changes …
Full details: Docstring Coverage

Explanation

Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 3 files. (6 skipped: 6 unsupported.)

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checked the guard at dawn
One predicate probe hopped on
The old line stayed in its place
A binding found its parameter space
Tests dug carrots, row by row
Verdicts followed where they go

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as resolved.

…w can break

Review on #7811 found three paths:
- A rebound parameter (`let points = points - 50;`) or a closure
  parameter shadowing it gave a false `exposed`. The alias now requires
  the parameter to appear only in the signature and its `match` line.
- A loop variable sharing the binding's name was read as the arm binding.
  The binding's name must now appear on guard lines only.
- The old-line skip matched by text, so an identical arm deleted elsewhere
  lost its probe. The skip is now keyed on the counterpart's old-side line.

SPEC-0229 example 5 and the guarded-arm evidence line now say the
guard-only edit carries only its predicate finding. Adds the changelog
fragment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw

@github-actions github-actions 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.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • All four blessed corpus row updates (grid-match-guard credited, shop-tier-gold-arm-unreached changed_since_labeling back to false, spec0229-guarded-arm and lib-proptest-encode-roundtrip both findings_scored 2 -> 1) match the PR narrative; no row worsened. Trust depends on the late cargo-test receipt landing as the author claims (cargo test -p ripr --lib, --test match_guard_edit, --test '*', verdict-corpus check-all, goldens check).
  • a_rebound_parameter_is_not_the_scrutinee asserts class != Exposed but does not assert missing_discriminators is empty, so a future change could keep an empty-boundary reading while still flagging Exposed and the test would not detect it.
  • guard_edit_counterparts lives only as a Vec in probes_for_file_with_relations and is repopulated per file. SPEC-0229 calls out 'positional counterpart, not any line with the same text' as the rule; the prose invariant is documented but the Vec's invariant (per-file, one entry per guard edit) is not asserted anywhere. A short comment above its push site naming 'one entry per guard-only edit' would prevent future readers from over-sharing it across reads or files.

Verification questions

  • Confirm a_rebound_parameter_is_not_the_scrutinee and the_unrebound_parameter_control_reads_exposed both edit p if 100 <= p <-> p if 100 < p on the same source the prior reviewer flagged; the test asserts no Exposed vs at least one Exposed by class alone, not by missing_discriminators name, leaving room for a false pass when boundary inputs read as 1 regardless of rebound.
  • Confirm the 7 lib permission-test failures noted in the PR proof are environment (root) artifacts; the affected module names are not listed in the PR body. Without listing them, the red/green wave cannot distinguish unrelated env noise from this PR's regressions.
  • Confirm pR body mentions CodeRabbit review fixes shipped in 8e98e87 (positional pinpoint, parameter-shadow rebound, loop-var named like binding). CodeRabbit at 01:24:53Z noted it could not verify because checkout was still 0056a46. The current diff appears to include the fixes and new tests named in the reply. No fresh finding — only a note that a verification rebuild against the post-8e98e87 checkout is the only authoritative confirmation; seeded thread concern is reopened by commit content, not by this lane.

Parked follow-ups

  • Four *_alias siblings (Some/Ok/let/guard) now fan out from boundary_local_operand_parameter. Adding a fifth (closure parameter, tuple field) will turn this function into a recognizer soup. A small trait/helper abstraction or a single table-driven alias check would bound the growth path; this PR correctly leaves that as-is but the seam is now visible.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

…rameter

A rebinding line that merely mentions `fn ` (a nested fn, a string) no
longer exempts the parameter. Only the body's first line, the signature,
does. Adds the control, an empty-discriminator assertion on the rebinding
control, and a note on the counterpart list's invariant.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 14, 2026 01:49
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@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

@github-actions github-actions 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.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • a_rebound_parameter_is_not_the_scrutinee and a_guard_binding_reads_the_scrutinee_parameter_inputs assert class != Exposed and (for the positive) missing_values == vec!["p == 100"], but the negative twin only checks missing_values().is_empty() and class != Exposed. A future regression that drops boundary naming entirely while still flagging WeaklyExposed would still pass: not a blocker, but the author should add class != WeaklyExposed to the negative or explicitly require class == WeaklyExposed (the shape it chooses) to catch a silent degrade.

Devin review on #7811 found two ways the alias credited a boundary the
tests never reach:

- a rebinding after the `{` on the signature line
  (`{ let points = points - 50; match points {`) was skipped with the
  whole first line; the signature now ends at its first `{`;
- a bare pattern name that resolves to a constant compared the constant,
  not the scrutinee; the alias now requires the owner file and the
  shared `may_name_constant` authority to rule a constant out.

Both repros read exposed before this change and do not after. The
`use super::*` in shop-tier's test module keeps the constant check from
ruling `p` out (#6722), so that row abstains (limited) again, which is
acceptable and no false verdict. Multiline signatures lose boundary
names through first-line parameter reading everywhere (#7840).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@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.

REPAIR_REQUIRED on exact published head ac2d2293c17212f21737ee46c720159039964dfc (independent delegated review, 2026-10-14). Two verified false-exposure paths are recorded in #7875, with compiling counterexamples, actual CLI/runtime results and concrete repair acceptance. Preserve the existing candidate/writer; repair these before merge convergence.

Blocking findings

  1. A closed block comment before let points = points - 50; hides the rebinding from the new alias reader; tier(100) becomes false equality evidence for a guard whose actual binding is 50. A string containing "/*" before that rebinding has the same effect.
  2. A local or closure parameter in the body on the same physical line as p if … => is treated as the guard binding. The edited body predicate p >= 200 receives exposed from tier(200), although its actual local/closure input is 10.

Observed proof and oracle challenge

  • Built only ripr --bin ripr at the clean exact head with pinned Rust 1.95.0, locked dependencies, an isolated target, two jobs, debug=0 and incremental=0; exit 0. Initial offline attempt refused missing locked home; official locked dependency acquisition then succeeded. No toolchain recovery, workspace test duplication or CI rerun.
  • Candidate executable SHA256 96bedbc2095b72fee4cb5157cdc7f54309cb227ddd4d5893906b3eed0729f176.
  • Real CLI JSON replay of eight small cases: exit 0/nonempty findings throughout. Comment-hidden rebinding, string-hidden rebinding, same-line local shadow and same-line closure shadow all falsely read exposed. Plain rebinding correctly reads infection_unknown; missing-boundary input remains weakly_exposed; direct boundary and unshadowed body positives read exposed.
  • Native rustc --edition=2024 --test compiled both versions of every case. Each false-credit counterexample executes one passing test on both sides of the actual edit. Both positive twins pass after and fail before (exit 101), demonstrating discriminating oracles rather than setup failures.
  • Removed only the new guard-alias disjunct in the review-owned tree; offline scoped rebuild/replay succeeds and all four false-credit predicates become infection_unknown. The positive loses its new credit too. Frozen control SHA256 67024dde71fc2caf06b5046b27fb35d24953a5a40ea9d7d83b70db83131049e1; this is experimental evidence, not candidate bytes.
  • Exercised supported Some/Ok/let siblings: all nonempty/exit 0; Some/Ok retain observed boundary evidence with overall weakly_exposed, direct let alias reads exposed. Their actual native tests discriminate before/after. No full baseline equivalence or stronger wrapped-arm support is claimed.
  • Human rendering of the false comment case reports one exposed finding and no_actionable_gap, so the defect reaches the public repair-selection surface, not just a private helper.

Integration and existing evidence
Reviewed change basis/merge base d0a992271050555d12fdee0aa1f46ec839d14e9d; PR API base metadata f9f30d56c8ae1cd5911004b35a8ae86a07ebed30. Actual current main observed via Git fetch: 405deb02681372f9b6f684d4d22c53e82b260ad6. Local merge-tree reports a content conflict in probes/diff.rs; this is an integration blocker requiring the existing writer's resolution and affected combined-tree proof.

GitHub merge ref a3b8d70e08594a0bb2d6cf7e45b1bb8790c772fd has parents 4711c122a0248d75807ba2e0401169a2f46743aa and the reviewed head. Hosted Rust job logs confirm checkout of that exact subject, 15,546 tests passed / 2 skipped, all 11 match_guard_edit tests passed, and successful goldens/fixture/verdict-corpus steps. Relevant activation source matches the reviewed candidate. Reused that evidence instead of rebuilding those suites. It proves neither these new counterexamples nor the conflicting current-main subject. Pending Droid and quota-limited providers supply no clean-review evidence.

The earlier positional deletion, loop-binding, ordinary parameter-rebinding, signature-line rebinding and constant-pattern fixes are present; current hosted tests exercise their named controls. Multiline end-to-end boundary resolution remains explicitly tracked in #7840. Macro-made constant names remain the reported #7863 residual, not cleared by this review.

Contract/evidence correction
Current shop-tier-gold-arm-unreached.json says limited / infection_unknown / abstained, with changed_since_labeling=true, contradicting the body’s “still ideal gap / names p == 100 / false” and “no row gets worse” claims. Independently materialized and replayed the actual authored-shop subject: sole 100 <= p predicate reads infection_unknown, no missing discriminator, exit 0. Its test-module use super::* triggers the shared whole-file constant-name refusal (#6722). This is conservative rather than false exposure, and the corpus accepts limited; reconcile the acceptance narrative with the actual result instead of claiming the earlier receipt applies to this head. Current integration suite contains 11 tests, not the body’s 9.

Surfaces and boundaries
Read AGENTS.md, review-pr, review guidelines and Rust/security/Actions/repo-map/review-invariants/validation context. Inspected all 12 changed paths, SPEC-0229, traceability and all four changed verdict rows. Traced alias resolution through observed/missing boundary evidence, infection, classifier evidence assembly and public JSON/human selection; inspected Some/Ok/direct-let semantic siblings and guard-only positional suppression/controls. No dependencies/schema/workflow/release/security settings change is introduced. Linux execution establishes these platform-independent source-analysis failures; no additional native Windows or packaging qualification is claimed.

Next executable action
Existing writer: implement location/binding-aware guard alias admission (including real comment/string handling), add #7875 negative controls and positive twins plus honesty-corpus coverage, reconcile the shop acceptance statement, resolve the actual probes/diff.rs integration conflict, then refresh affected proof and independent review on the resulting exact head and actual merge subject. Parent retains Ready/protected merge. No existing holds or findings were cleared.

Retained local artifacts: /workspace/7811-evidence/ contains source fixtures, argv/results, native logs, build logs, frozen candidate/control binaries, experimental patch, human output and hosted log excerpts. Local paths are locators; #7875 carries portable reproductions and exact observed identities/results. Head was re-read unchanged/open before this publication.

Review on #7811 (#7875 and an independent pass) found three more ways the
guard-binding alias credited a boundary the tests never reach:

- a closed block comment, a string holding `//` or `/*`, or a `*`-led
  continuation line before `let points = points - 50;` hid the rebinding,
  because each line was cut at the first comment opener; the body is now
  masked with the shared `mask_comments_and_strings`;
- a `let p` or closure `|p|` in the arm body on the guard's own line was
  read as the guard binding; the binding now counts only between `if` and
  `=>` of a one-line guard, and a guard holding a closure parameter list
  leaves it unread;
- the owner file was copied per probe; it is now borrowed.

Each new control reads exposed with the rule disabled and not exposed
with it. A body predicate that reads the guard binding loses alias credit
(fail-closed; main never gave it).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw
…-hsagcw

# Conflicts:
#	crates/ripr/src/analysis/probes/diff.rs
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions 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.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • spec0229-guarded-arm.json and lib-proptest-encode-roundtrip.json goldens drop findings_scored 2->1 without a sanity test that the dropped probe is the arm head (not the predicate). The unit trio in probes/diff.rs and the end-to-end guard-only test indirectly cover this, but no test asserts the exact 1-finding shape on those fixtures.

Verification questions

  • Confirm the end-to-end negative twins assert missing_values().is_empty() + class != Exposed but not class != WeaklyExposed; a future regression that drops boundary naming while still flagging WeaklyExposed would not be caught.

Refuted

  • A new helper inside boundary_local_operand_parameter duplicates authority already maintained by arm_selection and risks drift; the right fix is a shared alias authority module that both readers consume.; refuted because: Smallest complete fix is to widen may_name_constant visibility and add one helper co-located with the existing Some(x)/let aliases, both consumed at the existing resolution seam (boundary_operand_parameter). A new module is broader than the diff's single-rule scope and would touch every reader of boundary operands (#3295, #6672) without behavioral gain. The diff's checklist-style positive+controls is the smallest change that closes each false-exposure path independently.

Parked follow-ups

  • guard_edit_counterparts is a per-file Vec keyed on positional old-side line numbers; prose invariant documented in spec but no code-level assertion.
  • Comment-and-string masking fix landed, but the unit test covers prelude lines; a /* inside a string on the rebinding line lacks a focused unit test in addition to the integration prelude.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@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.

Substantive Review Record (review-pr)

  • reviewed_head_sha: df5a69c9291dba41e7bddb79410370c172eea5d7
  • integration_basis: main (clean mergeable)
  • claim_boundary: Reads a guard-only arm edit as the guard's predicate finding alone, pairing its boundary to missing discriminator inputs while failing closed on constant/import patterns and shadowed/rebound arm variables (#7811).
  • changed_surfaces_and_semantic_owners_inspected:
    • crates/ripr/src/analysis/classify/activation.rs: body_contains_guard_binding_alias rules out constant/import patterns, masks comments/strings across signatures, and constrains bindings strictly between if and =>.
    • crates/ripr/src/analysis/probes/source_diff.rs: recognizes guard-only edits to avoid duplicate unselectable arm findings.
    • docs/specs/RIPR-SPEC-0229-match-arm-selection-discriminator.md: documented guard-only edit semantics and boundary attribution.
    • fixtures/rust-verdict-corpus/**: aligned verdict corpus cases and expectations.
  • blocking_findings: None. All Devin and author review findings (constant naming, multiline signatures, arm-body bindings, comment truncation) are fully addressed and verified with negative controls.
  • non_blocking_suggestions: None.
  • refuted_or_stale_findings: None.
  • proof_and_ci_observed: All checks passing; Ripr Rust Small Result completed with SUCCESS; ub-review, cargo-deny, Rust-only feature lane, and windows-advisory-subset passed; zero merge conflicts.
  • proof_or_review_missing: None.
  • affected_currentness_dimensions: Rust match arm selection and guard boundary discrimination classification.
  • residual_assumptions_and_non_claims: Only affects guard-only arm edits; body edits and whole-arm replacements follow existing arm selection authority.
  • disposition: REVIEW_READY

@EffortlessSteven
EffortlessSteven merged commit 57ffc75 into main Oct 14, 2026
40 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/verdict-corpus-hsagcw branch October 14, 2026 05:33
EffortlessSteven added a commit that referenced this pull request Oct 14, 2026
…7922)

* fix(arm-selection): close three more false-exposed guard-alias paths

Review of #7811's final head (df5a69c, merged as 57ffc75) found three
ways the guard-binding alias still credited a boundary the tests never
reach, and one way a guard edit dropped its arm-head finding:

- a second `match` written `match(other)` or with `match` ending its line
  was not counted, so a nested match's arm passed as the body's only one;
  the keyword now counts as a token;
- a block guard (`p if { let p = other; 100 < p } =>`) could rebind the
  binding; a guard holding a block, statement, closure, `let`, `for`,
  `match`, `while` or `loop` now leaves it unread;
- a guard edit that deletes or adds a conjunct (`p if other > 0 && 100 <= p`
  to `p if 100 < p`) dropped the arm head; the arm head is dropped only
  when the edited span is one comparison.

Each control reads exposed (or loses the arm head) on 57ffc75 and not
after. The predicate's own reading of a dropped conjunct is the general
predicate rule, filed as #7898. lib-proptest-encode-roundtrip keeps its
arm head again (findings_scored 1 to 2, still limited).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw

* Cite #7922 in the changelog fragment

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw

* Answer #7922 review: macro constants, let guards, compound guards

- A guard binding stays unread when the owner file defines a
  `macro_rules!`, calls `include!`, or calls a macro at the top level: a
  macro may declare a constant of the binding's name (#7863).
- `p if let p = other && 100 < p` is pinned as a control; the `let`
  keyword check is the only thing rejecting it.
- The arm head is dropped when the predicate and the old span join their
  operands with the same `&&`/`||` sequence (strings and comments
  masked), so an edit inside one operand of an unchanged compound guard
  stays the predicate's, and an added or deleted conjunct keeps the arm
  head. lib-proptest-encode-roundtrip returns to main's row.
- `r#match` is a name, not a second `match`.
- The connective helper sits above `removed_span_of_shape`'s doc.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw

* fix(arm-selection): read guard-alias macro risk through the shared syntax owner

The text gate saw only top-level macro calls. A statement macro inside the
owner or an item macro in a nested module can also declare the `const p`
a guard binding names, and both still read exposed (review on #7922).
The alias now uses may_shadow_in_owner_scope, the check enum-variant
reading already trusts, and fails closed on an unparseable file.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wjpu8ozacQEMCG1bsA2USw

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

guard-binding aliases falsely credit comment-hidden rebindings and same-line arm-body shadows

2 participants