Skip to content

feat(rust): credit a loop accumulator whose update adds a called function's value - #10784

Merged
EffortlessSteven merged 4 commits into
mainfrom
claude/spec-0360-call-in-term
Oct 26, 2026
Merged

EffortlessSteven merged 4 commits into
mainfrom
claude/spec-0360-call-in-term

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #9619
Acceptance delta (one sentence): The verdict-corpus row shape-async-await-accumulate moves from limited to credited, with zero new false verdicts.

What changed

RIPR-SPEC-0360 gains the call term: acc += callee(x) or callee(*x), with an optional .await and one optional + - * / % with a decimal integer literal (t += double(*x).await * 1). An async owner now has the accumulator shape, but only through a call term. Tracks #9478.

The call's value is read by evaluating the callee, never assumed. The pinned run is credited only when:

  • exactly one function of that name exists, a free function in the owner's file, named once in the owner (a parameter of that name would shadow it), with one plain identifier parameter of the same built-in integer type it returns (the owner's type, at most 64 bits), and a body that is one arithmetic expression of the parameter and decimal literals, every step in range;
  • the run's literal elements, folded through the callee and the written update, give the pinned nonzero value;
  • every neighbouring mutant gives a different value or panics: the opposite sign, |=, ^=, overwriting (the last element), and for a term with an operator each other of + - * / %. * 1 and / 1, + 0 and - 0 are the same function, so they are equivalent, not a gap.

*= /= %= &= stay zero from the zero start, which differs from a nonzero pin.

Anything ripr cannot read (a second definition, a statement body, a call, a cast, a different return type, a shadowed name, a fold that misses the pin, a run where a neighbour coincides with the written update such as one element of a +=) is static_unknown. It is never credited. A call term is never reported as a gap, so a smoke call is withheld too.

Implementation: syntax/loop_accumulator.rs reads the term; classify/owner_pin/call_term_fold.rs evaluates it; owner_pin.rs routes a call term to that evaluator instead of the plain nonzero credit; closure_adaptor::pinned_run_accepts generalises the per-run judgment; pinned_shape.rs withholds an uncredited call term instead of reporting a gap; propagation_witness.rs binds the update to the returned local by name (a .await dot was read as a qualified path, so no async accumulator ever had a complete witness).

Proof

  • crates/ripr/tests/loop_accumulator_call_term.rs: 13 controls. Positives are the async credited twin, a sync twin, a signed -= and a run the operators do not share. Negatives assert the withheld verdict: a total the callee does not give, one element, an empty and a zero pin, eight callee shapes, a duplicated callee, a parameter that shadows the callee (fails with the check removed), a coinciding term operator, a |= coincidence, a smoke call, shapes outside the call term, and an async owner without a call term.
  • Verdict corpus (Rust): 733 cases, 0 false verdicts, 0 contradictions, traps credited 0/43. Exactly one row moved: shape-async-await-accumulate limited to credited. Its missed-credit.toml entry is deleted.
  • Lib tests 15048 passed; cargo xtask precommit passes. The review of record is in the PR comments.
  • Cache generations: full 1.114, sharded and compact 0.121, file facts 1.49. Boundary-gap snapshot commitments and receipt hashes follow the bump.
  • Also carries the branch-miss control from feat(rust): credit #[test_case(.. => literal)] rows as the harness-compared return #10734's review (a row whose input misses the changed branch earns no credit from its siblings).

