Skip to content

fix(rust): resolve slice-length boundary for direct literal slice arguments (#9247) - #9248

Merged
EffortlessSteven merged 4 commits into
mainfrom
claude/project-thread-1foyxp
Oct 21, 2026
Merged

EffortlessSteven merged 4 commits into
mainfrom
claude/project-thread-1foyxp

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Before: grid-early-exact abstained (infection_unknown). Its tests call average(&[]) and average(&[2, 4]) directly in assertions, and the slice-length reader only understood a constant-table loop, so xs.len() == 0 never 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.rs gains direct_literal_call_column beside the table reader (shared prelude extracted); slice_boundary.rs falls back to it and records the real call text and line as the witness; boundary_pairing.rs admits a literal slice argument for slice.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

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Governing issue or accepted claim: #9247
Acceptance delta (one sentence): grid-early-exact moves 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

  • Slice-length boundary reading for direct literal slice calls only.

Scope Classification

  • One production behavior

Production delta: slice_table.rs, slice_boundary.rs, boundary_pairing.rs

Proof

  • New 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.
  • Existing slice_boundary and call_budget_slice_positive tests pass.
  • cargo xtask verdict-corpus check: only grid-early-exact moved (abstained to ideal); false verdicts 5/499 before and after. Re-blessed.
  • cargo xtask precommit green.

Generated by Claude Code

…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
@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 Oct 21, 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 19 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 89 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
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: e1dc455f-7543-4c56-a948-f356c06ec36c
📥 Commits

Reviewing files that changed from the base of the PR and between 0a45d39 and 3d08bd3.

📒 Files selected for processing: 10
  • .ripr/traceability.toml
  • changelog.d/9247-direct-literal-slice-arguments.md
  • crates/ripr/src/analysis/classify/boundary_pairing.rs
  • crates/ripr/src/analysis/classify/slice_boundary.rs
  • crates/ripr/src/analysis/syntax/mod.rs
  • crates/ripr/src/analysis/syntax/owner_pin.rs
  • crates/ripr/src/analysis/syntax/owner_pin/slice_table.rs
  • crates/ripr/tests/slice_direct_calls.rs
  • docs/specs/RIPR-SPEC-0001-static-exposure-loop.md
  • fixtures/rust-verdict-corpus/expected/rows/grid-early-exact.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

…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

Copy link
Copy Markdown
Member Author

Review of record

Head: 6f1a6910c0108925de7c0484b6f52d389d01b8f3

Angles (two independent read-only reviewers on fd3ff5eef, fixes verified on this head):

  • False credit / false gap. Found: owner calls in if/match/block/&&/|| operands could witness a length that never ran (high); a call in an assert message argument was counted (medium). Fixed in slice_table.rs: those operand shapes are refused and only compared operands are walked; a call in the message tail refuses the test. Controls added for each shape.
  • Tests, regressions, quality. The constant_table_call_column refactor is a verbatim extraction (table path unchanged); fallback order, row/line pairing and owner_reference_count accounting are consistent. Findings applied: early-return control no longer carries an attribute that tripped a different gate; lone-call and two-slice-parameter controls added; redundant 64-row check and calls[0] index removed. Declined: scoping the pairing admission to the receiver's own argument position. I tried it and it dropped legitimate credit (pick(&[], &[1])); other literal slices carry no scalar for activation to mistake for the boundary, so the broader admission stays, with the reason in a comment.

Evidence: slice_direct_calls (6 tests), slice_boundary (14), call_budget_slice_positive pass; cargo xtask verdict-corpus check moves only grid-early-exact (abstained to ideal), false verdicts 5/499 unchanged; cargo xtask precommit green on the fixes.

Bot reviewers (Gemini, CodeRabbit) are over quota, so their review is missing, not clean.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 21, 2026 20:10
@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 2 potential issues.

Devin Review

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

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

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

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

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.

Copy link
Copy Markdown
Member Author

Review of record (current head)

Head: 3d08bd36dd91bc3025dd3355566ba2f3de53be03. Supersedes the earlier note on 6f1a6910c.

Angles: false credit/false gap, tests/regressions/quality (two independent reviewers on fd3ff5eef), then a Devin review on 6f1a6910c.

Findings and resolutions:

  • Owner calls in if/match/block/&&/|| operands and assert message arguments could supply a length that never ran. Fixed in 6f1a6910c with controls.
  • Devin (red): average(&[]) * 0 credited a masked result. Fixed in 3d08bd36d: the call must be the whole compared operand or one side of a top-level comparison; control added. Thread resolved.
  • Devin (yellow): spec and traceability missing. Fixed in 3d08bd36d: RIPR-SPEC-0001 documents the direct-literal path and exclusions, six tests registered; check-traceability and check-spec-format pass. Thread resolved.
  • github-actions review: no confirmed defects; remaining items are a note that the refusal list is not exhaustive (it is a refuse-by-default allowlist of shapes, with controls for each) and executable-proof gaps in its own packet.
  • Declined earlier: scoping pairing admission to the receiver's own position (dropped legitimate credit; reason in code comment).

Evidence on this head: Ripr Rust Small Result success (all Rust gates green), cargo xtask precommit green, verdict-corpus check moves only grid-early-exact (abstained to ideal), false verdicts 5/499 unchanged. Gemini and CodeRabbit were over quota, so their review is missing, not clean. No open review threads; mergeable state clean.

Merging under the standing merge authority.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 933d53d into main Oct 21, 2026
53 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-1foyxp branch October 21, 2026 21:40
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