Repository navigation
fix(rust): credit literal byte-length boundary call rows (#9637) - #10378
Conversation
Successor to #9715, rebuilt on current main (its branch was 459 commits behind and its owner had not touched it for 7 hours). The six candidate commits are squashed; main's ValueFact/reach APIs and #9731 literal folding are reconciled, and the chars().count() control now asserts the #9731 path instead of unknown. Rust missed_credit_ceiling 148 -> 147. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
|
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 6 minutes. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Recognize bounded byte-length predicates crates/ripr/src/analysis/classify/literal_length_boundary.rs, crates/ripr/src/analysis/classify/owner_pin.rs, crates/ripr/src/analysis/classify/mod.rs |
Adds checks for the supported owner shape, literal call inputs, test-body placement, assertion matching, and unshadowed primitive types. |
Connect boundary evidence to classification crates/ripr/src/analysis/classify/activation.rs, crates/ripr/src/analysis/classifier/evidence.rs, crates/ripr/src/analysis/classify/infection.rs, crates/ripr/src/analysis/language/rust/probes.rs, crates/ripr/src/analysis/language/rust/mod.rs |
Passes boundary data through evidence gathering and infection analysis. Matching observed byte-length evidence can suppress unresolved-value disclosure; infection evidence alone does not. |
Verify and document bounded transfer crates/ripr/tests/literal_length_boundary.rs, docs/specs/RIPR-SPEC-0157-changed-binding-predicate-relation.md, docs/specs/RIPR-SPEC-0158-bounded-value-transfer.md, fixtures/rust-verdict-corpus/*, .ripr/traceability.toml, changelog.d/9637-literal-byte-length-boundary.md |
Adds integration cases for supported and rejected inputs and owners. Updates the specifications, expected verdict, missed-credit entry, traceability manifest, and changelog. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant BoundaryTest as literal_length_boundary test
participant WorkspaceCheck as check_workspace
participant EvidenceGather as ClassifiedProbeEvidence::gather
participant Boundary as LiteralLengthBoundary
BoundaryTest->>WorkspaceCheck: Submit edited workspace
WorkspaceCheck->>EvidenceGather: Gather probe evidence
EvidenceGather->>Boundary: Refine boundary and check literal rows
Boundary-->>EvidenceGather: Return infection and pairing evidence
EvidenceGather-->>BoundaryTest: Return predicate finding
Possibly related issues
- Issue 9637: The change implements the literal byte-length recognition described in the issue.
- Issue 7490: The change updates one Rust missed-credit case, but does not complete the release qualification tracked by the issue.
Merge Risk: 
Minimal · up to 7549e
-
This change narrowly extends byte-length boundary analysis, crediting a row only under strict owner-shape, straight-line-test, and plain-
.len()conditions. Unsupported or ambiguous inputs keep the conservative reading. No concrete merge-blocking risk was identified. The changed-code test results are the author's own report, and a new head needs its own qualification run.
Pre-merge checks: 
3 · 
1 · 
1
-
Failed checks: 1 warning · 1 inconclusive Passed checks: 3 passedFull details: Description check
-
Explanation
The description covers the summary, source boundary, source links, candidate relationship, proof, and claim boundary. It omits several required template sections, including Scope, Scope Classification, Support-tier Impact, Policy Impact, Rollback, Spec-Test-Code Traceability, Static Language Check, CI Economics, Engineering Check, and Gates. It also does not provide the required checkbox or n/a status for these sections.
Resolution
Add the missing template sections. Complete each applicable checkbox and provide the required details. Use
n/afor CI Economics if the PR does not change CI behavior. Document rollback steps, scope and non-goals, traceability, engineering checks, and gate results, including skipped commands and reasons.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 38 functions across 8 files. (6 skipped: 5 unsupported, 1 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 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 bytes in a string,
And checks which literal calls fit.
The bounded rows carry their evidence,
While distant ones stay unknown.
The test burrow records each case,
Then hops away, pleased with the diff.
Comment @coderabbitai help to get the list of available commands.
…test statement (#9637) Review finding: an assertion under `if false { .. }` still supplied a row and read exposed. Adds the guard, a paired negative test (fails without it), and the spec sentence. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
|
Review of record (partial, not final-merge clearance) for head Angles (two independent read-only reviewers, no cargo run by them; I verified their leads by test):
Resolution: Not done: the Local proof on the repaired code: Generated by Claude Code |
There was a problem hiding this comment.
Confirmed findings
- fixtures/binding_value_family_matrix/expected/check.json:45 — Avoid globally dropping
binding_predicate_non_claimwhenever infection is Yes. These goldens now remove the non-claim disclosure from findings whose operands are not resolved by the literal byte-length route, weakening the documented distinction between an unresolved operand and a bounded resolved one. Restrict the suppression to findings carrying the typed byte-length boundary and regenerate the matrix from that invariant.
Verification questions
- Confirm the new route admits only a closed free-function shape and requires exact literal arguments, but its owner-reference count is used as a completeness proxy for hidden aliases and macro-derived calls.
- Confirm the documented 64-row and 512-byte limits, plus straight-line detection of common branch/loop/closure forms, have no direct regression tests.
- Confirm the unresolved-value disclosure is suppressed for every infection-Yes finding, even when the infection authority came from a different mechanism than this new byte-length boundary.
Refuted
- The new route could hide an owner call through a hidden alias or macro and thereby create false credit.; refuted because: The route refuses the witness when owner-reference accounting does not match admitted rows; the seeded specification explicitly accepts residual macro-expansion incompleteness, so this is a bounded limitation rather than a demonstrated false credit.
- The literal byte-length row may capture a stale or resizable backing-store length.; refuted because: The analyzed shape accepts only an immutable Rust string literal, computes its UTF-8 byte length, and compares that bounded value with a decimal width. There is no ArrayBuffer, TypedArray, allocation, resize, detach, or transfer path in this Rust change.
- The PR introduces a JS-backed memory handoff across worker, async, GC, detach, or transfer boundaries.; refuted because: No JavaScript/TypeScript or worker-transfer code changed; the implementation is a synchronous Rust analyzer that retains typed test-call rows and does not perform GC, detach, ownership-transfer, or asynchronous handoff operations.
- The new byte-length parser could admit malicious string literals or call rows causing OOB, UAF, type confusion, or unbounded processing.; refuted because: The changed path uses AST-owned values, checked optionals, explicit row/byte caps, and conservative owner/primitive/reference gates; it does not dereference raw memory or perform unchecked indexing in the reviewed implementation.
- A related helper could credibly broaden this change to chars().count(), computed widths, aliases, or other string-length APIs.; refuted because: The accepted claim boundary is specifically one literal-owned byte-length operand; the implementation deliberately rejects unsupported expressions and the tests preserve conservative readings.
- Adding a synthetic owner-return flow sink broadly weakens the owner/completeness gate and could falsely credit unrelated changed bindings.; refuted because: The sink is admitted only after the closed owner AST proves one exact returned comparison, and it is consumed through the dedicated typed boundary route rather than as a generic equality fact.
- The new path introduces an unsafe lifetime or aliasing contract in production Rust code.; refuted because: The changed production module only parses owned Rust source strings and owns cloned PathBuf/String metadata. It introduces no native pointer, slice, unsafe block, or new borrow across calls; unsafe-review reported no new gaps.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
|
False-credit review (head as of 2026-10-25 ~16:00Z, read-only; not executed). BLOCKING (narrow): the credit ignores what the edit replaced.
Repro, same retained subject with a different old line: pub fn fits(text: &str, width: usize) -> bool {
- let end = text.chars().count();
+ let end = text.as_bytes().len();
end <= width
}with the retained ASCII test row The credited retained case ( Fix options: require Generated by Claude Code |
…is plain len() (#9637) Sweep finding: the gate read only probe.after, so chars().count() -> as_bytes().len() on fits("abc", 3) was credited exposed although both sides return true. Requires before == text.len(), adds the negative (fails without the check), narrows the unresolved-disclosure suppression to findings carrying this route's own derived-local fact, and restores the two binding goldens to main. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
|
Scoped queue coordination: your comment6399091178 places this candidate behind other ceiling PRs, but its exact position is not established in the public handoffs. #10317's migration47f77dd0 just passed required40207084965 and was invalidated by later Rust/Python scalar changes again. Requests6400148124 (#10275) and6400149057 (#10381) ask the retained queue owners to give the migration the next single integration/qualification/landing attempt, then release on landing or explicit abort. Please confirm this candidate's queued position and whether its owner agrees to defer the ceiling-changing landing through that one attempt, or identify a concrete priority repair. This is not a global freeze and silence is not agreement. Keep the existing proof/ownership reconciliation moving; do not bypass the unresolved initializer-discrimination review or infer replacement acceptance merely to clear the queue. No new writer, qualification dispatch or lifecycle change is requested. |
|
Queue position and agreement: this PR is entry 5 in On the unresolved initializer-discrimination review: the gate now requires the edit's old initializer to be plain Generated by Claude Code |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
|
Pushed Fixes against the blocking findings:
Local on this head: Generated by Claude Code |
|
Re-check at efe39a0: resolved. Generated by Claude Code |
|
The agreed migration boundary is now reached: #10317 landed at18:36:13UTC as e7d8d2d after required40218461054 passed on bed5b92. This releases this candidate's migration-specific deferral; #9746's separate time cap had already expired at18:30. The shared #10275/#10381 owner can apply this notice to both candidates. Continue under the existing owner and queue order, not as a simultaneous qualification wave. Integrate the landed per-language missed-credit acceptance files, preserve current scope/example locks, and regenerate exact accepted-versus-blessed identities for your actual composed change. Remove only the entries your proven credit improvement retires; do not restore numeric ceilings or treat old counts/green runs as proof of a new head. Re-review changed commits and preserve unresolved proof/custody limitations before one required qualification. No protection bypass, competing writer or new release/deployment is authorized by this coordination. |
…binding-predicate missed-credit entry Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
…fy too_many_arguments (#9637) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm the documented 64-row and 512-byte limits are not directly exercised by the new integration test.
- Confirm the 64-row and 512-byte resource bounds are specified but lack direct regression tests.
Refuted
- The route might evaluate or retain unsafe borrowed data while computing a byte-length witness.; refuted because: String literals are parsed and decoded into owned
Strings; byte length is computed from that owned value. The owner signature only reads an immutable&str, and no unsafe block, raw pointer, lifetime extension, or retained reference is introduced. - A literal row could observe a resized, detached, transferred, or stale backing-store view rather than the current literal contents.; refuted because: This diff contains no active-view, buffer, typed-array, resize, detach, or transfer machinery; Rust string literals are decoded into owned String values and their byte lengths are computed locally.
- Literal-length evidence crosses no worker, async, GC, detach, or transfer boundary; all data remains ordinary Rust-owned values used synchronously.
- The new literal-length row model may create a worker-handoff, async, GC, detach, or transfer-boundary defect.; refuted because: The changed code introduces no JavaScript runtime, worker, executor, thread, asynchronous task, GC-sensitive handle, detached resource, or ownership transfer. Typed rows are retained in owned Rust structures and synchronously inspected by the classifier.
- The unresolved-value disclosure is removed globally for infection-Yes findings.; refuted because: Rejected: suppression requires a matching binding-scoped derived literal-byte-length fact, while a unit test verifies another infection mechanism retains the disclosure.
- The route needs to be integrated into the general evaluator or persistent fact pipeline for correctness.; refuted because: The route is explicitly a diff-only refinement: existing activation, propagation, owner pinning, and oracle admission remain authoritative, while the new module supplies only the bounded typed rows and owner-return sink.
Parked follow-ups
- Owner-reference completeness and straight-line admission are conservative but still inherit documented reach limitations for generated or unindexed calls.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
assert!(true || !fits("abcd", 3)) was credited because the row sits in a
straight-line body; a call right of || or && in its statement may never run.
Also moves OwnerInputs above the doc comment it had split, and pins the
short-circuit and same-named nested fn shapes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
There was a problem hiding this comment.
Confirmed findings
- The specified 64-row and 512-byte limits lack direct regression coverage, leaving an explicit contract boundary verified by implementation rather than exercised tests.
Verification questions
- Confirm the documented resource bounds are present in source, but the changed integration test does not directly exercise the 64-row or 512-byte limits; this is a scoped evidence gap rather than a demonstrated false-credit bug.
- Confirm the documented 64-row and 512-byte bounds are implemented, but the integration suite does not directly exercise either boundary.
- Confirm the documented resource limits are implemented but not directly exercised by the added integration test.
- Confirm the specification states direct 64-row and 512-byte limits, but the new integration test has no direct boundary-size regression cases.
- Confirm the documented MAX_ROWS and MAX_LITERAL_BYTES boundaries lack direct regression tests.
Refuted
- The literal witness could be invalidated by resizing, detaching, transferring, or otherwise changing a backing-store view.; refuted because: The route does not retain or mutate storage. Rust string literals are decoded into owned String values and byte lengths are computed synchronously from those immutable values.
- The unresolved-value disclosure is globally removed for infection-Yes findings.; refuted because: The suppression checks for the route-specific derived-local fact, and the added unit test preserves disclosure for infection established by another mechanism.
- The route creates an exploitable denial-of-service through attacker-controlled input or unbounded work.; refuted because: The source explicitly caps admitted rows at 64 and each literal's source text at 512 bytes, and parses a closed function shape and literal arguments only.
- The byte-length route can retain a borrowed literal backing-store view across an async or worker boundary.; refuted because: No such boundary exists in the changed path: parser-produced string values are owned and length comparison is synchronous.
Evidence gaps
- The repository's own rip r sensor failed, leaving the analyzer's integrated self-check unavailable in this packet.
- Model proof intent was rejected by deterministic validation.
|
Head efa2cb3 fixes one real false credit found by a fresh agent review of 6651060: Local evidence on the pre-push head: Holding Generated by Claude Code |
There was a problem hiding this comment.
Confirmed findings
- Add focused regression cases for both stated resource limits, including acceptance at the boundary and rejection just beyond it. This is a scoped evidence gap, not a demonstrated false-credit defect.
- The PR claims bounded behavior for 64 rows and 512 literal bytes, but neither limit has direct regression coverage in the changed integration target; the boundary is therefore verified by inspection rather than an executable contract test.
- Documented resource bounds are implemented but not directly exercised, leaving off-by-one/resource-limit regressions unguarded.
Verification questions
- Confirm the 64-row and 512-byte contract limits are implemented but lack direct regression tests, leaving two explicit resource boundaries unverified.
- Confirm resource bounds reduce attacker-controlled row and literal size but are not directly boundary-tested in this PR.
- Confirm the route admits rows from exact literal calls but relies on reference counting as a completeness proxy; macro-expanded or otherwise hidden owner calls remain outside the proof boundary.
- Confirm the 64-row and 512-byte contract limits remain a scoped test gap.
- Confirm the stated 64-row and 512-byte resource limits lack direct regression coverage in the changed integration test.
Test proof
- Focused HEAD proof failed (exit 101):
cargo test --locked --package ripr --test agent_command_journey. This is a current failure, not a red/green witness.
Evidence gaps
- A late cargo-test receipt is pending; without it, the architectural integration claim is not fully witnessed on the composed head.
- The route's resource limits are specified but not directly exercised by the added integration test.
- Model proof intent was rejected by deterministic validation.
|
Review of record, head Angles: correctness (infection route, short-circuit guard), tests (stimulus and oracle grip), spec (RIPR-SPEC-0158), perf and security. Findings and resolutions:
Proof on this head: Not established: hosted 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! |
…fore a literal-length row runs (#9637) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
|
Review of record refreshed for head New since 34137a7: Devin's finding that an earlier Proof on this head: Generated by Claude Code |
There was a problem hiding this comment.
Verification questions
- Confirm the route's owner-reference count does not cover an independently maintained sibling route for literal byte length.
- Confirm resource limits are specified and implemented, but the changed integration target does not directly exercise acceptance at 64 rows or 512 bytes and rejection just beyond either limit.
- Confirm resource-limit contracts are not directly exercised by the changed integration test; this is coverage debt, not a demonstrated routing defect.
- Confirm the implementation and specification state 64-row and 512-byte limits, but the changed integration target does not directly test either boundary.
- Confirm the stated 64-row and 512-byte resource limits still lack direct acceptance/rejection boundary tests.
Refuted
- This Rust analyzer change necessarily introduces a JS-backed worker/async memory boundary.; refuted because: The PR changes Rust source, Rust tests, Rust specs, and fixtures only; there is no JavaScript/TypeScript source, JS runtime API, worker implementation, or async boundary in the diff.
- The active-view concerns involving ArrayBuffer/TypedArray semantics apply to this route.; refuted because: This is a Rust string-literal analysis route, not a JavaScript buffer or typed-array implementation; the relevant concern is only whether owned decoded text can change, which it cannot after capture.
- The implementation should be generalized into a sibling-path helper for computed or aliased string-length owners.; refuted because: The route explicitly defines a narrow byte-length leaf, while the PR body and SPEC-0158 exclude computed values, aliases, macros, and unsupported expressions from this authority; broadening would exceed the accepted claim.
- Could hidden aliases, macro-derived calls, or external documentation create a false exposure credit and therefore a security-relevant misclassification?; refuted because: The route requires exact literal arguments, owner pinning, complete explicit owner-reference accounting, primitive-name authority, and refuses external documentation or unsupported forms. Existing thread evidence also records prior false-credit findings as fixed and rechecked.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
Parked follow-ups
- The byte-length route is a closed owner-specific analysis rather than a reusable runtime helper; aliases, computed values, macros, foreign owners, and unsupported owner bodies deliberately remain conservative.
- Generated or macro-expanded calls are not proven complete by this route; the spec explicitly preserves that limitation.
…ken budgets (#9637) Follow-up to #10378's review: the 'not exposed' negatives now assert their exact class, and the 64-row and 512-byte limits are tested at and one past the boundary (both fail when the constants are raised by one). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU
…ken budgets (#9637) (#10430) Follow-up to #10378's review: the 'not exposed' negatives now assert their exact class, and the 64-row and 512-byte limits are tested at and one past the boundary (both fail when the constants are raised by one). Claude-Session: https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU Co-authored-by: Claude <noreply@anthropic.com>
Summary
Successor to #9715, rebuilt on current main. Credits
tokens-fits-binding-predicate: an immutable string byte-length local returned aslocal <= width, when the literal test rows separate the off-by-one mutants. #9715's branch was far behind main, untouched for hours, and had no successor lane. I could not and did not push to its branch.What changed relative to #9715's head 85d6197: the six commits are squashed onto main and reconciled with main's
LocatedValueFact/includes_external_docs_withAPIs and with #9731's literal folding. Thetext.chars().count()control in the integration test now asserts not-exposed and no byte-length fact. The route requiresprobe.beforeto be exactly<text>.len(), requires a straight-line test call, and bounds the rows (64) and literal size (512 bytes).infection_evidence_for_ownertakes the owner and its boundary as oneOwnerInputsargument. With #10317 landed, the missed-credit baseline is the per-rowfixtures/rust-verdict-corpus/missed-credit.toml, and this PR deletes thetokens-fits-binding-predicateentry because that row now credits.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Proposal: none; bounded implementation of the accepted #9637 repair route.
Spec: RIPR-SPEC-0157 and RIPR-SPEC-0158
ADR: none
Plan item: literal byte-length leaf of #9637
Governing issue or accepted claim: #9637 (parent #9619); partial, #9637 stays open
Acceptance delta (one sentence): Credit the literal string-byte-length boundary only with the same source call's admitted owner-return oracle, keeping wrong-row, wrong-owner, distant-input and unsupported-expression results conservative.
Candidate Relationships
Candidate branch: claude/9637-literal-byte-len
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): replaces #9715 (stale draft; its prerequisite #9628 has merged)
Acceptance retained from a replaced candidate (if any): #9715's design, tests and review evidence for the production source
Accepted winner and losing candidate disposition (when decided): this is the single live candidate; #9715 to be closed as superseded once this merges
Proof
cargo test -p ripr --test literal_length_boundarypassed on the pre-merge head;cargo xtask precommitpasses on 7549eb8 plus the OwnerInputs commit (clippy was the only failure on 7549eb8, from main's new argument plus this PR's).cargo xtask verdict-corpus check --language rust: 676 cases, false verdicts 3/676, no missed-credit note, with the entry removed.Claim boundary: only the byte-length leaf. Modulo, consts and other computed operands in #9637 are unchanged.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WJr6YizPnC777wfxAd9ubU