Repository navigation
fix(infection): fail closed on destructuring/pattern rebinding of parameters in local initializers (#9774) - #10154
Conversation
…n local initializers (#9774) Token-level scan: name in any earlier let pattern (destructuring, let-else, if/while let, same line), for pattern, closure parameter list, or match arm pattern region counts as a rebinding. Adds negatives with positive controls. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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 57 minutes. View limit details
Comment |
|
Independent review: REPAIR_REQUIRED at head [P1] Multiline struct match patterns escape the new rebound scan —
Observed discriminating experiment (test-only addition; production bytes unchanged): use the existing "match k {\n Some(Foo { n, .. })\n => 1,\n None => 2,\n };\n "and the same shape replacing Passed local controls: comment/string mentions of Next action for the existing canonical author: make match-pattern scanning delimiter-aware (or conservatively include the whole uncertain arm pattern), add paired struct-pattern/multiline controls including an initializer inside the arm, and refresh focused proof/review on the repaired head. No replacement writer needed. #9243 remains a separate direct-operand review. Inspected all four changed files, local-initializer resolver/consumers, SPEC-0158, traceability and repository review guidance. No competing substantive review or unresolved inline thread was visible before posting. PR-body classify/corpus/precommit results are reported evidence, not independently rerun receipts. Existing ub-review run reports success; hosted checkout/artifact semantics and full qualification remain unverified, and CI is listed skipped. No hosted qualification or branch/Ready/merge action triggered. |
A struct pattern before a multiline => lost its bindings because the arm
region started after the last closing brace. Balance braces back to the
match's own opener so Some(Foo { n, .. }) stays in the region.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
|
Repair for the P1 (multiline struct match patterns) pushed at
Requesting a refreshed review on this head before Ready. Generated by Claude Code |
|
Review of record at head
Generated by Claude Code |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Confirmed findings
- crates/ripr/src/analysis/classify/activation.rs:1530 — The closure scan is not fail-closed for the region it purports to cover: any
;,{, or}between adjacent pipes causes the entire region to be ignored. A closure whose parameter list contains such syntax, or whose pipes span nested delimiters, can therefore leave a rebinding undetected. Please either parse closure parameter regions or scan conservatively without excluding the whole region.
Verification questions
- Confirm the scanner's
letregion ends at the first=or;, so a pattern containing an equality-like token before the binding may be truncated or misclassified. - Confirm the added tests use same-shape controls to exercise the live credit path and distinguish rebinding from ordinary identical initializer text.
- Confirm the closure-parameter heuristic excludes any region containing
{,}, or;, which can skip a legitimate closure pattern rather than fail closed.
Refuted
- The PR duplicates resolver logic across consumers or requires a broader architectural change.; refuted because: The change is localized to resolve_boundary_operand and its parameter-rebound helper; the spec and traceability are additive documentation, with no new parallel credit path shown.
- The local-initializer fix should also be duplicated into the parallel owner_rebinds_operand helper.; refuted because: The seeded relationship explicitly distinguishes that helper and path; the changed scanner implements the SPEC-0158 local-initializer contract without evidence that the parallel route shares its invocation boundary.
- The patch could incorrectly model a parameter rebinding across an async worker, JS object, GC boundary, detach, or ownership transfer.; refuted because: No such crossing is present: the patch only classifies Rust text within one function body and adds local documentation/tests; it creates no concurrency, interop, lifetime, or transfer operation.
- The pattern scanner might expose an OOB, UAF, or type-confusion primitive through malformed multiline Rust patterns.; refuted because: No unsafe pointer or type reinterpretation is involved. UTF-8 boundary and mask-length checks fail closed, and slices are bounded by parsed indices; malformed input returns abstention rather than unsafe access.
Evidence gaps
- Executable validation remains incomplete in the supplied packet because the RIPR sensor failed and the scheduled cargo-test receipt was not yet present.
- Independent automated execution proof remains incomplete because the ripr sensor failed and the base cargo-test receipt was pending late.
- The reported proof is not independently complete in this packet because cargo-test is scheduled-late and ripr failed with exit code 2.
- Model proof intent was rejected by deterministic validation.
|
Refreshed independent receipt for the original multiline struct-pattern P1: satisfied on the current head. This supersedes that finding in my earlier review; it is not overall merge clearance. Reviewed identity: head New missing evidence, observed locally: a test-only public-API integration target calls
Production bytes were unchanged during these tests. Experimental tree Remaining boundary: the latest automated closure-region finding overlaps the separately tracked #10228 surface. I have not expanded into, refuted or resolved it. The existing qualification run is still in required Rust tests; its final checkout/artifact/gate result is not established by this receipt. Author-reported classify/precommit results were not broadly rerun. Overall merge disposition remains REVIEW_INCOMPLETE in this lane. Next owner action: canonical author/lead reconciles the latest automated finding with #10228 and inspects the already-running qualification. No remaining defect found in the repaired slice; no new writer, CI dispatch, Ready, merge or review-resolution action performed. |
A closure parameter region containing braces or ';' was skipped wholesale,
so |Foo { n }| and |(a, n): (u8, [u8; 2])| escaped. Accept any region whose
brackets balance with no top-level ';'.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
|
Closure-region finding (github-actions review 5641730120, and #10228 item 2) repaired at
This push restarts required CI, so I'm re-applying Generated by Claude Code |
|
Independent review: REPAIR_REQUIRED at head [P1] Rejecting unbalanced adjacent-pipe fragments misses valid closure or-pattern bindings — The new Verified through the real public enum Either { Left(usize), Right(usize) }
pub fn score(n: usize) -> u32 {
let f = |(Either::Left(n) | Either::Right(n))|
{
let m = n * 2;
if m == 40 { return 0; }
1
};
f(Either::Left(7))
}
#[test]
fn boundary() { assert_eq!(score(20), 1); }Diff the predicate from Observed proof: test-only integration target A verbatim old/new scanner comparison binds attribution to the material delta: at parent Fix direction for the canonical author: identify the outer closure pipes while respecting nested pattern delimiters/internal or-pattern pipes, or conservatively retain the binding when a partial fragment is uncertain. Keep the newly passing struct/array cases and add the inside-closure or-pattern pair before refreshing review. This is in the changed closure-region logic; the separately owned char-literal masker issue in #10228 remains outside this pass. Prior 11-case struct-arm/parser evidence is reused: those fixture sources contain no pipes, and the match-arm scanner and other exercised paths are unchanged. No broad suite replay. Author classify/precommit reports remain reported evidence. Experimental production bytes were unchanged; only a temporary integration test was added and reverted. Experimental tree Current head/base, Conversation and inline threads were reread before posting; no competing repair of this or-pattern case was visible. Existing qualification and ub-review were already running; their terminal outcomes/checkout artifacts are unverified here. No CI dispatch, author-branch write, Ready, merge or review-resolution action performed. Next action: existing author repairs this candidate and obtains refreshed focused proof/review. |
|
The required-CI failure on I'm not re-running or porting these. I'm pushing a separate repair for the closure or-pattern P1 on this branch and will merge main (with #10269 and #10253 once they land) before re-applying Generated by Claude Code |
) A parenthesized or-pattern puts an internal pipe between the closure's pipes, so both fragments are unbalanced and were dropped. Reject a region only for a top-level ';'. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
|
P1 (closure or-pattern fragments) repaired; head
CI will stay red on Generated by Claude Code |
…9774) let (0..=9, n) = t stopped the pattern at the '=' of '..=' so n was never seen. Skip '..=', '==', '<=', '>=', '!=' and '=>'. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
There was a problem hiding this comment.
Verification questions
- Confirm current evidence does not establish a complete repository-wide inventory of sibling classification entry points; only the changed activation route and related tests were inspected.
- Confirm the new unit harness uses synthetic FunctionSummary snippets rather than the public check_workspace route on compilable Rust.
- Confirm the helper scans let, for, closure, and match-arm pattern regions, but no broad syntax-level route census demonstrates that all Rust pattern-bearing constructs reaching this boundary resolver are covered.
Refuted
- The change requires a broader architectural refactor or duplicates a general resolver path.; refuted because: The diff adds one focused rebinding helper behind the existing parameter-rebound predicate; it does not alter general operand resolution or introduce another resolver implementation.
- The evidence-promotion corpus and compilable-workspace fixture gap should be expanded into this PR.; refuted because: The seeded thread explicitly tracks that independent corpus work in #10307; adding it here would broaden the already localized scanner repair.
- The PR introduces or changes a JavaScript-backed worker handoff with GC, detach, or transfer lifetime hazards.; refuted because: The four changed files contain only a Rust lexical rebinding scanner, tests, traceability, changelog, and specification text; no JavaScript, worker, async, GC, detach, or transfer boundary is present.
Evidence gaps
- The independently required honesty-corpus oracle is not present for this confirmed false promotion.
- The supplied evidence does not yet show the scheduled cargo-test receipt, while the authored proof claims classify tests and precommit passed.
- The corrected false-promotion claim has no independent honesty-corpus fixture in this diff.
- The repository lacks independent honesty-corpus and compilable public-API fixture coverage for this rebinding family, although unit pairs and negative experiments cover the scanner.
- The PR's central claim is only demonstrated by synthetic summaries in the unit helper; the public check_workspace route and independent honesty corpus still need a compilable rebinding fixture.
- Model proof intent was rejected by deterministic validation.
|
Review of record at head
Merging at this head. Generated by Claude Code |
Summary
parameter_rebound_before(activation.rs) now also runs a token-level, fail-closed scan of the masked body before the declaration: the parameter name as a whole token in any earlierletpattern (plain, destructuring,let-else,if let,while let, same line),forpattern, closure parameter list, ormatcharm pattern region (even with=>on another line) counts as a rebinding. Over-declining is accepted.if let,while let,match, closure,forand nested-block negatives, and a positive control for the duplicate-initializer-text test. The same-line form is pinned directly on the helper (the end-to-end resolver already abstains on twolets on one line).Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Proposal:
Spec: RIPR-SPEC-0158
ADR:
Plan item:
Governing issue or accepted claim: #9774
Acceptance delta (one sentence): A Local-initializer boundary operand no longer credits the observed input when the owner rebinds the parameter via a destructuring/let-else/closure/multiline-match-arm/same-line pattern.
Candidate Relationships
Candidate branch: claude/fix-9774-destructuring-rebind
Stack parent or prerequisite PR (if any): none. Open PR #9243 adds a separate
owner_rebinds_operandfor directly compared parameter operands; it does not editparameter_rebound_before(different function and path), so this builds around it. Only a possible textual overlap in the activation.rs tests module.Proof
cargo test -p ripr --lib classify::1681 passed; the new test fails without the guard (negative experiment).cargo xtask verdict-corpus check --language rustexit 0, no row moved (it prints a pre-existing note that the missed_credit ceiling could be lowered 135 to 134; unrelated, my change only adds abstentions).cargo xtask precommitexit 0.Generated by Claude Code