Repository navigation
fix(stub): compile &mut dyn/slice/str params; name equal inputs for relational boundaries - #8371
Conversation
…elational boundaries (#8361) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qnwj3dw38czgKaHAJtoEi2
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…8361) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qnwj3dw38czgKaHAJtoEi2
|
Local verification on head 35309b2: Independent review (fresh Sonnet subagent on the exact head, since Gemini is out of quota) found two real gaps, both fixed in 35309b2 with unit assertions: Not verified: full workspace tests and hosted CI. Generated by Claude Code |
|
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 11 minutes. View limit details
Comment |
There was a problem hiding this comment.
Confirmed findings
- PR body says
written_stubs_compilepasses but the function name in the diff iswritten_stubs_compile_and_stop_at_their_own_todo. Either rename the body claim or split the test; not blocking, but worth clarifying for the human reviewer.
Verification questions
- Confirm crates/ripr/src/analysis/test_stub.rs:1086 — owned_mut_binding only recognizes object types parenthesized as
(dyn T)/(dyn T + Bound). A reference-form object type that the parser emits without parentheses (e.g.dyn Talready handled, anything wrapped in additional whitespace or a single-trait bound written asdyn T: Boundif such a shape ever appears) routes correctly today, but the lane did not enumerate every shape upstream of strip_mut_reference. Suggest a guarded unit case for any object type the upstream parser currently emits to confirm the parenthesized branch is the only required strip. - Confirm new
&mut strrow inwritten_stubs_compilecovers compile, but the unit test only exercises a directStringbinding; crate-local aliasing and field-of-struct (self.name: String) routes are not unit-tested. Container-shadowing is mitigated bystd::paths, yet acrate::utils::Boxshadow would still capture the Box path on import. - Confirm
relational_boundaryonly fires for</<=/>/>=and only onPredicateBoundaryseams, leaving==/!=/equality seams with their existing description text. - Confirm integration test added three expectations (n>12 dyn, n>13 slice, n>14 str) under written_stubs_compile_and_stop_at_their_own_todo; written_stubs_compile is a sibling function name referenced in PR body but the diff only adds expectations, no fresh compile assertion target.
- Confirm relational-boundary probe gates on SeamKind::PredicateBoundary and a single comparison op in {<,<=,>,>=}, so non-relational boundaries (==, !=, ErrorVariant, MatchArmTaken, ReturnValue, DiscriminatorTaken) fall to the prior
one_line(description)path. No new wording overrides unrelated seams.
Refuted
let mut sink: Box<dyn Sink> = todo!();would leave&mut *sinkpointing at uninitialized memory in the compiled stub, causing a lifetime-sanitizer trip even before the callee panics.; refuted because: The stub is hand-written text;todo!()is the only executed path on the callee side. The owned local is never read again after the&mut *sinkargument, so the reborrow ends at the statement.Box<T>::fromallocation failure is not a path here (noBox::from(slice)/Box::<[T]>::from(vec)is generated), and a panic fromtodo!()dropssinkcleanly. The unit test asserts the exactBox<dyn Sink + Send>shape produced for(dyn Sink + Send).- When the relational operand compares a field to a parameter of the same type (e.g.
self.tokens > nforu32), asking forself.tokens == nis the equal-input condition, but forn > n-style predicates the discriminating inputs collapse ton == n, a tautology. The new test only covers the field-vs-param case where there is genuine separation; single-binding predicates would emitn == nand a human must still pick a sentinel. - relational_boundary's single_comparison call may fail on seams whose expression text is not a single bare comparison (e.g., already parenthesized, has chained &&/||, or has been pre-normalized), silently reverting to the old wrong wording.; refuted because: SeamKind::PredicateBoundary is a precondition ripr controls upstream; the existing seam_at helper used in the new test sets the exact
self.tokens > nshape. Without traversing the PredicateBoundary emitter, this lane cannot disprove a stale-shape seam in practice; rejected as out of bounded coverage, retained as residual risk. - &mut *sink reborrow through Box could alias the active Box inner and risk an unsized-active-view aliasing UB when sink.put is invoked past todo!(); refuted because: The reborrow is taken on a freshly todo!()-constructed Box; no prior borrow of *sink exists, so exclusive &mut is sound for the duration of the test scope, and the assertion that the stub stops at todo!() confirms no live alias.
- Box::from(Vec) / Box::<[u8]>::from(Vec) on a freshly-constructed stub local could OOM and panic, and that panic crosses a worker-handoff boundary in any JS host using ripr as a library.; refuted because: Diff is a synchronous text generator; no Vec->Box coercion happens here, host runtime is out of lane scope, and the calibration rule treats allocation-failure in this shape as a refuted false-premise unless the PR raises it.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
…een here Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qnwj3dw38czgKaHAJtoEi2
|
Re the Actions review: the Generated by Claude Code |
There was a problem hiding this comment.
Confirmed findings
- human.txt:32
weakly_exposed->weakrelabel is mechanical across 8 fixtures and the typedcomplete_with_findings->completeplus parentheticalpropagation_unknown->unknowndrops are uniform. No test asserts the parser still understandsSeverity::WeakorState::Limitedafter the label change; the golden itself is the oracle. Acceptable; flag as low advisory. - crates/ripr/tests/agent_stub_compiles.rs:293 —
n > 14(&mut str) compares non-discriminatorily againstn > 12/n > 13: each only asserts Expect::StopsAtRiprTodo (compile + own-todo). Strictly speaking a stub ofif n > 14 { n } else { name.len() }is no harder to compile than one ofif n > 13 { n } else { buf.len() }, so the trio is slightly cardinality-of-shapes rather than three orthogonal checks. Acceptable as shape coverage; flag only as low so reviewer can decide if discriminating oracle-row cases belong here. - The helper
is_array_length_suffixonly tracks[ ( < ] ) >depth and tracks an initialprevvariable that is never read; it still produces the right answer, but an unstated invariant (that braces/brackets and lifetime'amay appear in element types) deserves a one-line comment so future maintainers don't extend it incorrectly.
Verification questions
- Confirm
let mut sink: dyn Sink = todo!();was the prior E0277 failure mode. The newwritten_stubs_compile_and_stop_at_their_own_todorow at n>12 asserts only that the stub text compiles AND stops at its owntodo!(). Coverage is fine if&mut dyn Sinkand&mut (dyn Sink + Send)produce identical text moduloBox<dyn Sink + Send>; suggest a unit assertion inunsized_mut_reference_parameters_bind_an_owned_stand_infor the parenthesized-with-bound variant executed through the seam-style path, not only the helper directly, and a separate compile row for a&mut (dyn Sink + Send)parameter so(dyn Sink + Send) -> Box<dyn Sink + Send>is proven end-to-end via the stub pipeline. (crates/ripr/tests/agent_stub_compiles.rs:105). - Confirm std-paths are necessary given fixture-local
Vecshadowing (per PR body and comment), and the changelog note mentions this; boundaries likedyn T(&mut *binding) andstr/[T](&mut binding) follow the type's actual reborrow shape rather than blindly&muting the inner. - Confirm proof gap: only one field-boundary PredicateBoundary seam is unit-tested; relational_boundary() has branches by operator (<,<=,>,>=) and path through discriminator_hint that are not unit-asserted.
- Confirm no test exercises a crate that shadows
Box/Vec/String(e.g.mod std { pub struct Box; ... }); the PR claims the std:: paths defeat shadowing but only the inference path itself was given unit coverage, not a downstream write→compile witness.
Refuted
- Fixed-size array
&mut [u8; 4]falls through to(inner.to_string(), format!("&mut {binding}")), producinglet mut buf: [u8; 4] = todo!();— sized, sound. The only failing case would be a hypotheticalBox<[u8; 4]>argument, which the upstream parser does not emit as&mut <inner>text.; refuted because: Arrays are sized; a barelet mut x: [u8; 4] = todo!();is well-formed. The Box<[T;N]> shape is not in scope here and would be a separate parser-shape issue, not a memory-lifetime bug. Box<dyn Sink>regression could sneak in unnoticed ifowned_mut_bindingfalls back to the oldlet mut sink: dyn Sink(E0277) and the integration test'scargo checkwould fail loud; refuted because: Cargo check failure would indeed fail loud, BUT the integration test uses Expect::StopsAtRiprTodo which is satisfied by a stub that compiles for ANY reason — including refusing early (which the harness also routes to StopsAtRiprTodo in some rows) or by an unused-mut no-op. The lane cannot certify red/green without a positive substring assertion.- Diff could leak
&mut *sinkreborrow across a worker boundary (raw pointer to Box); refuted because: Box stays on the calling stack of the freshly-generated#[test]fn;&mut *xis a place expression that deref-coerces to&mut dyn Sinkwith lifetime bounded to the test. No Send/Sync, no thread spawn, no worker detach in generated code. is_array_length_suffixdepth counter increments on<but does not handle Rust generic arguments that legitimately contain;(e.g.*const [T; N]type-level assertions). At type-print depth 0 a;would still classify as array. Inputs reaching owned_mut_binding are already stripped of&mutand lifetimes, so such exotic shapes are not exercised.; refuted because: Helper is only called from the[..]-stripped branch; depth counter balances[/]correctly and(/)handle parenthesized generics. The unit test asserts[[u8; 4]]isVec<[u8; 4]>(slice),[u8; 4]is itself (array), confirming the discriminator. False premise at the integration boundary.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
Requested by Steven · project thread
Before:
ripr agent stubwrote an uncompilable test for a&mut dyn Trait,&mut [T]or&mut strparameter (let mut sink: dyn Sink = todo!(), E0277). For a relational boundary over operands it cannot fill (self.tokens > n), the fill-in said "choosenso that self.tokens > n", inputs that pass under>=too.After: unsized
&muttargets bind astd::boxed::Box<dyn Trait>,std::vec::Vec<T>orstd::string::Stringstand-in passed as&mut; relational boundaries ask for equal operands (self.tokens == n), the only inputs that separate the operator from its neighbor.How:
owned_mut_bindingandrelational_boundaryinanalysis/test_stub.rs.std::paths so a crate-localVec(shadowed in the existing fixture) cannot capture them.Found by running
check+agent stub --writeover 34 authored demo crates; full findings in #8361 (16 stubs offered, all but this one compiled; 3 falseexposedvalue cases and silent no-route families are filed there, not fixed here).Verification (local):
cargo xtask precommitpass;cargo test -p ripr --lib test_stub43 pass;cargo test -p ripr --test agent_stub_compiles written_stubs_compilepass with three new&mutshapes (dyn, slice, str). Not run: full workspace tests, hosted CI.Generated by Claude Code