Skip to content

feat(rust): credit #[test_case(.. => literal)] rows as the harness-compared return - #10734

Merged
EffortlessSteven merged 7 commits into
mainfrom
claude/test-case-arrow-spec
Oct 26, 2026
Merged

EffortlessSteven merged 7 commits into
mainfrom
claude/test-case-arrow-spec

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 lib-test-case-arrow-expected-value moves from limited to credited, with zero new false verdicts.

What changed

RIPR-SPEC-0231 gains rule 9 and decision 8: the test_case harness compares the value a function returns with the literal after =>, so a clean row is read as assert_eq!(<returned expression>, <literal>).

A function is read only when all of these hold (all or nothing per function):

  • the test's module imports test_case::test_case (the existing RIPR-SPEC-0197 trust);
  • every row argument before the arrow is a scalar literal filling one parameter;
  • every row has a plain literal after its one top-level arrow (integer, true/false, plain string);
  • the body is one returned expression with no statements, and the function is not #[should_panic] or #[ignore].

=> matches, => with, => panics, => it/is, computed expectations, characters, statement-bearing bodies and untrusted imports stay unread, exactly as before (unidentified, never a "has no assertion" gap).

Implementation: extract/test_case_arrow.rs synthesizes the oracle once; syntax/ra.rs and facts/parameterized_tests.rs attach it to the test fact; syntax/owner_pin.rs admits the same synthesis in the RIPR-SPEC-0197 gate and teaches test_case_runs_body the arrow form. The reveal, hidden-input and observation checks are unchanged, so the credited oracle goes through the same checks as a written assert_eq!.

