Repository navigation
fix(repair): start a contents-check repair for a pushed buffer read back by an exact count (#11402) - #12698
Conversation
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
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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 44 minutes. View limit details
|
| 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
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: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
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
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLUbb9AWcGogtEPEAMB
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
&mutto a free function that pushes into it and reads back an exact count (assert_eq!(b.len(), N), N > 0), bothripr checkand bareripr repairnow 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_countandtest_count_pins_pushed_collectionlive incollection_out_parameter.rs. One push into a fresh, empty local leaves it non-empty; a deleted push leaves it empty. Soassert_eq!(b.len(), N)with a positive integer literalN(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.
ripr check, the deleted-call finding (thecollection_argument_observedadmission inclassifier/evidence.rs) reads the rule.ripr repair, the matching gap (oracle_discriminates_seam_in_testintest_grip_evidence.rs) reads the same rule.exposedincheckand is already checked inrepair.The changed pushed value is the one gap left.
propagate_evidenceadds a typed marker (PUSHED_COLLECTION_COUNT_PINNED) when two things hold:effect_route_readinesssuppliescollection contents check proposaland proposeswhole_object_equalityonly for a changed pushed value with that marker. It reads the marker throughTestGripEvidence::follows_push_to_counted_local. Every other followed push still misses the evidence and never gets a mock proposed.Stub.
pushed_buffer_parameterintest_stub.rs: for a changed push into a free function's own&mut Vec<..>or&mut Stringparameter (and the owner's file does not declare its ownVecorString), the stub now writes a test instead of refusing for want of an observer. The test binds that parameter toVec::new()orString::new(), calls the owner and assertsassert_eq!(buf, expected_buf). The stub askssole_pushed_buffer_at, which sharespushed_parameter_ofwith the propagation rule'ssole_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_routenow also applies the shared start gate's edit-target check (recommended_test_is_repair_edit_target, throughrepair_start_refusal_for_entry, the gate the agent card uses). Before this,checkoffered a start for a test in the owner file's own#[cfg(test)]module, and barerepairrefused it withno_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 Vecargument is not followed to the test's vector, so repair refuses with "a way to follow the changed value" #11402 comment 6570138600) kept:#[test]attribute;;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.rsruns realripr checkand bareripr repairin a temp git repository. 24 tests.Starts in both commands, on the same gap. In the default check, the deleted push reads
exposedand the side-effect stub is offered. Cases:count_read_of_the_passed_vector_starts_in_both_commandsstring_count_read_starts_in_both_commandsFollowed 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,checkrefused whilerepairstarted; 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.repairrefuses withno_test_route, andcheckmust 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_bufferstub_for_a_push_into_a_local_vector_still_needs_an_observerstub_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], areturnin the pushed argument, anasyncowner, 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 awhole_object_equalityproposal. A marked deleted-push gap, or either kind without the marker, misses the evidence and proposes no check.Narrow modes. With
--no-unchanged-testsand--mode instant,checkleaves the unchanged test out of its evidence, so it may offer no start while barerepairstill starts. The start helper requires that any startcheckdoes offer is the same gaprepairstarts. 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 startcheckoffers is the gaprepairstarts.Golden. No golden changes.
rust_direct_collection_count_payloadwas re-blessed in an earlier round, and that is now reverted to main. Its owner pushes insideif id > 0 { .. }, so the fail-closed stub keeps the observer refusal there, as on main.Not in this slice
new_test_target) does not yet allow a new test in an owner file's inline test module for a changed effect. Such a case now refuses in both commands instead of being offered bycheckand refused byrepair.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
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.tomlRIPR-SPEC-0351 lists the new and renamed tests and the touched code.Review round 1 (review of c7a15ba)
sole_pushed_buffer_at/pushed_parameter_of). Two stub tests were added for the conditional push and the shadowing local.boundary_inputsdoc comment is back aboveboundary_inputs.Proof
Run on head 5c6f5f6 (origin/main 93fa828 merged last; that merge's only conflict was the
classifier/evidence.rsimport list). All of these pass:cargo fmt --checkcargo clippy -p ripr --lib --tests -- -D warningscollection_out_parameter_repair(24),check_repair_agree(25),out_parameter_oracle(41),sibling_effect_oracle(23).collection_out_parameter repair_route test_stub task_first test_grip_evidence classifier navigation.cargo xtask goldens checkcheck-traceability,check-policy-all,check-spec-format,check-user-textgoldens check.check_repair_agreehas 26 tests after the merge (main added one).cargo xtask precommit(itscovered_bystep is OOM-killed in this sandbox, an infrastructure failure) and the full workspace suite.Failing first:
is_emptydisagreements were each caught by their CLI case before the fix:checkoffered 8e34804e61b5ebb4 whilerepairrefused or started differently.Not established locally:
cargo xtask precommit: itscovered_bystep is OOM-killed in this sandbox. That is infrastructure, not a source failure.Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.https://claude.ai/code/session_01UNUoLUbb9AWcGogtEPEAMB
Generated by Claude Code