Skip to content

fix(repair): start a contents-check repair for a pushed buffer read back by an exact count (#11402) - #12698

Merged
EffortlessSteven merged 12 commits into
mainfrom
claude/side-effect-contents-check
Nov 2, 2026
Merged

EffortlessSteven merged 12 commits into
mainfrom
claude/side-effect-contents-check

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven Zimmerman · project thread

Governing issue or accepted claim: #11402

Acceptance delta (one sentence): When a test passes a fresh vector or string as &mut to a free function that pushes into it and reads back an exact count (assert_eq!(b.len(), N), N > 0), both ripr check and bare ripr repair now start a repair on the same gap (the changed pushed value), and the stub writes an exact contents check (assert_eq!(buf, expected_buf)), never a mock.

Summary

This is slice 2 of #11402; slice 1 was #12446.

Slice 1 followed the pushed value to the test's local. Both commands then refused with the same reason: the contents check.

This slice adds that contents check, and starts a repair only when every link is exact. It also grades the deleted push the same way in both commands.

Change

  • One shared rule for an exact count read. assertion_pins_pushed_collection_count and test_count_pins_pushed_collection live in collection_out_parameter.rs. One push into a fresh, empty local leaves it non-empty; a deleted push leaves it empty. So assert_eq!(b.len(), N) with a positive integer literal N (either order) notices a deleted push. It still cannot tell a changed pushed value apart.

  • The deleted push is graded the same on both sides.

    • In ripr check, the deleted-call finding (the collection_argument_observed admission in classifier/evidence.rs) reads the rule.
    • In ripr repair, the matching gap (oracle_discriminates_seam_in_test in test_grip_evidence.rs) reads the same rule.
    • So the deleted push reads exposed in check and is already checked in repair.
  • The changed pushed value is the one gap left. propagate_evidence adds a typed marker (PUSHED_COLLECTION_COUNT_PINNED) when two things hold:

    • no assertion already follows the changed value;
    • a related test is followed by the rule with a count read that pins the push.

    effect_route_readiness supplies collection contents check proposal and proposes whole_object_equality only for a changed pushed value with that marker. It reads the marker through TestGripEvidence::follows_push_to_counted_local. Every other followed push still misses the evidence and never gets a mock proposed.

  • Stub. pushed_buffer_parameter in test_stub.rs: for a changed push into a free function's own &mut Vec<..> or &mut String parameter (and the owner's file does not declare its own Vec or String), the stub now writes a test instead of refusing for want of an observer. The test binds that parameter to Vec::new() or String::new(), calls the owner and asserts assert_eq!(buf, expected_buf). The stub asks sole_pushed_buffer_at, which shares pushed_parameter_of with the propagation rule's sole_pushed_parameter. So the stub writes the contents check only for the same one-push shape the rule follows. A conditional push, a local that shadows the parameter, or a push into any other receiver keeps the observer refusal.

  • Check offers only starts repair can take. check_repair_route now also applies the shared start gate's edit-target check (recommended_test_is_repair_edit_target, through repair_start_refusal_for_entry, the gate the agent card uses). Before this, check offered a start for a test in the owner file's own #[cfg(test)] module, and bare repair refused it with no_test_route. That module is not admitted for a changed effect. This applies to every kind of gap.

  • Refusal wording. A followed count read that does not pin the push still refuses in both commands. The reason now names what the start needs, since ripr can now write the contents check: "an exact count the test checks after the call, such as assert_eq!(v.len(), 1), that would fail if nothing were pushed; until then, check the full contents by hand". The slice-1 changelog fragment and the spec are updated to match.

  • Slice-1 prerequisites (rust: a changed push into a &mut Vec argument is not followed to the test's vector, so repair refuses with "a way to follow the changed value" #11402 comment 6570138600) kept:

    • the owner's qualifiers are read from its full declaration;
    • the test must have exactly one plain #[test] attribute;
    • a final check without ; that mentions the local is refused.

    The rule also refuses an inner attribute (#[..]) in the test body. The recorded test attributes already include inner attributes, so the #[test]-only check refused this before; the explicit guard is extra protection.

Tests

crates/ripr/tests/collection_out_parameter_repair.rs runs real ripr check and bare ripr repair in a temp git repository. 24 tests.

Starts in both commands, on the same gap. In the default check, the deleted push reads exposed and the side-effect stub is offered. Cases:

  • count_read_of_the_passed_vector_starts_in_both_commands
  • string_count_read_starts_in_both_commands

Followed but not pinned: both refuse with the new reason (three modes):

  • count_read_that_does_not_pin_the_push_keeps_the_contents_check_reason (assert_ne!(b.len(), 2))
  • emptiness_read_keeps_the_contents_check_reason (assert!(!b.is_empty())). Both sides grade this boolean read weaker. Before the rule was narrowed, check refused while repair started; this test pins the agreement.

Neither command starts:

  • inline_count_read_with_no_editable_test_starts_in_neither_command: the test sits in the owner file's own #[cfg(test)] module. repair refuses with no_test_route, and check must not offer a start (three modes).
  • inner_attribute_in_the_test_body_is_not_followed.

Stub:

  • stub_writes_an_exact_contents_check_of_the_pushed_buffer
  • stub_for_a_push_into_a_local_vector_still_needs_an_observer
  • stub_for_a_conditional_push_into_the_buffer_still_needs_an_observer (if .. { buf.push(..) })
  • stub_for_a_local_that_shadows_the_buffer_still_needs_an_observer (let buf = &mut Vec::new(); buf.push(..))

Both new stub negatives fail when the stub ignores sole_pushed_buffer_at's refusal (checked by a temporary local edit, then reverted).

Slice-1 negatives, unchanged and still refusing in both commands (three modes): a different binding, a reborrow, used before the call, aliased after it, a namesake in another module, a conditional push, a second push, #[ignore], #[should_panic], a return in the pushed argument, an async owner, and a final contents check without ;. The exact-contents and pushed-item reads still do not start.

Unit tests:

  • collection_out_parameter.rs::tests::only_an_exact_nonzero_count_pins_the_push. Pinning reads: len == 1, 1 == len, len == 12. Followed reads that do not pin: assert_ne!, == 0, a message argument, <, !is_empty(). The straight-line list also gains the inner-attribute case.
  • repair_route.rs::tests::contents_check_is_proposed_only_for_a_marked_side_effect_push. Only a changed pushed value with the marker is eligible, with a whole_object_equality proposal. A marked deleted-push gap, or either kind without the marker, misses the evidence and proposes no check.

Narrow modes. With --no-unchanged-tests and --mode instant, check leaves the unchanged test out of its evidence, so it may offer no start while bare repair still starts. The start helper requires that any start check does offer is the same gap repair starts. Every negative requires both commands to refuse in all three modes. RIPR-SPEC-0351 now states this: in the narrow modes the agreement claim is only that neither command starts on a negative, and any start check offers is the gap repair starts.

Golden. No golden changes. rust_direct_collection_count_payload was re-blessed in an earlier round, and that is now reverted to main. Its owner pushes inside if id > 0 { .. }, so the fail-closed stub keeps the observer refusal there, as on main.

Not in this slice

Claim Boundary

Static evidence only. A pinning count read notices a deleted push, and the stub asks for an exact contents check. No runtime mutation outcome is claimed.

Rollback

Revert this PR. Slice 1 behavior returns: both commands refuse with the contents-check reason.

Spec-Test-Code Traceability

  • Spec: docs/specs/RIPR-SPEC-0351-out-parameter-oracle-credit.md, sections "A count read that pins the single push" and "The repair route and stub".
  • .ripr/traceability.toml RIPR-SPEC-0351 lists the new and renamed tests and the touched code.

Review round 1 (review of c7a15ba)

  • The stub's buffer check is now fail-closed through the shared one-push owner (sole_pushed_buffer_at / pushed_parameter_of). Two stub tests were added for the conditional push and the shadowing local.
  • The boundary_inputs doc comment is back above boundary_inputs.
  • RIPR-SPEC-0351 now has a sentence on narrow-mode agreement.
  • The golden re-bless was reverted (see above).
  • No merge-ready label was applied.

Proof

Run on head 5c6f5f6 (origin/main 93fa828 merged last; that merge's only conflict was the classifier/evidence.rs import list). All of these pass:

  • Before and after the merge:
    • cargo fmt --check
    • cargo clippy -p ripr --lib --tests -- -D warnings
    • Integration suites: collection_out_parameter_repair (24), check_repair_agree (25), out_parameter_oracle (41), sibling_effect_oracle (23).
  • Before the merge:
    • Lib tests filtered to collection_out_parameter repair_route test_stub task_first test_grip_evidence classifier navigation.
    • cargo xtask goldens check
    • xtask checks: check-traceability, check-policy-all, check-spec-format, check-user-text
  • After the merge: the same four xtask checks and goldens check. check_repair_agree has 26 tests after the merge (main added one).
  • Not rerun after this round: the wider xtask list from the earlier round, cargo xtask precommit (its covered_by step is OOM-killed in this sandbox, an infrastructure failure) and the full workspace suite.

Failing first:

  • The start positives were run against slice 1's source, whose suite pinned these same fixtures as refusing in both commands.
  • The inline and is_empty disagreements were each caught by their CLI case before the fix: check offered 8e34804e61b5ebb4 while repair refused or started differently.
  • The new refusal wording fails against the slice-1 binary, which prints the old text.

Not established locally:

  • cargo xtask precommit: its covered_by step is OOM-killed in this sandbox. That is infrastructure, not a source failure.
  • The full workspace test suite.

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • User text is plain language, with no internal terms.

https://claude.ai/code/session_01UNUoLUbb9AWcGogtEPEAMB


Generated by Claude Code

A free function that pushes into a &mut Vec parameter, tested by
passing a fresh local and reading only its length, now reads repository
propagation yes while the count read keeps the check weak. Once such a
push is followed, the effect route requires an exact contents check it
cannot propose yet instead of offering a mock, so check and bare repair
both refuse with the same plain reason in every check mode.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLUbb9AWcGogtEPEAMB
The push must always run (no return, ?, macro, block or branch in its
argument), the test must run straight from its definition to its last
count read with no attribute on a read and only #[test] on the
function, and the refusal names no type. A gated route proposes no
mock. Adds String, skippable-push and exact-check CLI pins, unit tests
on each guard, and the changelog fragment.

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

The hosted policy preflight failed on 63ca3d9 because the new
collection_out_parameter_repair test file runs git and the ripr binary
without a process allowlist entry. Add the entry.

Close the two gaps noted on #11402 before slice 2:
- read the owner from its full source declaration, so an async, const
  or unsafe owner is seen and refused; require the test's recorded
  attributes to be exactly one plain #[test];
- refuse when the body's tail expression (a final check without `;`)
  mentions the passed local, instead of leaving that read ungraded.

The unit straight-line negatives no longer add the namesake module to
every case, which had made them pass for the wrong reason.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLUbb9AWcGogtEPEAMB
…ack by an exact count (#11402)

Slice 2 of #11402. When a test passes its own fresh vector or string as
`&mut` to a free function that pushes into it, and reads it back only by
`assert_eq!(b.len(), N)` with a positive N, that read pins the single
push:
- the diff-side deleted-call probe and the repository-side call-presence
  seam both read one shared rule (assertion_pins_pushed_collection_count)
  and grade the deleted push noticed;
- the changed pushed value is the one gap left; its propagation stage
  carries a marker the effect route reads to supply the contents-check
  evidence and propose whole_object_equality, so both commands start on
  that same gap through repair_packet_eligibility;
- the stub writes `let mut buf = Vec::new(); ...;
  assert_eq!(buf, expected_buf);` instead of refusing for an observer.

Every other followed count read (including `assert!(!b.is_empty())`,
which both sides grade weaker) keeps the contents-check refusal in both
commands. Check no longer offers a start whose recommended test is not
an editable target (the shared start gate), so an inline test module
the new-test producer does not admit refuses in both commands. The
slice-1 rule also refuses a test body with an inner attribute.

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

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

# Conflicts:
#	crates/ripr/src/analysis/classify/mod.rs
#	crates/ripr/src/analysis/classify/propagation_witness.rs
#	crates/ripr/src/analysis/classify/propagation_witness/collection_out_parameter.rs
#	crates/ripr/src/analysis/repair_route.rs
#	crates/ripr/src/analysis/test_grip_evidence.rs
#	crates/ripr/tests/collection_out_parameter_repair.rs
#	docs/specs/RIPR-SPEC-0351-out-parameter-oracle-credit.md
#11402)

Slice 1's refusal said ripr could not write the contents check yet; the
stub now writes it, so a followed count read that does not pin the push
names the read that would admit the start and the by-hand route. The
slice-1 changelog fragment and the spec are updated to match.

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLUbb9AWcGogtEPEAMB
@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 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 148 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: 8d338075-5dae-47dd-ab8d-f5c651d14a5e
Commits

Reviewing files that changed from the base of the PR and between 5c6f5f6 and 1bff5a3.

Files selected for processing: 1
  • .ripr/traceability.toml
Recent review info
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: 11dbb1fa-f3a8-4aac-bfc4-9d93e738fe39
Commits

Reviewing files that changed from the base of the PR and between 93fa828 and 5c6f5f6.

Files selected for processing: 13
  • .ripr/traceability.toml
  • changelog.d/11402-collection-contents-check-start.md
  • changelog.d/11402-collection-out-parameter-propagation.md
  • crates/ripr/src/analysis/classifier/evidence.rs
  • crates/ripr/src/analysis/classify/mod.rs
  • crates/ripr/src/analysis/classify/propagation_witness.rs
  • crates/ripr/src/analysis/classify/propagation_witness/collection_out_parameter.rs
  • crates/ripr/src/analysis/repair_route.rs
  • crates/ripr/src/analysis/test_grip_evidence.rs
  • crates/ripr/src/analysis/test_stub.rs
  • crates/ripr/src/app/task_first.rs
  • crates/ripr/tests/collection_out_parameter_repair.rs
  • docs/specs/RIPR-SPEC-0351-out-parameter-oracle-credit.md

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Summary by CodeRabbit

  • New Features
    • ripr check can detect a deleted collection push when a test asserts an exact positive item count.
    • For eligible collection pushes, ripr repair can start a repair for the changed value, and ripr agent stub can generate a stub that asks for the full collection contents.
  • Bug Fixes
    • ripr check no longer offers repair starts when the recommended test cannot be edited.
    • Repair suggestions now distinguish exact count checks from weaker observations that do not pin the push.

Walkthrough

The change recognizes exact positive count assertions that pin a collection push, uses that evidence when determining repair eligibility, and generates full-buffer stub assertions for supported mutable Vec and String parameters. Check also refuses repair starts when the recommended test is not an editable target.

Changes

Collection Push Repair

Layer / File(s) Summary
Classify count-pinned pushes
crates/ripr/src/analysis/classify/propagation_witness/collection_out_parameter.rs, crates/ripr/src/analysis/test_grip_evidence.rs, crates/ripr/src/analysis/classifier/evidence.rs, crates/ripr/src/analysis/classify/mod.rs, crates/ripr/src/analysis/classify/propagation_witness.rs, crates/ripr/tests/collection_out_parameter_repair.rs, docs/specs/RIPR-SPEC-0351-out-parameter-oracle-credit.md
The analysis records qualifying count assertions and recognizes positive-literal .len() equalities as pinning a push. Propagation and classifier evidence use the count-pin result. Tests cover qualifying and non-qualifying reads, including inner-attribute cases.
Apply count evidence to repair starts
crates/ripr/src/analysis/repair_route.rs, crates/ripr/src/app/task_first.rs, crates/ripr/tests/collection_out_parameter_repair.rs, docs/specs/RIPR-SPEC-0351-out-parameter-oracle-credit.md, changelog.d/11402-collection-contents-check-start.md, changelog.d/11402-collection-out-parameter-propagation.md, .ripr/traceability.toml
A qualifying side-effect push can supply collection-contents evidence and propose WholeObjectEquality. Check applies the editable-test-target gate. Tests cover repair starts and refusals across supported modes.
Generate full-buffer stub assertions
crates/ripr/src/analysis/test_stub.rs, crates/ripr/tests/collection_out_parameter_repair.rs, docs/specs/RIPR-SPEC-0351-out-parameter-oracle-credit.md, .ripr/traceability.toml
For eligible pushes into mutable buffer parameters, the stub initializes an empty Vec or String and prompts for the full contents. Tests cover supported pushes and refusals for local, conditional, or shadowed-buffer cases.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant collection_out_parameter
  participant TestGripEvidence
  participant repair_route
  collection_out_parameter->>TestGripEvidence: Identifies a count that pins the push
  TestGripEvidence->>repair_route: Exposes the counted-local propagation marker
  repair_route->>repair_route: Proposes WholeObjectEquality for eligible SideEffect pushes
Loading
Merge Risk: Low · previous review 5c6f5

Repair behavior has no established blocker. The traceability list needs cleanup, but it does not prevent merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 48.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the change: a contents-check repair starts for a pushed buffer that an exact count read back. The raw summary and PR description both describe this as the main change, with supporting …
Description check Passed The description follows the repository template. It fills in the summary, the governing issue, the change, tests, proof, claim boundary, rollback, and traceability sections. The Swarm/Source Boundary,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: a contents-check repair starts for a pushed buffer that an exact count read back. The raw summary and PR description both describe this as the main change, with supporting edits to check, stub, and refusal wording. The title is long (99 characters) but it stays on the main change.

Full details: Description check

Explanation

The description follows the repository template. It fills in the summary, the governing issue, the change, tests, proof, claim boundary, rollback, and traceability sections. The Swarm/Source Boundary, Scope Classification, Support-tier Impact, Policy Impact, CI Economics, and Gates sections keep their template checkboxes unchecked, and the Engineering Check is partly marked. The Source-of-truth Links fields (Proposal, Spec, ADR, Plan item) and Candidate Relationships are left blank, and the Swarm boundary checkbox is not ticked. These are non-critical gaps, so the description is mostly complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 48.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 33 functions across 9 files. (4 skipped: 4 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit counts each push in flight,
A length check pins the number right.
The repair route marks what it can see,
A stub asks for contents to be.
Then hops away through clover green.

The side-effect stub now asks `sole_pushed_buffer_at`, which shares
`pushed_parameter_of` with the propagation rule, before writing the
contents check. A conditional push or a local shadowing the buffer keeps
the observer refusal. Restores the boundary_inputs doc placement, states
the narrow-mode agreement claim in RIPR-SPEC-0351, and reverts the
rust_direct_collection_count_payload golden (its owner pushes
conditionally, so the stub refuses as on main).

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

# Conflicts:
#	crates/ripr/src/analysis/classifier/evidence.rs

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread .ripr/traceability.toml Resolved
@EffortlessSteven
EffortlessSteven merged commit 502f786 into main Nov 2, 2026
73 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/side-effect-contents-check branch November 2, 2026 21:14
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