Repository navigation
fix(rust): resolve slice-length boundary for direct literal slice arguments (#9247) - #9248
Conversation
…uments (#8061) A test that calls the owner with literal &[..] arguments inside assertions now supplies slice cardinalities to the boundary reader and the pairing gate, so an empty literal pinned exactly credits xs.len() == 0 instead of abstaining. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86
|
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 19 seconds. View limit details
Comment |
…tional operands (#9247) Reject owner calls in branch, match, block and short-circuit operands and in assertion message arguments, and cover them with controls. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86
Review of recordHead: Angles (two independent read-only reviewers on
Evidence: Bot reviewers (Gemini, CodeRabbit) are over quota, so their review is missing, not clean. 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! |
There was a problem hiding this comment.
Confirmed findings
- assertion_only_function is marked pub-by-convention (no visibility), shared between readers; a future direct_literal addition that needs a slightly different prelude could silently bypass the existing checks by copying rather than reusing.
Verification questions
- Confirm duplicated refusal shape list: direct_literal_call_column enumerates 13+ AST refuse kinds inline instead of using an existing helper or extending an established refuse predicate.
- Confirm sibling syntax variants beyond the explicit controls are conservatively rejected, not proven comprehensively by the current focused test surface.
Refuted
- hidden_or_conditional_arguments_cannot_supply_a_length may silently pass when boundary_values fails before emitting any finding (vacuous assertion via mentions_empty_length on absent fact list).; refuted because: finding_with requires exactly one finding anchored to xs.len()==0; each body pairs a pairing-disabled witness with a non-empty companion (e.g. average(&[2,4])==3, average(&[1+1,4])==3), so a missing finding errors rather than silently passing. assertions still require mentions_empty_length false AND non-Exposed, both meaningful on a real finding.
- literal_slice_length made pub(super) could be misused from another module; tightening to pub(super) is already the chosen visibility in slice_boundary.rs; refuted because: Boundary readers are the only planned callers; pub(super) exposes only to classify. Re-exports would need explicit use::pub use. No overreach observed in the diff.
- Hypothesis that a literal slice argument with an embedded reference (
&some_vec[..]) could trigger a Box::from(slice) or allocator transfer across a JS worker boundary.; refuted because: Ra Ap syntax parsing treats the argument text as opaque &str; ripr never allocates a Box from it, never crosses a worker, and never exposes to JS. Allocation-failure semantics are not reachable on this diff. - This change can expose a resize/detach/transfer or mutable-backing-store lifetime defect.; refuted because: False premise: the changed code reads Rust slice-literal cardinalities as syntax and constructs analyzer evidence; it neither performs allocation nor accesses a mutable or native buffer.
- No JS runtime, WebWorker, postMessage, wasm_bindgen, SharedArrayBuffer, Atomics, transferable ArrayBuffer, or detached ArrayBuffer appears anywhere in the PR diff or imports. Worker/async/GC/detach/transfer surfaces are out of scope.
- Literal argument extraction could cause a denial of service through oversized or deeply nested inputs.; refuted because: literal_slice_length rejects text over 4096 bytes, while the new caller also enforces the existing row limit; no unbounded processing primitive was added.
Evidence gaps
- cargo-test receipt is scheduled-late per the sensor table; the late witness lands before the gate so worker/async behaviour is not excluded from this review verdict.
- Model proof intent was rejected by deterministic validation.
- Independent executable confirmation is still absent from the supplied packet: ripr failed with exit code 2 and cargo-test is scheduled late.
… add spec and traceability (#9247) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01THmnTJYPr5V99aEDNdTy86
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- ub-active-view lane scope mismatch: this PR touches a Rust static analyzer for slice-length boundaries. There is no ArrayBuffer, TypedArray, SharedArrayBuffer, resizable buffer, DetachArrayBuffer, TransferArrayBuffer, or DOM/JS engine surface in the diff or traced code. Re-running this lane on JavaScript runtimes or out-of-scope code would be meaningless. No active-view UB claim to certify.
Verification questions
- Confirm focused tests cover several branch/control-flow and computed-input siblings, but the refusal list is not a proof of exhaustive AST-expression variants.
- Confirm the reader refuses several meta-classes of nested execution, but its control suite is not exhaustive across uncommon ra_ap expression and macro token-tree forms.
- Confirm the changed direct-call reader conservatively refuses calls nested below non-comparison, conditional, closure, control-flow, item, macro, field, index, method-call, and logical-binary nodes, reducing skipped or masked execution risks.
Refuted
- This direct-literal path requires a new unsafe lifetime or pointer-ownership contract.; refuted because: The implementation only collects and parses owned Rust source strings; no unsafe/native construction, borrowed storage, lifetime extension, or ownership transfer was added.
- The change introduces a JavaScript/worker memory-lifetime hazard.; refuted because: The reviewed production paths are Rust syntax-tree traversal and classification; no JS runtime or worker handoff surface is changed.
- A second slice parameter can cause the wrong literal to supply the boundary length.; refuted because: The boundary witness remains keyed to the receiver parameter position, while the fallback deliberately permits other literal slices; the pick(&[], &[1]) versus pick(&[1], &[]) controls demonstrate correct attribution.
- The same owner-name and literal-slice pattern may have another credited route in constant-table handling that needs parallel result-preservation checks.; refuted because: The reviewed table path remains a distinct single-call route, while this PR's direct route is guarded separately; no cross-route masking defect was established from the supplied diff.
Evidence gaps
- Current executable proof is unavailable because ripr failed and the scheduled cargo-test receipt has not landed.
- Model proof intent was rejected by deterministic validation.
- The direct-call admission path depends on deterministic matching of collected rows to owner-call sites and a caller-count check; malformed or reordered site pairing should remain unresolved rather than create false exposure.
Review of record (current head)Head: Angles: false credit/false gap, tests/regressions/quality (two independent reviewers on Findings and resolutions:
Evidence on this head: Merging under the standing merge authority. Generated by Claude Code |
Summary
Before:
grid-early-exactabstained (infection_unknown). Its tests callaverage(&[])andaverage(&[2, 4])directly in assertions, and the slice-length reader only understood a constant-table loop, soxs.len() == 0never saw the empty literal.After: direct literal
&[..]arguments inside assertion macros supply slice cardinalities. An empty literal pinned exactly on that call is credited; literals that never hit the boundary keep the missing-discriminator gap; bound, computed, conditional, early-returned or additionally-called inputs stay unresolved.How:
slice_table.rsgainsdirect_literal_call_columnbeside the table reader (shared prelude extracted);slice_boundary.rsfalls back to it and records the real call text and line as the witness;boundary_pairing.rsadmits a literal slice argument forslice.len()operands so the pairing gate recognises the pinned call. All existing gates (unique free owner, no other references, eager path, admitted oracle, saturation) are unchanged.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Governing issue or accepted claim: #9247
Acceptance delta (one sentence):
grid-early-exactmoves from abstained to ideal with no new false verdicts (5/499 unchanged).Candidate Relationships
Candidate branch: claude/project-thread-1foyxp
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Scope
Scope Classification
Production delta: slice_table.rs, slice_boundary.rs, boundary_pairing.rs
Proof
crates/ripr/tests/slice_direct_calls.rs: credited empty literal, non-empty twin keeps the gap, non-pinning assertion not credited, five hidden/conditional/early-return shapes unresolved, extra production caller unresolved.slice_boundaryandcall_budget_slice_positivetests pass.cargo xtask verdict-corpus check: onlygrid-early-exactmoved (abstained to ideal); false verdicts 5/499 before and after. Re-blessed.cargo xtask precommitgreen.Generated by Claude Code