Skip to content

fix(classify): a predicate that sets one field of a returned record is not credited by another field's assertion (#14562) - #14565

Merged
EffortlessSteven merged 3 commits into
mainfrom
claude/project-thread-6a7faq
Nov 14, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
claude/project-thread-6a7faq

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Source review: REVIEW_READY c49fbaf

Summary

Swarm / Source Boundary

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

Source-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-6a7faq
Stack 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, the ReturnOracleAdmission::predicate_record_field input, and unit tests. 26 test constructions add predicate_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_workspace controls, 4 masked and 4 observing bodies.
  • RIPR-SPEC-0094 section with known limits, a changelog fragment, and a traceability fragment.

Scope Classification

  • One production behavior

Evidence (head c49fbaf)

  • Local checks, run with the low-memory env:
    • cargo test -p ripr --lib classify::: 2400 passed.
    • --test predicate_record_field_masked passed 2, and --test predicate_owner_value_masked passed 3.
    • cargo clippy -p ripr --lib --tests -D warnings is clean, and so is cargo 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-traceability and check-spec-format pass.
    • A full cargo xtask precommit was not run. Its covered-by build OOMs in this container, so the relevant checks were run singly as listed.
  • Throwaway-crate probes with the built binary:
    • big: n >= 10 with only assert_eq!(opts(10).retries, 3) went from exposed=1 to weakly_exposed=2.
    • The struct_field shape with only a retries test went from exposed=1 to weakly_exposed=2.
    • assert_eq!(options_from_flag("--verbose").verbose, true) still reads exposed=2 with verify=complete.
  • cargo xtask agent-eval --compare benchmarks/agent_eval/baseline.json (advisory, not a gate) reports struct_field regressions: extra_gaps 0 → 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_loop reads false, which matches the committed baseline. The scenario's reference test uses bare assert!(..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 .field read 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.
  • Independent reviews (fresh subagents, read-only):
    • 78e434c: no blocker. Its findings were over-masking for owners that don't return the record, match/matches! false credit, and spec naming. All three were fixed in 3d03db6.
    • 3d03db6: no material issue. It confirmed the rule can only turn Reaches into Masked. Its two limit notes were added to the spec in the final commit.

Generated by Claude Code

…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
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 143 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 5529f4c4-5a43-45f8-8a62-c3bdba56dd5d
Commits

Reviewing files that changed from the base of the PR and between aba9f8f and c49fbaf.

Files selected for processing: 8

  • .ripr/traceability.d/14562-predicate-record-field.toml
  • changelog.d/14562-predicate-record-field.md
  • crates/ripr/src/analysis/classifier/evidence.rs
  • crates/ripr/src/analysis/classify/mod.rs
  • crates/ripr/src/analysis/classify/owner_value_sink.rs
  • crates/ripr/src/analysis/classify/reveal.rs
  • crates/ripr/tests/predicate_record_field_masked.rs
  • docs/specs/RIPR-SPEC-0094-observation-unverified-guard-generalization.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

SOURCE_REVIEW_READY for head c49fbaf

Inspected the full diff from a040a1e:

  • owner_value_sink.rs: Sink::Record and kept_field. Every branch reads the same as before or masks, and with no kept field the reading is unchanged.
  • reveal.rs: predicate_initialized_field and owner_returns_record, plus the predicate_record_field admission input.
  • evidence.rs: the source-line lookup uses the same body offset convention as owner_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

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 13, 2026 09:30

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

SOURCE_REVIEW_READY for head c49fbaf

Inspected the full diff from a040a1e:

  • owner_value_sink.rs: Sink::Record and kept_field. Every branch reads the same as before or masks, and with no kept field the reading is unchanged.
  • reveal.rs: predicate_initialized_field and owner_returns_record, plus the predicate_record_field admission input.
  • evidence.rs: the source-line lookup uses the same body offset convention as owner_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

Copy link
Copy Markdown
Member Author

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.

@EffortlessSteven
EffortlessSteven added this pull request to the merge queue Nov 13, 2026

Copy link
Copy Markdown
Member Author

