Skip to content

fix(rust): field-write stub refusal and borrowed-receiver-only confirmation (#12061) - #12157

Merged
EffortlessSteven merged 8 commits into
mainfrom
claude/project-thread-lx2rxb
Nov 1, 2026
Merged

EffortlessSteven merged 8 commits into
mainfrom
claude/project-thread-lx2rxb

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #12061
Acceptance delta (one sentence): A field write in a method refuses the test stub with field_written_in_method (or field_written_by_value for a by-value receiver) and a plain hand-written step, and a by-value receiver's field write is no longer credited by a read of the caller's unmoved binding.

Re-cut of the two pieces of closed #11642 (head a7006d0) that #11813 did not land, onto current main.

Summary

  • analysis/test_stub.rs, output/human/triage.rs: new TestStubRefusal::FieldWrittenInMethod (field_written_in_method, &self/&mut self receivers) and FieldWrittenByValue (field_written_by_value, anything else) for a FieldConstruction seam that is a field assignment, each with a hand-written step naming the right value.
  • analysis/classify/activation.rs: assigned_field_read_confirms requires owner_borrows_receiver. A generics-aware, tri-state owner_receiver_borrow reads the signature, so a by-value receiver (mut self, a builder) stays unjudged on the diff and repository sides and an unreadable signature fails closed.
  • RepoSeam.owner_borrows_receiver records the receiver mode so LSP hover, agent packet missing_oracle_shape and the human step choose wording per mode (field_write_read).
  • Honesty corpus case rust_copy_builder_field_write_unmoved_read plus fixture rust_copy_builder_field_write.
  • Seam cache bumped to 1.132 / 0.136 (sharded and compact) with pinned tests, docs and fixtures.
  • Spec RIPR-SPEC-0228, traceability and changelog.d/12061-...md updated.

Claim boundary

Proof

  • Negative experiment: with the receiver guard forced to true, copy_builder_read_of_the_unmoved_binding_is_not_a_check fails.
  • cargo xtask precommit exit 0 on d41ad4e.
  • Review of record: REVIEW_READY at d41ad4e (delta over 7093802).

🤖 Generated with Claude Code

https://claude.ai/code/session_01SvmPmquJYbS63HJWP8gjc3

…mation (#12061)

Re-cut of the two pieces of #11642 that #11813 did not land: the
field_written_in_method stub refusal with its hand-written step, and the
rule that only a borrowed receiver's field write is confirmed by a read of
the caller's binding (owner_borrows_receiver). Positive and discriminating
negative pins added to field_write_seam.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmquJYbS63HJWP8gjc3
@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 Nov 1, 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 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 149 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: 17d63af2-230b-40ce-95f5-11f593218c6b
Commits

Reviewing files that changed from the base of the PR and between ad94ae8 and 37e929c.

Files selected for processing: 32
  • .ripr/traceability.toml
  • changelog.d/12061-field-write-stub-refusal-and-receiver-rule.md
  • crates/ripr/src/analysis/classify/activation.rs
  • crates/ripr/src/analysis/classify/mod.rs
  • crates/ripr/src/analysis/mod.rs
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/src/analysis/seam_inventory.rs
  • crates/ripr/src/analysis/seams.rs
  • crates/ripr/src/analysis/test_stub.rs
  • crates/ripr/src/analysis/test_stub/tests.rs
  • crates/ripr/src/lsp/hover.rs
  • crates/ripr/src/output/agent_seam_packets.rs
  • crates/ripr/src/output/human/triage.rs
  • crates/ripr/tests/field_write_seam.rs
  • crates/ripr/tests/lsp_lifecycle/gap_corpus_currentness.rs
  • docs/OUTPUT_SCHEMA.md
  • docs/specs/RIPR-SPEC-0228-rust-field-write-observation.md
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/after.repo-exposure.json
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/agent-receipt.json
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/agent-verify.json
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/before.repo-exposure.json
  • fixtures/evidence-promotion-honesty-corpus/corpus.json
  • fixtures/evidence-promotion-honesty-corpus/reports/rust-repo-exposure-identical-inline-arms.json
  • fixtures/rust_copy_builder_field_write/SPEC.md
  • fixtures/rust_copy_builder_field_write/diff.patch
  • fixtures/rust_copy_builder_field_write/expected/CHANGELOG.md
  • fixtures/rust_copy_builder_field_write/expected/check.json
  • fixtures/rust_copy_builder_field_write/expected/human.txt
  • fixtures/rust_copy_builder_field_write/input/Cargo.toml
  • fixtures/rust_copy_builder_field_write/input/src/lib.rs
  • fixtures/rust_copy_builder_field_write/input/tests/opts_tests.rs
  • xtask/src/tests/rust_corpus_projection.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 1, 2026 12:52
@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 4 potential issues.

Devin Review

Comment thread crates/ripr/tests/field_write_seam.rs Resolved

@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 — head 29894c5 (pre cache bump)

Scope: full diff read; I built the head and ran cargo test -p ripr --test field_write_seam (12 of 12 pass, including the three new pins) and ran ripr check on a by-value builder repo. I did not run the lib tests (OOM on this host) or turn the receiver guard off myself; the negative experiment is taken from the PR body.

What holds

  • owner_borrows_receiver fails closed: no readable signature, a typed non-reference self (Box<Self>, Self), a Pin<&mut Self>, a Fn(..) generic that moves the first (, or &mut\nself all read as "not borrowed", which only removes credit. The test table covers by-value, typed and lookalike (selfish) cases.
  • The guard sits inside assigned_field_read_confirms, the one rule both the diff probe and the repository seam ask, so check and repair stay in agreement. The refusal is keyed on the assignment shape only: the same-impl struct-literal field still gets its stub (tested).
  • Observed on a Copy builder with one test reading the unmoved binding and one reading the chain's result: the check reports 1 unclear, no repair start, and "No test stub here: the change sets a field of self inside a method instead of building a value the method returns, so the stub cannot tell which value to assert on". The wording is plain by the #12123 standard (stub is existing vocabulary; "unclear" is in the summary glossary).
  • Cost to know: a by-value receiver whose test reads the returned value (a real check) now also reads unclear, since ripr cannot yet confirm it through the chain. The spec says so ("stays unjudged"). That is a recall loss against the current behaviour, which I did not measure on main; it is the fail-closed side.

R1 (blocking, small): the guidance tells builder users to assert on the wrong value. SPEC-0228 now promises "(for a builder, on the value the chain returns)". The code does not say that anywhere:

  • triage.rs: "assert the exact value of the changed field on the value you called it on" (the by-value caveat follows, but only about ripr's confirmation).
  • lsp/hover.rs: "assert the exact value of the changed field on the value it was called on."
  • agent_seam_packets.rs missing_oracle_shape: "exact assertion on the changed field of the value the method was called on".
    For a mut self builder, "the value it was called on" is the moved or copied receiver; the PR's own copy-builder pin establishes that asserting there confirms nothing. A user (or agent) who follows all three writes a test that passes with the change reverted. is_field_write_seam does not look at the receiver kind. Fix: reuse owner_borrows_receiver to pick wording ("on the value it returns" for a by-value receiver, "on the value you called it on" for a borrow) in all three, or at least make the spec and the strings say the same thing. Add a test per surface for the by-value wording.

Non-blocking

  • The new refusal reason, hover and packet strings are not gated per receiver kind in the stub itself: a &mut self setter and a mut self builder both get field_written_in_method with the same reason. That is fine for a refusal, but the reason could name which case it is.
  • Cache bump is pending as planned; classification changes here, so it needs the next free value at merge and a delta review.

Not established: Ripr Rust Small Result at this head.


Generated by Claude Code

Review R1 on #12157: for a by-value (mut self) builder the guidance said to
assert on the value the method was called on, which is a moved copy and
confirms nothing. The seam now records whether the owner borrows its
receiver; the hover, the packet's missing_oracle_shape and the human step
say 'the value the call returns' for a by-value receiver and 'the value it
was called on' for a borrow, and the stub refusal splits into
field_written_in_method and field_written_by_value. Also reads a
multiline '&mut\n self' receiver, and adds an honesty-corpus case for the
Copy builder.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmquJYbS63HJWP8gjc3
…eses (#12061)

Graphite on #12157: owner_borrows_receiver took the first '(' after 'fn ' as
the parameter list, so 'fn apply<F: Fn(u32) -> u32>(&mut self, ..)' read as
not borrowed. That dropped credit and, now that the seam records the mode,
worded the read as the call's result. The reader skips the generic list, and
the recorded fact is tri-state: an unreadable signature or a typed receiver
records nothing and words the read neutrally.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmquJYbS63HJWP8gjc3

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

REVIEW_READY — head 7093802

Delta review of the repair to my REPAIR_REQUIRED on 29894c5.

Receiver wording. Every surface (LSP hover seam_next_step_for, agent packet missing_oracle_shape_for, human hand_written_test_step) takes its wording from the single field_write_read(seam) mapping. By-value says "the value the call returns", borrowed says "the value it was called on", and an unrecorded fact names neither value. Each surface has a unit test for all three modes. A grep found no leftover old wording.

Stub refusal. field_written_in_method (receiver Ref/RefMut) and field_written_by_value (anything else) are chosen from the parsed signature.receiver, not the seam fact, and each has a test.

Multiline receiver parse. owner_borrows_receiver reads the first parameter of the first fn, accepts &, an optional lifetime, mut and whitespace (including newlines) before self, or self: &…, and otherwise returns false. The unit test covers &mut\n self, & mut self, &'a mut self, self: &mut Self, and negatives mut self, self, self: Box<Self>, &mutself, selfish and no signature. It could not be made to read a non-receiver as a borrow. A Fn(..) bound in generics before the parameter list shifts the first (, which yields false. That fails closed (no promotion), so I do not treat it as blocking.

Copy-builder honesty case. fixtures/rust_copy_builder_field_write uses a Copy type with retries(mut self, n) and a test that asserts the caller's unmoved binding. The golden is static_unknown, with no exposed and the by-value wording. The corpus entry asserts must_not_promote, maximum_class: weakly_exposed and one finding. The positive partner is pinned in field_write_seam.

Run on this head. Filtered lib tests (15 passed) and --test field_write_seam (13 passed). Whole-workspace lib tests do not fit in my sandbox, and I did not run the honesty gate or fixtures here.

Remaining before merge. The cache bump (three constants), the exact-head Ripr Rust Small Result, and the usual changelog and spec checks.


Generated by Claude Code

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

REVIEW_READY — head d41ad4e

Delta review against my REVIEW_READY at 7093802. Three source changes (954acee, 9350fe7, d41ad4e) plus main merges. I limited the diff to this PR's own files against the merge base with main.

1. Generics-aware receiver reader (954acee). owner_receiver_borrow now returns Option<bool>: Some(true) for a reference receiver, Some(false) for plain self / mut self, None when unreadable, typed (Box<Self>), or no receiver. owner_borrows_receiver is == Some(true), so every promotion path is unchanged from the version I approved and still fails closed. It finds the first ( at generic depth 0, tracking </> and ignoring > when the previous character is -.

  • Where clauses come after the parameter list and are never reached.
  • Nested generics (Into<Vec<(u32, u32)>>) are handled because parentheses at depth above 0 are skipped, and >> closes two levels.
  • -> inside a bound (F: Fn(u32) -> u32) does not close the list.
  • An unterminated list returns None. A comma inside a typed receiver (self: Arc<Mutex<(u32, u32)>>) truncates the first parameter to a non-reference form (None), and self: &Foo<(A, B)> truncates to a reference, which is the right answer for both.
  • The new tests pin those shapes, and the by-value-with-generic-bound case (retries<F: Fn(u32)>(mut self, f: F)) reads Some(false), so guidance names the returned value for it.
  • I did not run these unit tests; the lib-test build is OOM-killed on this host, so the exact-head hosted result applies. I read the code and tests against the edge cases above.
  • Residual, non-blocking: the reader still takes the first fn in the body text, as before.

2. Dead re-export dropped (9350fe7). The unused owner_borrows_receiver re-export in analysis/classify/mod.rs is gone. The function is still used inside activation.rs.

3. Cache bump (d41ad4e). CACHE_SCHEMA_VERSION 1.131 to 1.132, and the sharded and compact classified-seam versions 0.135 to 0.136, one above main (main is 1.131 / 0.135). The unit pin test, the two CURRENT_CORPUS_CACHE_SCHEMA_VERSION constants (lsp gap-corpus currentness and rust_corpus_projection), the docs/OUTPUT_SCHEMA.md examples and the committed repo-exposure fixtures all moved together. I grepped the head for stray 1.131 / 0.135 values and found only history comments.

Collision to watch. Open #12211 also bumps CACHE_SCHEMA_VERSION to 1.132 (no classified-seam constants). Whichever of the two merges second must rebase to 1.133 / 0.137 and move the same pins.


Generated by Claude Code

…tion pinned hashes (#12061)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmquJYbS63HJWP8gjc3

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

REVIEW_READY — head 50296f4

Delta review against d41ad4e. The delta is only 4 files under fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/ (before.repo-exposure.json, after.repo-exposure.json, agent-receipt.json, agent-verify.json), 7 lines added and 7 removed.

Hash fields only. All 7 changed line pairs are identical after replacing hex digests with a placeholder; no non-hash text differs. The changed fields are content_sha256 and sha256 in the two repo-exposure snapshots, before_content_sha256 and after_content_sha256 in the receipt, and the matching sha256 entries in agent-verify.json. The refreshed snapshot hash is consistent across the files: sha256:00a5295e… appears as content_sha256 in both snapshots and as before_content_sha256 and after_content_sha256 in the receipt, so the chain agrees. This is the same refresh pattern as #12120 for 1.131 and follows from the 1.132 cache bump. I did not regenerate the fixture here.


Generated by Claude Code

Comment thread crates/ripr/src/output/human/triage.rs Resolved
…ld-write step (#12061)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmquJYbS63HJWP8gjc3

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

REVIEW_READY — head 37e929c

Delta review of record against 50296f4. The delta is one file, crates/ripr/src/output/human/triage.rs: the borrowed-receiver (FieldWrittenInMethod) human step loses its trailing by-value sentence ("If the method takes self by value (a builder), ripr cannot yet confirm that check…"), and the existing assertion gains !written.contains("by value"). The removal is correct: that step is reached only for a borrowed receiver, where the sentence was wrong, and the by-value case has its own arm directly above that sends the reader to the call's result.

Stale-wording sweep on this head (git grep over the whole tree):

  • No golden, fixture, schema, or check-user-text input contains the removed text: zero hits for "cannot yet confirm that check", "will still report this change as unclear", and "takes self by value" outside code comments.
  • The remaining shared prefix "assert the exact value of the changed field on the value you called it on" appears only in triage.rs and two assertions in tests/field_write_seam.rs (lines 263 and 282). Both are contains checks on the shared prefix, so truncating the tail cannot break them: line 282 still matches, and line 263 (the by-value negative) is unaffected.
  • The one other "ripr cannot yet confirm" hit is prose in RIPR-SPEC-0228 describing the unjudged by-value write; it documents behaviour, not the step text, and stays accurate.

I could not build lib tests locally (OOM here), so this rests on the source read and the grep, not on a run. The new !contains("by value") assertion is satisfied by inspection of the single remaining string. The hosted Ripr Rust Small Result is not green on this head as of my read; merge needs it green on the exact head first.

Disposition: no blocking findings.


Generated by Claude Code

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