Repository navigation
fix(rust): probe and observe changed field assignments (RIPR-SPEC-0228, #6485) - #8061
Conversation
#6485) A changed self.<path> = .. / op= .. now gets a field_construction probe. It is credited only through an assert_eq! read of the whole field after the owner call (directly or through a plain getter); a test that calls the owner and asserts nothing reads reachable_unrevealed; every weaker reading stays static_unknown. Early exits before the assignment, branching right-hand sides and default-like expected values refuse credit. Six Rust corpus cases leave abstention, each to its ideal verdict. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Summary by CodeRabbit
WalkthroughThe Rust parser now emits probes for eligible ChangesRust field-assignment observation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant FieldAssignmentParser
participant assigned_field_of
participant AssertionAnalysis
participant ClassifiedProbeEvidence
FieldAssignmentParser->>assigned_field_of: Provide field-construction probe
assigned_field_of->>AssertionAnalysis: Resolve assigned field and check whole-field assertion
AssertionAnalysis->>ClassifiedProbeEvidence: Provide observation classification
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Confirmed findings
- Corpus expects 24/480 false verdicts and 0 contradictions on this base. Two non-spec0228 corpus rows are NOT updated (status remains 'abstained' on other rows); if any of those rows happen to contain a self.f = .. pattern in their fixture, they would now be probed as field_construction and may regress to a different verdict. Author did not run the full corpus sweep beyond the 6 explicit cases.
- is_default_like strips leading
&only once and then does not recursively unwrap&Vec<u8>::new()/&String::new()/&&Some(..)—assert_eq!(&c.items, &Vec::new())is treated non-default, so an entire deleted write (default vec) silently credits. - docs/specs/RIPR-SPEC-0228-rust-field-write-observation.md:347 — The 'Limits' section now mixes the field-assignment probe description with the inherited limits in one bullet, so the spec no longer separates 'what this family probes' from 'known limits shared with other families'. Split into two bullets so the limits stay discoverable.
- Decision 3 (gap for call-without-assertion) is reversible but not gated by an oracle row asserting 'gap' for non-read callers. The single gap row (
spec0228-field-write-no-read) is hand-labeled; no negative test pins a related-test-but-other-binding or no-related-test case. Add corpus rows for: caller reads field from a non-owner binding; owner takes&mut selfand field is later dropped. Future local-accumulator PR (#8046) should reuse the same fixture.
Verification questions
- Confirm sensors/ripr/ub-review-sensor-status.json:0 — ripr sensor failed with exit code 2; without a green receipt the lanes cannot witness that the six corpus rows actually transition through the new field_construction probe end-to-end. The PR body and the 6 expected JSON flips are not corroborated by an executed probe on this base.
- Confirm spec claims
weakly_exposedcannot arise for field probes, but the demotion in evidence.rs only fires whenfield_assignment_target(&probe.expression)returns Some. If ra.rs emits a FieldConstruction probe from a path the text-onlyfield_assignment_targetcannot parse (e.g. tuple fieldself.0), the demotion silently does not apply and aweakly_exposedslip-through is possible. - Confirm
may_exit_earlymatches the bare wordelseby splitting on non-alnum/_. A rhsself.f = (x, else_value)or a method name likeelsewisewould not match (since split strips word chars), but a rhs identifierelse_statesimilarly safe; however anelsebranch in masked body before the stmt (a priorif/else { ... }) would false-triggermay_exit_earlyand refuse credit. - Confirm limits section still says 'Field assignments (..) are not implemented' as a bullet that the diff itself edits; re-read after merge to confirm the bullet list reflects the new limits.
- Confirm rHS branching guard uses substring containment;
=followed by=>(match arm) is excluded butopen=/close=substrings could collide with rhs operands likeopen == 1. Need adversarial corpus on rhs with==after the operator. - Confirm
rhs_may_branchdoes plainrhs.contains("==")etc. A rhs containing a string literal or doc comment that includes==,&&,\|\|,?, or</>will falsely refuse credit. Mask comments/strings (already used elsewhere asmask_comments_and_strings) before the scan, or split on token boundaries. Adversarial corpus must includeself.f = concat!("a==b"),self.f = "x && y".to_string(), and rhs identifiers likeless_than/min/or_zero. (crates/ripr/src/analysis/classify/propagation_witness.rs:1141). - Confirm rhs_may_branch uses
==,!=,<,>substring check on the whole RHS expression —self.count = if cond { a } else { b }is caught by the 'if' word match, butself.count = self.count.checked_add(1).unwrap_or(0)is not (no keyword, no comparison op), so a non-deterministic RHS credits. Asserted default-like value is the only post-hoc guard. - Confirm
may_exit_earlyflags the bare wordelseanywhere in the masked prefix. A prior completeif/else { ... }block containselsebut does not actually prevent the assignment from running (control reaches the end of theif/elseand falls through). Owners with any earlier if/else will be over-refused. Recommend: only treatelseas early-exit when it appears as} else {directly before areturn/?/break/continue, or track the nearest enclosing statement's terminator. (crates/ripr/src/analysis/classify/propagation_witness.rs:1159).
…-branching writes (RIPR-SPEC-0228, #6485) Exact-head review findings: - a multi-line assignment's changed continuation line read weakly_exposed; the parser shape now requires the whole assignment on one line - repo-scope seams graded every field write weakly_gripped; seam inventory now skips field-assignment shapes - a macro before the assignment could hide an early exit; any macro call before it now refuses credit - self.f = call(..) lost its call_deletion probe; call, method, macro, ?, .await, if, match, comparison and logical right-hand sides keep their earlier probes - 0 as T, T::MIN and T::ZERO count as default-like expected values Bumps the file-fact cache schema to 1.39 for the new parser shape. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86
… earlier probes (RIPR-SPEC-0228, #6485) Re-review R1: a call nested under +, parentheses, as or ! still minted the field probe and displaced call_deletion. The parser now checks every node of the right-hand side. Spec notes the missing repo seam and the fail-closed macro rule. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Review of record Angles
Findings and resolutions
Not fixed here, all shared with other probe families:
Accepted limits:
The final re-review, at 37dfcdc, found nothing blocking. Its one remaining nit is fixed in 1388373. Evidence on this head
Disposition: nothing blocking. This can merge once the required checks are green. Generated by Claude Code |
… check Review on #8061 found three gaps in the SPEC-0228 field-assignment path: - A block RHS with a let-else return still credited the write. The parser now refuses block, loop, return/break/continue and let RHS expressions. - A comment inside the assignment made the probe text unreadable to `field_assignment_target`, bypassing the evidence guard and seam skip. Such assignments keep no probe. - `rhs_may_branch` scanned string contents, so `self.label = "if"` lost credit. It now masks strings and comments first. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Review of record, addendum for head b4b62d6 This head adds commit b4b62d6, which fixes the three Devin findings on 1388373.
Angles rechecked on this head:
Generated by Claude Code |
Union of RIPR-SPEC-0228 field-write credit (PR) with the #6578 variant-field pattern rule (main) in classify/activation.rs; the independently-allocated file-fact cache bump 1.38 -> 1.39 collides, so the PR's field_construction shape renumbers to 1.40 (doc line in docs/OUTPUT_SCHEMA.md follows).
|
Review of record, addendum for head 8a22439 (main merged into b4b62d6) Conflict resolution checked.
Local proof on this head.
Remote. No blocking findings. Generated by Claude Code |
Main took file facts 1.40 (#8061); the expect_file binding candidates move to 1.41. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011vJe7tsVbzfQsHJiNujJgV
…uments (#9247) (#9248) * fix(rust): resolve slice-length boundary for direct literal slice arguments (#8061) A test that calls the owner with literal &[..] arguments inside assertions now supplies slice cardinalities to the boundary reader and the pairing gate, so an empty literal pinned exactly credits xs.len() == 0 instead of abstaining. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86 * docs: point the direct-literal slice fix at its issue (#9247) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86 * fix(rust): bound the direct literal slice reader to compared, unconditional operands (#9247) Reject owner calls in branch, match, block and short-circuit operands and in assertion message arguments, and cover them with controls. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86 * fix(rust): require the owner result to reach the assertion unchanged; add spec and traceability (#9247) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86 --------- Co-authored-by: Claude <noreply@anthropic.com>
🤖 Generated with Claude Code
https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86
Before: a changed Rust field assignment (
self.count += 1,self.state = JobState::Done) got no probe and always readstatic_unknown, whether a test asserted the field, read it some other way, or read nothing.After: a single-line
self.<field>assignment whose right-hand side is plain data gets a diff-scopefield_constructionprobe:exposed): anassert_eq!reads the whole field after the owner call, on the binding that call used, directly or through a plain getter.reachable_unrevealed): no related test asserts anything.static_unknown: every other reading.Six Rust corpus cases leave abstention, and each lands on its ideal verdict:
accounts-balance-addgrid-delete-exactspec0228-field-write-direct-readspec0228-field-write-enum-variantspec0228-field-write-getter-readspec0228-field-write-no-readNo other row moves.
cargo xtask verdict-corpus checkon this base: 24/480 false verdicts, 0 contradictions, oracle accuracy 44/44.How.
Probe (
ra.rsfield_assignment_path). Probed:self.<path>with=or any compound operator, all on one line, using plain ASCII field names. Not probed: a right-hand side containing, at any depth, a call, method call, macro, closure,?,.await,if,match, a comparison or&&/||. Those lines keep theircall_deletionand predicate probes, as the spec's Non-Goals require.Repo-scope seam inventory skips these shapes. Seam grading does not apply the read rule, so a well-tested write would otherwise be graded weakly gripped.
Credit (
assigned_field_path+pushed_collection_compared_whole, reused from rust: a field inside an element pushed onto a field-path collection reads weakly_exposed when the test asserts the whole collection (false actionable gap) #7131). The assignment must:return,?,let .. else,break,continue, any macro call,assert,.unwrap(,.expect().A default-like expected value never confirms the write:
0,0 as T,T::MIN,false,None,"", an emptyString/Vec, ordefault().classifier/evidence.rsturnsweakly_exposedon these probes intostatic_unknown. This fails closed, and the spec records the deviation from Behavior.The file-fact cache schema goes 1.38 → 1.39. The cached parser facts change; the classified-seam caches don't need a bump, because seam output is unchanged.
Review of record. It is posted as a PR comment and summarized here:
weakly_exposed, repo seams flagged tested writes, and a macro could hide an early exit. Those are fixed, along with the smaller findings.call_deletion, is fixed in 1388373.Limits shared with other probe families are filed as #8051 (#7638 covers dead branches) and listed in the spec.
Checks.
cargo xtask precommit: pass.cargo xtask goldens check: only theowner_return_pin_fallible_literaldrift, which is identical on main.cargo test -p riprrun has 8 failures that are not caused by this change. Seven are permission tests that fail when run as root, and one seam-inventory test also fails on main.Part of #6485 (the field half; local accumulators are #8046).