Residuals

  • sum += weigh(w) owners are now a return_value probe where they were an unmapped static_unknown; an uncredited one is withheld, never a gap.
  • Panic counts as a kill (overflow checks assumed). Mutants that replace the call with a constant, and mutants inside the callee body (its own line's probe), are not modelled.

🤖 Generated with Claude Code

https://claude.ai/code/session_014rDKCvewzinJrP5bh5iuSY

…tion's value (RIPR-SPEC-0360, #9478)

Reads `t += callee(*x)[.await] [op literal]` over a zero-initialized returned
local, async owners included, and credits it only when an exact pin's literal
run, folded through the evaluated callee, gives the pinned nonzero value and
every neighbouring mutation gives a different one. Moves
shape-async-await-accumulate from limited to credited; 733 cases, 0 false.
Cache 1.114 / 0.121 / file facts 1.49.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rDKCvewzinJrP5bh5iuSY
@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 26, 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 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 176 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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: e4a92e46-aeba-4149-ba8f-c18455830f66
Commits

Reviewing files that changed from the base of the PR and between 0bab2dc and 83943c0.

Files selected for processing: 23
  • .ripr/traceability.d/9478-loop-accumulator-call-term.toml
  • changelog.d/9478-loop-accumulator-call-term.md
  • crates/ripr/src/analysis/classify/owner_pin.rs
  • crates/ripr/src/analysis/classify/owner_pin/call_term_fold.rs
  • crates/ripr/src/analysis/classify/owner_pin/closure_adaptor.rs
  • crates/ripr/src/analysis/classify/pinned_shape.rs
  • crates/ripr/src/analysis/classify/propagation_witness.rs
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/src/analysis/syntax/loop_accumulator.rs
  • crates/ripr/tests/cache_clear_safety.rs
  • crates/ripr/tests/loop_accumulator_call_term.rs
  • crates/ripr/tests/lsp_lifecycle/gap_corpus_currentness.rs
  • crates/ripr/tests/test_case_arrow_expected_value.rs
  • docs/OUTPUT_SCHEMA.md
  • docs/specs/RIPR-SPEC-0360-rust-loop-accumulator-update.md
  • fixtures/boundary_gap/expected/CHANGELOG.md
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/after.repo-exposure.json
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/agent-receipt.json
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/agent-verify.json
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/before.repo-exposure.json
  • fixtures/rust-verdict-corpus/expected/rows/shape-async-await-accumulate.json
  • fixtures/rust-verdict-corpus/missed-credit.toml
  • xtask/src/tests/rust_corpus_projection.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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

…r a call term, tighten the call-term controls (#9478)

Review of record found a callee name shadowed by a function-pointer parameter
was evaluated as the same-named function (false credit). The callee must now
be named once in the owner and be a free function. A call term that is not
credited is withheld, never a gap. Controls assert the withheld verdict and
add shadowing, signed subtraction, |= coincidence and smoke-call cases.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rDKCvewzinJrP5bh5iuSY

Copy link
Copy Markdown
Member Author

Review of record, head 83943c0.

Angles: (1) adversarial soundness of the fold and gate, (2) tests, spec and consumer parity. Two independent read-only passes plus the Devin findings.

Findings and resolutions:

  • False credit (fixed): a callee name shadowed by another owner parameter (one: fn(u32) -> u32) was evaluated as the same-named function. The callee must now be named once in the owner and be a free function. New control a_parameter_that_shadows_the_callee_is_not_evaluated_as_the_function fails with the check disabled. Devin raised the same case.
  • Gap for an unread callee (fixed): a call term not credited by an exact pin (a smoke call, an unreadable pin) could have reported weakly_exposed for a callee ripr never read. It is now withheld as static_unknown; control a_smoke_call_never_reports_a_gap_for_a_callee_ripr_did_not_read.
  • Spec/code mismatch (fixed): the one-element claim was too broad (a signed -= on one nonzero element separates every neighbour); spec, Acceptance 8 and the changelog now state the coincidence rule. The spec also now states the equal parameter and return type, plain identifier parameter and free-function conditions, the no-gap rule, and the overflow-checks assumption.
  • Weak negatives (fixed): the withheld controls assert static_unknown with an unresolved limit, not just "not exposed"; the return-type control isolates one condition; added signed -=, |= coincidence, generic and mut parameter callees.
  • Gates (fixed): the hosted check-no-panic-family failure on d014bfc was an expect in a unit test; removed.
  • Dead dereferences field removed.

Not changed, by decision: fold treats a panic as a kill, which assumes overflow checks (stated in Known Limits, same as the plain accumulator). Mutants that replace the call with a constant are not modelled (stated).

Evidence on this head: cargo xtask precommit green; lib tests 15048 passed; loop_accumulator_call_term 13, loop_accumulator_pin 18; Rust verdict corpus 733 cases, 0 false verdicts, no drift. Hosted CI re-running (merge-ready re-applied).


Generated by Claude Code

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