Qualification reconciliation for head c49fbaf56961546b39465a4ecd95501c5aaf666b (read-only observation, 2026-11-13 13:55 UTC):

  • PR run 43402204047 completed successfully, including Ripr Rust Small Result. It supersedes run 43401887690, which stopped because the then-open review thread was unresolved. The single current review thread is resolved; no source change was needed for that byte-access concern.
  • The Rust gates job actually checked out ae965c0e447b1c53b4f40baff5872edb8998144c, tree 6675fb4b367cd7f56039b846330a69600f43d362, with parents aba9f8f134a398dabbf2671ba3c311a99399574f and the PR head. This is PR merge-composition proof, not native merge-group proof. Current main is 2c03ae6671e375a2f16d3ee30c581f09f596ea88, 12 commits beyond that tested base.
  • The timeline records owner enqueue at 10:22:41 UTC. The complete 65-run merge-group listing for today contains no pr-14565- subject, and no matching queue Git ref was returned. That establishes no actual-G result yet, not a queue removal or permission to submit a duplicate request.
  • Timing remains outside the 20-minute target: the successful PR workflow took 36m39s from creation to final update, Rust gates 35m30s, and the four Rust test jobs 21m40s to 24m28s. These receipts do not establish 20-minute qualification.
  • The green Rust gates log also records both canonical PR-evidence snapshots as unavailable after approximately 125 seconds each (base snapshot timed out and head snapshot timed out). The evidence contract passed with those limitations; green is not evidence that both snapshots were produced.

The active main ruleset requires the merge queue, squash landing, resolved review threads and Ripr Rust Small Result. No new run, queue request, label, source change, merge or settings change was made by this reconciliation. The existing source owner and queue entry are preserved. The bounded field-masking fix still does not establish the separate bare-bool reference-test closure in #14388/#14562.

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

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

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_field accepts only a line that is exactly name: <probe expression> (optional trailing comma), with an identifier name. owner_returns_record accepts only a plain named return type (-> Opts, -> path::Opts, -> Self) that builds a literal of it. A generic, reference, tuple, collection, Option/Result or impl return keeps the plain #14206 reading.
  • The wiring is correct. predicate_source_line takes probe.location.line - function.start_line into function.body.lines(). FunctionFact.body starts at the fn token and start_line is 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::Record replaces Sink::Value only when a kept field is known. A bare record and a whole-record comparison still reach; the kept field reaches; another field, another method, a match and a matches! pattern that does not name the field mask. RECORD_KEEPING_METHODS and eq/ne/cmp/partial_cmp preserve 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.rs unit tests cover 11 reaching and 9 masking shapes, plus the let-bound forms. reveal.rs unit tests cover the field-initializer and return-type predicates. predicate_record_field_masked.rs drives check_workspace over four masked and four observing bodies and also checks the field_construction twin 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 earlier Admit PR Candidate failure 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 destructuring let, and generic/reference/Option/Result/impl returns. These are the pre-existing #14206 reading; the new rule only narrows it.
  • RECORD_KEEPING_METHODS is 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_field text 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 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.

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_field accepts only a line that is exactly name: <probe expression> (optional trailing comma), with an identifier name. owner_returns_record accepts only a plain named return type (-> Opts, -> path::Opts, -> Self) that builds a literal of it. A generic, reference, tuple, collection, Option/Result or impl return keeps the plain #14206 reading.
  • The wiring is correct. predicate_source_line takes probe.location.line - function.start_line into function.body.lines(). FunctionFact.body starts at the fn token and start_line is 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::Record replaces Sink::Value only when a kept field is known. A bare record and a whole-record comparison still reach; the kept field reaches; another field, another method, a match and a matches! pattern that does not name the field mask. RECORD_KEEPING_METHODS and eq/ne/cmp/partial_cmp preserve 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.rs unit tests cover 11 reaching and 9 masking shapes, plus the let-bound forms. reveal.rs unit tests cover the field-initializer and return-type predicates. predicate_record_field_masked.rs drives check_workspace over four masked and four observing bodies and also checks the field_construction twin 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 earlier Admit PR Candidate failure 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 destructuring let, and generic/reference/Option/Result/impl returns. These are the pre-existing #14206 reading; the new rule only narrows it.
  • RECORD_KEEPING_METHODS is 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_field text 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.

Merged via the queue into main with commit 370fed6 Nov 14, 2026
33 of 35 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-6a7faq branch November 14, 2026 11:21
EffortlessSteven pushed a commit that referenced this pull request Nov 15, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants