Repository navigation
fix(classify): a predicate that sets one field of a returned record is not credited by another field's assertion (#14562) - #14565
Conversation
…s not credited by another field's assertion (#14562) A predicate probe whose changed line is a single struct-literal field initializer (`big: n >= 10,`) read `exposed` from any exact assertion on the owner's result, including `assert_eq!(opts(10).retries, 3)`, which passes for either version. The field_construction twin on the same line already read weak. #14393 widened the gap to appended string arms, where the agent-eval struct_field scenario closed on this false credit. The #14206 owner-value reader now takes the field the predicate sets. While that field is kept, an owner call reads as the whole record: it reaches compared whole (also through eq/ne/cmp/partial_cmp) or through `.field`, survives clone/unwrap/expect/as_ref and friends, and any other field or method masks it with the existing #14206 consequences. Reveal gets the owner's source line at the probe so it can recognise the initializer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVdGzTRquU6DaZjS9EoHHn
…ilt record (#14562) Review of 78e434c: an owner that builds a record but returns something else (`-> bool` reading `o.big`, `-> String` rendering it) lost credit for every method on its result, and `match`/`matches!` over the record still credited a pattern on another field. The field rule now applies only when the owner declares a plain named return type and builds a literal of it; a `match` on the record is masked and `matches!` reaches only when its pattern names the changed field. `borrow`/`deref` keep the record. The spec lists the remaining limits (destructuring let, wrapped values) and uses the current function name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVdGzTRquU6DaZjS9EoHHn
…rd-field rule (#14562) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVdGzTRquU6DaZjS9EoHHn
|
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 23 minutes. View limit details
|
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY for head c49fbaf
Inspected the full diff from a040a1e:
owner_value_sink.rs:Sink::Recordandkept_field. Every branch reads the same as before or masks, and with no kept field the reading is unchanged.reveal.rs:predicate_initialized_fieldandowner_returns_record, plus thepredicate_record_fieldadmission input.evidence.rs: the source-line lookup uses the same body offset convention asowner_may_exit_before_line.- The integration test, the RIPR-SPEC-0094 section and its known limits, the changelog and the traceability fragment.
Local proof on this head:
- classify:: lib tests: 2400 passed.
- Both predicate integration targets passed.
- clippy, fmt, verdict-corpus check-all (0 false verdicts), promotion honesty, goldens, traceability and spec format all passed.
Two independent subagent reviews are recorded in the PR body, and their findings were addressed in 3d03db6 and c49fbaf.
Generated by Claude Code
There was a problem hiding this comment.
Code Review
This pull request implements tracking for predicate probes that initialize a single field of a returned struct literal, ensuring that assertions on other fields of the same struct do not incorrectly credit the predicate as exposed. It introduces owner_field_value_flow to trace the flow of specific record fields, updates the classification logic, and adds comprehensive tests and documentation. The feedback suggests a minor safety improvement in reveal.rs to use wrapping_sub(1) when retrieving the preceding byte in a string slice to prevent potential panics.
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY for head c49fbaf
Inspected the full diff from a040a1e:
owner_value_sink.rs:Sink::Recordandkept_field. Every branch reads the same as before or masks, and with no kept field the reading is unchanged.reveal.rs:predicate_initialized_fieldandowner_returns_record, plus thepredicate_record_fieldadmission input.evidence.rs: the source-line lookup uses the same body offset convention asowner_may_exit_before_line.- The integration test, the RIPR-SPEC-0094 section and its known limits, the changelog and the traceability fragment.
Local proof on this head:
- classify:: lib tests: 2400 passed.
- Both predicate integration targets passed.
- clippy, fmt, verdict-corpus check-all (0 false verdicts), promotion honesty, goldens, traceability and spec format all passed.
Two independent subagent reviews are recorded in the PR body, and their findings were addressed in 3d03db6 and c49fbaf.
Generated by Claude Code
|
Independent source-inspection receipt for c49fbaf (not a formal approval or execution receipt):
Hosted required-check and current integration qualification remain separate from this source inspection. |
|
Qualification reconciliation for head
The active main ruleset requires the merge queue, squash landing, resolved review threads and |
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
VERDICT: APPROVE c49fbaf — no blocking findings on this head.
What I inspected. The rule is gated twice: predicate_initialized_field accepts only a line that is exactly name: <probe expression> (optional comma, identifier name), and owner_returns_record accepts only a plain named return type (-> Opts, -> path::Opts, -> Self) with a matching literal in the body. With no kept field the old #14206 reading is unchanged. Sink::Record reaches whole or through the kept field; any other field, any other method, and a match on the record are Masked; clone/unwrap/expect/as_ref/borrow/deref and the payload macros keep the record; eq/ne/cmp/partial_cmp compare it whole. The rule can only turn Reaches into Masked, so it cannot add a new exposed.
Tests. The new predicate_record_field_masked target has 4 masked and 4 observing bodies; both tests passed in the hosted shards (shard 1 and shard 4). The unit tests cover the field-initializer parser, the return-type gate, and the reader's field/method/macro/match cases. The traceability fragment lists the five tests, and the spec section states the rule and its limits.
Hosted evidence at this head. Run 43402204047 is for c49fbaf5 and succeeded: Rust gates, all four test shards, the shard verifier, Result and Admit PR Candidate. The new test target ran and passed in shards 1 and 4.
Non-blocking. (1) matches!(opts(10), Opts { big: _, retries: 3 }) still reaches because the pattern names big without constraining it; the spec lists this as a known limit, but the changelog's "no longer reads exposed from an assertion on another field" is broader than the implementation for that shape. It is a pre-existing credit, not a new one. (2) owner_returns_record is a text check; a false positive can only mask a genuine read, which the spec states. (3) The PR body's local cargo xtask precommit was not run; the hosted gates cover the required checks.
Not checked. No local build or test run; the evidence is the hosted run at this head. Merge-tree clean vs base a040a1e6 and vs origin/main 91374013. Read-only.
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
VERDICT: APPROVE c49fbaf — no blocking findings on this head.
What I reviewed
Head c49fbaf56961546b39465a4ecd95501c5aaf666b (base aba9f8f134), 8 files, +551/−17: the owner_value_sink record reading, the reveal admission input, the evidence wiring, the integration controls, the spec, the traceability fragment and the changelog.
Why it holds
- The rule is narrow and text-anchored.
predicate_initialized_fieldaccepts only a line that is exactlyname: <probe expression>(optional trailing comma), with an identifier name.owner_returns_recordaccepts only a plain named return type (-> Opts,-> path::Opts,-> Self) that builds a literal of it. A generic, reference, tuple, collection,Option/Resultorimplreturn keeps the plain #14206 reading. - The wiring is correct.
predicate_source_linetakesprobe.location.line - function.start_lineintofunction.body.lines().FunctionFact.bodystarts at thefntoken andstart_lineis that token's line (ra.rs:860-928), so the offset lands on the probe line. The integration test would fail if it did not. - The invariant is one-way.
Sink::RecordreplacesSink::Valueonly when a kept field is known. A bare record and a whole-record comparison still reach; the kept field reaches; another field, another method, amatchand amatches!pattern that does not name the field mask.RECORD_KEEPING_METHODSandeq/ne/cmp/partial_cmppreserve the record or the whole-value comparison. Setting a field can therefore only turn Reaches into Masked, never the reverse. - The controls are real.
owner_value_sink.rsunit tests cover 11 reaching and 9 masking shapes, plus thelet-bound forms.reveal.rsunit tests cover the field-initializer and return-type predicates.predicate_record_field_masked.rsdrivescheck_workspaceover four masked and four observing bodies and also checks thefield_constructiontwin on the same line. - The hosted gates are green at this head. The latest
Admit PR Candidate, Rust gates, four test shards and Result runs all succeeded; the earlierAdmit PR Candidatefailure is overtaken by the later success.
Qualification the head still lacks
The head is in the merge queue (isInMergeQueue: true). The merge-group (G) check runs on the constructed group in the queue; it is not a head check and its absence on H is not a source-review gap.
Non-blocking notes
- The documented limits leave some false credit in place: a one-argument forwarding helper, a test-built container, a
matches!pattern that names but does not constrain the field, a destructuringlet, and generic/reference/Option/Result/implreturns. These are the pre-existing #14206 reading; the new rule only narrows it. RECORD_KEEPING_METHODSis name-based, so a user-defined method with one of those names could keep a record that is not the owner's. The pre-existing reading credited any method, so this is not new credit.- The
predicate_initialized_fieldtext check does not confirm that the literal holding the predicate is the returned one. A mismatch masks credit; it cannot add it.
Limits
No local build or test run. This verdict rests on source tracing of the classifier, the fact producer and the tests, plus the hosted run's reported results at this head. No checkout, push, label, merge, enqueue or worktree; repository clean at 9b91437986.
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
VERDICT: APPROVE c49fbaf
What I reviewed
Head c49fbaf56961546b39465a4ecd95501c5aaf666b (base aba9f8f134), 8 files, +551/−17: the owner_value_sink record reading, the reveal admission input, the evidence wiring, the integration controls, the spec, the traceability fragment and the changelog.
Why it holds
- The rule is narrow and text-anchored.
predicate_initialized_fieldaccepts only a line that is exactlyname: <probe expression>(optional trailing comma), with an identifier name.owner_returns_recordaccepts only a plain named return type (-> Opts,-> path::Opts,-> Self) that builds a literal of it. A generic, reference, tuple, collection,Option/Resultorimplreturn keeps the plain #14206 reading. - The wiring is correct.
predicate_source_linetakesprobe.location.line - function.start_lineintofunction.body.lines().FunctionFact.bodystarts at thefntoken andstart_lineis that token's line (ra.rs:860-928), so the offset lands on the probe line. The integration test would fail if it did not. - The invariant is one-way.
Sink::RecordreplacesSink::Valueonly when a kept field is known. A bare record and a whole-record comparison still reach; the kept field reaches; another field, another method, amatchand amatches!pattern that does not name the field mask.RECORD_KEEPING_METHODSandeq/ne/cmp/partial_cmppreserve the record or the whole-value comparison. Setting a field can therefore only turn Reaches into Masked, never the reverse. - The controls are real.
owner_value_sink.rsunit tests cover 11 reaching and 9 masking shapes, plus thelet-bound forms.reveal.rsunit tests cover the field-initializer and return-type predicates.predicate_record_field_masked.rsdrivescheck_workspaceover four masked and four observing bodies and also checks thefield_constructiontwin on the same line. - The hosted gates are green at this head. The latest
Admit PR Candidate, Rust gates, four test shards and Result runs all succeeded; the earlierAdmit PR Candidatefailure is overtaken by the later success.
Qualification the head still lacks
The head is in the merge queue (isInMergeQueue: true). The merge-group (G) check runs on the constructed group in the queue; it is not a head check and its absence on H is not a source-review gap.
Non-blocking notes
- The documented limits leave some false credit in place: a one-argument forwarding helper, a test-built container, a
matches!pattern that names but does not constrain the field, a destructuringlet, and generic/reference/Option/Result/implreturns. These are the pre-existing #14206 reading; the new rule only narrows it. RECORD_KEEPING_METHODSis name-based, so a user-defined method with one of those names could keep a record that is not the owner's. The pre-existing reading credited any method, so this is not new credit.- The
predicate_initialized_fieldtext check does not confirm that the literal holding the predicate is the returned one. A mismatch masks credit; it cannot add it.
Limits
No local build or test run. This verdict rests on source tracing of the classifier, the fact producer and the tests, plus the hosted run's reported results at this head. No checkout, push, label, merge, enqueue or worktree; repository clean at 9b91437986.
…e loop Main's sibling-field credit fix (#14565) removed the false credit that let the struct_field reference test close the loop; the genuine value is false until #14701. Loop estimate 2,603 tokens on main 13fe1f5's parent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVdGzT55kRrCq6nHnQYZHf
Requested by Steven · project thread
Source review: REVIEW_READY c49fbaf
Summary
predicateprobe whose changed line is a single struct-literal field initializer (big: n >= 10,) readexposedfrom an exact assertion on a different field of the owner's result, for exampleassert_eq!(opts(10).retries, 3). That assertion passes for either version. Thefield_constructionfinding on the same line already read weak. The bug predates fix(classify): an input equal to an appended string-equality arm reaches the change (#14388) #14393, which widened it to appended string arms. Because of it, the agent-evalstruct_fieldscenario closed its loop on this false credit (rust: a string-equality||arm whose literal a test passes stays infection_unknown, and a direct.fieldread is not a propagation witness (agent-eval struct_field never closes) #14388).exposedwhen the assertion line holds the owner call but cannot observe its value (false exposed) #14206 owner-value reader (owner_field_value_flow) now takes the field the predicate sets. It applies only when the owner declares a plain named return type and builds a literal of it. In that case the owner call reads as the whole record:eq/ne/cmp/partial_cmp) or through.field;clone,unwrap,expect,as_ref,borrowand similar;matchon it is masked, andmatches!reaches only when the pattern names the field;exposedwhen the assertion line holds the owner call but cannot observe its value (false exposed) #14206 consequences (weak,observation_unconfirmed, "discards or masks the call's value").exposedis possible.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Proposal:
Spec: RIPR-SPEC-0094
ADR:
Plan item:
Governing issue or accepted claim: #14562
Acceptance delta (one sentence): A predicate that sets one field of a returned record no longer reads exposed from an assertion on another field or method of that result, while a read of the changed field or a whole-record comparison keeps exposed.
Candidate Relationships
Candidate branch (GitHub PR head is authoritative after publication):
claude/project-thread-6a7faqStack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Scope
crates/ripr/src/analysis/classify/owner_value_sink.rs:kept_field,Sink::Record, and unit tests.crates/ripr/src/analysis/classify/reveal.rs:predicate_initialized_field,owner_returns_record, theReturnOracleAdmission::predicate_record_fieldinput, and unit tests. 26 test constructions addpredicate_record_field: None.crates/ripr/src/analysis/classifier/evidence.rs: passes the owner's source line at a predicate probe.crates/ripr/tests/predicate_record_field_masked.rs:check_workspacecontrols, 4 masked and 4 observing bodies.Scope Classification
Evidence (head c49fbaf)
cargo test -p ripr --lib classify::: 2400 passed.--test predicate_record_field_maskedpassed 2, and--test predicate_owner_value_maskedpassed 3.cargo clippy -p ripr --lib --tests -D warningsis clean, and so iscargo fmt --check.cargo xtask verdict-corpus check-all: 0 false verdicts across all 4 corpora; rust is 0/856 with traps credited 0/49.check-evidence-promotion-honesty,goldens check,check-traceabilityandcheck-spec-formatpass.cargo xtask precommitwas not run. Its covered-by build OOMs in this container, so the relevant checks were run singly as listed.big: n >= 10with onlyassert_eq!(opts(10).retries, 3)went from exposed=1 to weakly_exposed=2.retriestest went from exposed=1 to weakly_exposed=2.assert_eq!(options_from_flag("--verbose").verbose, true)still reads exposed=2 withverify=complete.cargo xtask agent-eval --compare benchmarks/agent_eval/baseline.json(advisory, not a gate) reportsstruct_fieldregressions:extra_gaps0 → 1, and tokens_to_answer 286 → 370. Both come from the predicate gap on line 10 no longer being hidden by the false credit; it is now reported beside the field_construction gap on the same line.reference_test_closes_loopreads false, which matches the committed baseline. The scenario's reference test uses bareassert!(..verbose), which still grades weak. That is the remaining rust: a string-equality||arm whose literal a test passes stays infection_unknown, and a direct.fieldread is not a propagation witness (agent-eval struct_field never closes) #14388 leg and the rust: a predicate in a struct field initializer reads exposed from an exact assertion on a sibling field #14562 follow-on. I did not rewrite the baseline here, because a refresh also picks up unrelated drift from main and open init --agents: skip DETAIL only when missing= is one code value; rows count extra facts (#14298) #14536 touches the same file.match/matches!false credit, and spec naming. All three were fixed in 3d03db6.Generated by Claude Code