Skip to content

feat(analysis): keep production-gap accounting invariant across assertion forms (#3284, S3 of #3213) - #3308

Merged
EffortlessSteven merged 2 commits into
mainfrom
analysis/3284-assertion-form-parity
Aug 17, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
analysis/3284-assertion-form-parity

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Production delta

Closes #3284 — S3 of #3213, governed by RIPR-SPEC-0154 (new, proposed): production-gap accounting is invariant across equivalent harness assertion forms.

  • Terminal Err-return guards credit as their assertion twins — if <lhs> != <rhs> { return Err(...) } in a test body constructs assert!(<lhs> == <rhs>) (and ==→!=, !expr→assert!(expr)) and runs it through the existing single classifier, so the guard carries exactly the kind and strength its assert form would. No parallel strength table. Wired into both the lexical scanner and the ra parser path so both adapters agree.
  • Three fail-closed gates (two from adversarial review): the Err return must be the body's first statement ({returnErr( — commented-out or string-embedded return Err( never credits); compound conditions with a top-level &&/|| stay unrecognized (their correct negation is not a single assert twin); opaque conditions (matches!, method calls, ordering) produce nothing.
  • The lexical path recognizes guards without consuming the block (review finding B1 — the first draft joined the whole if-body and silently swallowed real assertions inside it, a main regression on the fallback path): recognition uses the condition line plus a one-line peek.
  • Repo-mode probe seeding filters evidence-role owners — cfg(test)-module helpers inside production files were seeding repo findings through a probe path that never checked the owner's role (reproduced failing on main; production shapes still seed).
  • #[cfg(all(test, ...))] module members carry the evidence role like plain #[cfg(test)]; not(test)/any(test,..) stay production (pinned both ways).
  • Cache generations bump (FILE_FACT 0.3→0.4, CACHE 0.7→0.8, SHARDED, COMPACT with complete version-history comments) — TestFact assertions and repo seam content changed at package 0.10.0. The test-gated COUNT cache stays 0.2 (its envelope key embeds the outer version, so warm entries miss transitively).

Evidence delta

  • assertion_form_parity_assert_msg / _err_guard fixture pair: same owner, boundary value, and observable under the two equivalent forms — identical classification distribution, identical oracle kind/strength counts, identical evidence paths (verified distribution-equal; the expected outputs differ only in names, identity hashes, and the inherent 3-line length delta).
  • Reproductions verified failing on main: the guard oracle absence (unit level) and the repo-mode cfg(test) probe leak (integration level, real index).
  • In-crate pins: twin equality (kind + strength), opaque/commented/compound rejection, parser-path crediting through TestFacts, repo leak + production control, cfg(all)/cfg(not) roles.
  • Removal evidence: before the parser-path wiring, the fixture pair flipped classification (reachable_unrevealed vs weakly_exposed) — observed directly twice (pre-wiring and via a stale-cache replay of guard-blind facts, which is what motivated the cache bump).
  • Adversarial review (separate agent, eight challenge areas): both blocking findings (the block-swallow regression, the substring false-credit) repaired with gates + the peek-based rewrite; compound-condition rejection (its N1) also adopted; version-history comments completed; its N3 residual (test-second cfg(all(...)) spellings) documented as out of scope.
  • 4316 lib tests, workspace clippy clean, goldens check (zero drift — no existing fixture has an Err-guard in a test body, verified by grep), fixtures, dogfood, precommit, full policy battery green.

Acceptance matrix (#3284)

Acceptance Status
Equivalent forms → same inventory and gap count ✅ parity fixture pair, distribution-identical
Result/Ok/?/map_err/harness .contains create no obligations ✅ evidence-role filtering + repo probe filter
Adding a focused test can reduce gaps; plumbing cannot increase them ✅ harness shapes excluded from production inventory
Broad vs exact remain different ✅ classifier unchanged for recognized forms
Wrong-target / unrelated-strong stay non-crediting ✅ existing negative-control fixtures green
Production-source if/?/map_err stay ordinary subjects ✅ role filter keyed on owner role, not syntax
Opaque helpers stay limited ✅ gates pin unrecognized
Removal experiments fail ✅ fixture flip observed pre-wiring

Non-claims

Candidate head: 455a0f22 (base origin/main @ b5416cd6).

…tion forms (#3284)

RIPR-SPEC-0154 (S3 of #3213): terminal Err-return guards in test bodies
credit as their structural assert! twins through the single classifier —
parity by construction, no parallel strength table, no inference from
messages. Compound conditions and non-first-statement Err returns
(comments, strings) stay unrecognized, fail-closed. The lexical path
recognizes guards without consuming the block so assertions inside guard
bodies stay visible. Repo-mode probe seeding filters evidence-role
owners; cfg(all(test, ..)) module members carry the evidence role.
Parity fixture pair pins identical oracle, classification, and gap
accounting across the two equivalent forms; cache generations bump for
the changed facts and seams at package 0.10.0.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@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 Aug 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@EffortlessSteven, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 seconds

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e9a6974d-2dcc-4e42-908e-bfd7ae143715

📥 Commits

Reviewing files that changed from the base of the PR and between b5416cd and a33f375.

📒 Files selected for processing (28)
  • .ripr/traceability.toml
  • crates/ripr/src/analysis/extract/mod.rs
  • crates/ripr/src/analysis/extract/oracles/mod.rs
  • crates/ripr/src/analysis/extract/oracles/scan.rs
  • crates/ripr/src/analysis/probes/repo.rs
  • crates/ripr/src/analysis/rust_index.rs
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/src/analysis/syntax/ra.rs
  • docs/specs/README.md
  • docs/specs/RIPR-SPEC-0154-assertion-form-parity.md
  • fixtures/assertion_form_parity_assert_msg/SPEC.md
  • fixtures/assertion_form_parity_assert_msg/diff.patch
  • fixtures/assertion_form_parity_assert_msg/expected/CHANGELOG.md
  • fixtures/assertion_form_parity_assert_msg/expected/check.json
  • fixtures/assertion_form_parity_assert_msg/expected/human.txt
  • fixtures/assertion_form_parity_assert_msg/input/Cargo.toml
  • fixtures/assertion_form_parity_assert_msg/input/src/lib.rs
  • fixtures/assertion_form_parity_assert_msg/input/tests/pricing.rs
  • fixtures/assertion_form_parity_err_guard/SPEC.md
  • fixtures/assertion_form_parity_err_guard/diff.patch
  • fixtures/assertion_form_parity_err_guard/expected/CHANGELOG.md
  • fixtures/assertion_form_parity_err_guard/expected/check.json
  • fixtures/assertion_form_parity_err_guard/expected/human.txt
  • fixtures/assertion_form_parity_err_guard/input/Cargo.toml
  • fixtures/assertion_form_parity_err_guard/input/src/lib.rs
  • fixtures/assertion_form_parity_err_guard/input/tests/pricing.rs
  • policy/doc-artifacts.toml
  • pr-tmp/pr-3284-body.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

The Linux gate caught a byte-index panic when a guard compares a
multibyte operand: the twin-construction scans now iterate
char_indices so no slice ever lands inside a character. Pinned by a
multibyte guard test.
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Linux-gate panic fixed in a33f375: the guard twin-construction scanned bytes and sliced inside a multibyte operand. Both scans now iterate char_indices; pinned by a multibyte guard test (the exact CI panic shape). Full smoke suite green locally.

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.52941% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ripr/src/analysis/extract/oracles/scan.rs 97.71% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head review record — REVIEW_READY (author self-review)

  • reviewed_head_sha: a33f375b (base origin/main @ b5416cd6)
  • claim_boundary: test(rust): keep production-gap accounting invariant across equivalent harness assertion forms #3284 S3 / RIPR-SPEC-0154 — assertion-form parity + harness-role inventory exclusion; no match-arm/assert_cmd/stdout forms; no strength-table changes; no cross-surface projection
  • changed_surfaces_inspected: guard twin construction (three fail-closed gates: first-statement Err, compound-condition rejection, opaque rejection) on both scanner paths; lexical peek-based recognition (no block consumption); repo probe owner-role filter; cfg(all(test,..)) membership; cache generation bumps with complete history comments; parity fixture pair
  • wrong_behavior_challenge: both adversarial-review blockings (block-swallow regression — repaired with the peek rewrite + pinned; substring false-credit — repaired with the first-statement gate + pinned alongside the compound gate); repo leak reproduced failing on main; the Linux-gate multibyte panic fixed with char_indices scanning and pinned by the exact CI shape; fixture pair verified distribution-identical
  • rendered_behavior: goldens zero drift (verified no existing fixture has a test-body Err guard); parity fixtures byte-comparable modulo names/identity/length delta
  • proof_and_ci_observed: required check pass at this head; zero unresolved threads; local 4317 lib + 196 smoke tests, clippy, precommit, goldens/dogfood/fixtures, policy battery green
  • residual_assumptions: cfg(all(feature, test)) test-second spellings stay production (documented); match-arm Err returns and integration-output forms are later corpus slices; compound-guard twins rejected rather than logically negated (fail-closed under-emit)
  • disposition: REVIEW_READY

@EffortlessSteven
EffortlessSteven merged commit 96002f0 into main Aug 17, 2026
22 checks passed
@EffortlessSteven
EffortlessSteven deleted the analysis/3284-assertion-form-parity branch August 17, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(rust): keep production-gap accounting invariant across equivalent harness assertion forms

1 participant