Proof

  • crates/ripr/tests/test_case_arrow_expected_value.rs: 13 controls, each the credited twin with one thing changed. The review of record is in the first PR comment after the head.
  • Verdict corpus (Rust): 727 cases, 0 false verdicts, 0 contradictions. Exactly one row moved: lib-test-case-arrow-expected-value limited to credited. Its missed-credit.toml entry is deleted.
  • cargo xtask precommit passes.
  • Cache generations: full 1.113, sharded and compact 0.120, file facts 1.48 (past feat(syntax): expand macro_rules! test-table rows separated by => (#10298) #10559's 1.112 / 0.119). Boundary-gap snapshot commitments and receipt hashes follow the bump.

Not in this PR

=> matches, => with and friends stay unread. The SPEC-0360 call-in-term extension for shape-async-await-accumulate follows separately.

🤖 Generated with Claude Code

https://claude.ai/code/session_014rDKCvewzinJrP5bh5iuSY

…mpared return (#9619)

RIPR-SPEC-0231 rule 9: a clean arrow row reads as assert_eq!(returned, literal).
Nine twin controls; lib-test-case-arrow-expected-value credits, 0 false verdicts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rDKCvewzinJrP5bh5iuSY
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rDKCvewzinJrP5bh5iuSY
….119 / file facts 1.48)

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

Review in Change Stack →

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 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 192 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: 580b417e-5f51-4d2a-b523-05f74e98148e
Commits

Reviewing files that changed from the base of the PR and between 8ab0d39 and 0fffdcd.

Files selected for processing: 22
  • .ripr/traceability.d/9619-test-case-arrow-expected-value.toml
  • changelog.d/9619-test-case-arrow-expected-value.md
  • crates/ripr/src/analysis/extract/mod.rs
  • crates/ripr/src/analysis/extract/test_case_arrow.rs
  • crates/ripr/src/analysis/facts/parameterized_tests.rs
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/src/analysis/syntax/owner_pin.rs
  • crates/ripr/src/analysis/syntax/ra.rs
  • crates/ripr/tests/cache_clear_safety.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/README.md
  • docs/specs/RIPR-SPEC-0231-rust-oracle-kind-admission.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/lib-test-case-arrow-expected-value.json
  • fixtures/rust-verdict-corpus/missed-credit.toml
  • xtask/src/tests/rust_corpus_projection.rs

Summary by CodeRabbit

  • New Features
    • Improved analysis of Rust parameterized tests: clean #[test_case(... => literal)] rows can now receive credit when the test compares a function’s returned value with a supported literal.
    • Rows with unsupported expectations, ignored or panic-only tests, or non-matching function bodies remain uncredited.
  • Documentation
    • Updated the relevant rule and changelog examples to describe the new behavior.

Walkthrough

Eligible #[test_case(args => literal)] rows now produce return-value oracles in test analysis. The change updates parser-backed, parameterized-test, and owner-pin paths, adds integration coverage, advances cache schema versions, and updates the expected corpus verdict.

Changes

Arrow-row oracle admission

Layer / File(s) Summary
Define eligible arrow rows
crates/ripr/src/analysis/extract/*, docs/specs/RIPR-SPEC-0231-rust-oracle-kind-admission.md
The extractor recognizes integer, boolean, and plain string or char expectations in eligible arrow rows. It excludes ignored or should_panic functions and bodies that are not a single returned expression.
Integrate arrow-row oracles
crates/ripr/src/analysis/facts/parameterized_tests.rs, crates/ripr/src/analysis/syntax/{ra.rs,owner_pin.rs}
Test-fact and owner-pin analysis add eligible arrow-row oracles to their assertions. The rstest row path continues to reject arrow rows.
Validate behavior and update cache artifacts
crates/ripr/tests/test_case_arrow_expected_value.rs, crates/ripr/src/analysis/seam_cache.rs, crates/ripr/tests/{cache_clear_safety.rs,lsp_lifecycle/gap_corpus_currentness.rs}, xtask/src/tests/rust_corpus_projection.rs, docs/OUTPUT_SCHEMA.md, docs/specs/RIPR-SPEC-0231-rust-oracle-kind-admission.md, changelog.d/*, fixtures/boundary_gap/expected/*, fixtures/rust-verdict-corpus/expected/rows/*, fixtures/rust-verdict-corpus/missed-credit.toml
Integration tests cover admitted and refused rows. Cache schema values and related snapshots are updated. The arrow-row corpus case changes to credited, exposed, and ideal.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant TestCaseRow
  participant ArrowRowExtractor
  participant TestFactAnalysis
  participant OwnerPinAnalysis
  participant ObservationChecks
  TestCaseRow->>ArrowRowExtractor: provide attributes and function body
  ArrowRowExtractor->>TestFactAnalysis: return eligible arrow-row oracles
  ArrowRowExtractor->>OwnerPinAnalysis: provide row eligibility and oracles
  TestFactAnalysis->>ObservationChecks: submit assertions with extracted oracles
  OwnerPinAnalysis->>ObservationChecks: submit admitted assertions with extracted oracles
Loading
Merge Risk: Moderate · up to 8ab0d

Valid test-case rows can lose return-value credit when an attribute is spaced or paired with an unsupported row. Fix row parsing and independent admission before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 29.03% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 10 files. (9 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "feat(rust): credit #[test_case(.. => literal)] rows as the harness-compared return" matches the main change. The PR makes clean test_case arrow rows credited as assert_eq-style oracles on t…
Description check Passed The description follows the repository template in its main content. It names the governing issue (#9619) and gives a one-sentence acceptance delta. It describes the change, the admission rules, the i…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(rust): credit #[test_case(.. => literal)] rows as the harness-compared return" matches the main change. The PR makes clean test_case arrow rows credited as assert_eq-style oracles on the returned expression, as described in RIPR-SPEC-0231 rule 9. The title is specific and follows a conventional commit style. It is slightly long at 82 characters, but it still conveys the primary change.

Full details: Description check

Explanation

The description follows the repository template in its main content. It names the governing issue (#9619) and gives a one-sentence acceptance delta. It describes the change, the admission rules, the implementation files, and the proof run. It also lists non-goals. Several template sections are missing or left blank. These include the Swarm / Source Boundary checkboxes, the Candidate Relationships block, the Scope Classification checkboxes, the Support-tier Impact and Policy Impact selections, the Rollback section, the Spec-Test-Code Traceability list, the CI Economics section, the Engineering Check and Gates checkboxes, and the Static Language Check. The Proof section also lacks the exact commands run as a code block. The spec and proposal links are empty.

Resolution

The description is mostly complete, so this check passes. For a stronger record, the author could fill in these template sections: Swarm / Source Boundary selection, Candidate Relationships (state that PR #10734 has no stack parent or replacement, if that is true), Scope Classification and Support-tier and Policy Impact selections, Rollback, Spec-Test-Code Traceability (spec RIPR-SPEC-0231, test file, code paths), CI Economics (state whether workflows changed or use n/a), and the Proof commands in a code block. Checklist items for Gates and Engineering Check should be checked off or explained.

Full details: Docstring Coverage

Explanation

Docstring coverage is 29.03% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 10 files. (9 skipped: 9 unsupported.)

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 found an arrow row,
With literals in a tidy flow.
It checked the body, skipped the rest,
And marked the matching value test.
Fresh cache notes now join the show.

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

coderabbitai[bot]

This comment was marked as resolved.

…; spaced attributes; more controls (#9619)

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

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 0fffdcdf7

Two independent angles on the code at c1e62bf (since merged with main for the cache generations only), plus bot threads.

Correctness / false credit. 30 repros against the built binary. No confirmed blocker. Held fail-closed: renamed or shadowed attribute, local macro_rules! test_case, #[ignore = ..], #[should_panic(expected = ..)], cfg_attr ignore, cfg-gated function, bare async fn, mixed => matches/=> panics rows, non-literal arguments, a comment before the arrow, statement/return/if tails, constant tails (credit tracks a written assert_eq!), floats, raw and byte strings, escapes, ; "a;b" names, same-line functions. Concerns noted and handled: facts-layer trust is narrower than owner_pin's (the spec now says the admission is the gate, and the producer is all-or-nothing per function); duplicate oracles for equal literals (deduped); the oracle displays as a source assertion (cosmetic, left).

Tests / spec / perf. No blockers. Applied: one parse per function instead of per row (the early attribute check means non-arrow tests pay nothing, and owner_pin/ra.rs reuse the parsed Fn); spec rule 9 reworded to match the code; traceability fragment and README rule count; stale test_case_runs_body comment; controls for negative/suffixed integers, booleans, strings, ; "name" suffix, spaced #[test_case (..)], the crate-qualified path, a mixed readable/unreadable function and a character expectation. Dropped character literals from rule 9 because a written assert_eq!(f(x), 'c') earns no exact value either.

Bot threads. CodeRabbit whitespace finding fixed (c1e62bf) and replied. CodeRabbit per-row finding declined with reasoning (all-or-nothing is the recorded decision, pinned by a control) and resolved. Gemini and CodeRabbit later hit quota; that is missing provider review, not a clean one, and the two agent angles above stand in.

Proof on this head. Rust verdict corpus 727 cases, 0 false verdicts, 0 contradictions; exactly one row moved (lib-test-case-arrow-expected-value, limited to credited). cargo xtask precommit passes. Cache generations 1.113 / 0.120 / file facts 1.48 (past #10559's 1.112 / 0.119), snapshot commitments and receipt hashes regenerated. seam_cache (199), cache_clear_safety, cli_smoke (656), lsp_lifecycle, xtask corpus projection and the 13 arrow controls pass.

Nothing blocking. Hosted Ripr Rust Small Result is the remaining proof.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 26, 2026 19:03
@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 1 potential issue.

Devin Review

@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

  • Arrow-row synthesis recognizes attributes syntactically as test_case, while owner-pin separately requires the module's extern_crate_path_holds test_case trust; the two gates are not visibly coupled in the new per-attribute admission.

Verification questions

  • Confirm the public controls cover an entirely unimported function and a mixed readable/unreadable-row function, but not a trusted row combined with an unrelated untrusted test_case attribute.

Refuted

  • Cache-version updates could preserve stale ownership-sensitive facts and create an unsafe re-use path.; refuted because: The schema versions are bumped for full, sharded, compact, and file-fact caches, and corresponding tests/fixtures are updated; the changed behavior does not introduce memory-safety assumptions.
  • The change might read a stale or aliased mutable source buffer while extracting arrow expectations.; refuted because: The implementation repeatedly materializes owned attribute and body Strings and reads immutable RA AST nodes; it contains no mutation, unsafe code, buffer resize, detachment, transfer, or retained borrowed view.
  • The changed worker/cache handoff paths may retain or transfer mutable JavaScript-backed state across asynchronous boundaries.; refuted because: No JavaScript runtime, worker, async task, garbage-collected handle, detach operation, transferable object, or mutable cross-boundary state appears in the changed Rust analysis code or fixture data. Cache invalidation is represented by schema-version bumps.
  • A function containing both a readable literal row and an unreadable matcher row should still admit the readable row.; refuted because: This objection conflicts with the documented and tested all-or-nothing-per-function contract; the seeded thread confirms the choice was deliberate and the prior reviewer withdrew it.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • Full runtime confirmation remains dependent on the failed ripr sensor and the late cargo-test receipt.
  • Final executable verification is not represented by completed sensor receipts in the supplied packet.

Copy link
Copy Markdown
Member Author

Reply to the github-actions review at 0fffdcdf7.

Producer/admission coupling. The coupling is deliberate and the spec says where the gate is: the facts-layer synthesis is syntactic, and the RIPR-SPEC-0197 admission in owner_pin.rs (test_case_runs_body: extern_crate_path_holds(module, "test_case"), scalar-literal row arguments, parameter count, arrow_row_is_read) is the only place an oracle becomes creditable. A synthesized oracle with no Ok(()) entry in the function's assertion map reads as UnidentifiedTest, never as credit. an_unimported_test_case_attribute_is_not_trusted pins that, and the review agents' repros (renamed use .. as tc, a local macro_rules! test_case, cfg_attr ignore) all stayed uncredited.

Trusted row beside an unrelated untrusted attribute. Trust is per module, not per attribute, so there is no per-row mix to construct: every test_case attribute on a function resolves against the same module imports. A different path spelled test_case (#[other::test_case(..)]) is not is_test_case_path, fails runs_body_unchanged for that attribute, and refuses the whole function. I'm not adding a control for a state the grammar cannot produce.

The Evidence gaps lines about a failed sensor and a late cargo-test receipt describe the hosted run still in progress on this head; they are not findings about the change.


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