Skip to content

fix(rust): a boolean assert! in a dead context no longer credits a return-value finding (#10389) - #10445

Merged
EffortlessSteven merged 13 commits into
mainfrom
claude/project-thread-lpb3vw
Oct 25, 2026
Merged

EffortlessSteven merged 13 commits into
mainfrom
claude/project-thread-lpb3vw

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Before: a boolean assert!/debug_assert! in a context that never runs (after return, uncalled fn or closure, if false, impossible match arm, cfg!(any())) still credited a return-value finding. #10404 left that cell as a skip in the 264-row matrix.

After: the return family takes the same execution admission as the equality family for assert/debug_assert, and the matrix no longer skips the cell.

Why #10389 saw 6 corpus rows move: assert!(approx_eq!(f64, ..)) nests a macro in its operand, which the admission reads as MacroOperandExit ("may leave the test"). That refusal is an unresolved macro, not a dead context. The gate keeps the old return-family credit for that refusal only when all of these hold: the test carries only a plain #[test] attribute; the operand holds no exit token (return, break, continue, yield, ?); and every nested macro is a known pure comparison (approx_eq! from float_cmp; relative_eq!, abs_diff_eq!, ulps_eq! from approx), imported by name from its crate in the test file, with no local macro_rules! of that name. Every other refusal, and every other nested macro, withholds the credit. A second review found the first version of the carve-out let a local macro_rules! that returns, and non-#[test] attributes, slip through; both are now covered by tests.

Source-of-truth Links

Governing issue or accepted claim: #10389 (residual of #8983)
Acceptance delta (one sentence): Dead-context boolean assertions no longer credit return-value findings, and the matrix cell is no longer skipped.

Scope

  • classify/owner_pin.rs: add ReturnValue to the assert/debug_assert arm; the nested-macro carve-out (operand_holds_exit_token, nested_macros_are_known_comparisons).
  • tests/dead_context_assertion_admission.rs: drop the skip; add a test for live/exit/dead/local-macro/attribute nested-macro operands.
  • Corpus: 2 rows re-blessed, listed below. Rust missed_credit_ceiling is unchanged (both rows are partially_discriminated), so this does not enter the ceiling queue.

Moved rows (Rust corpus)

row before after why
lib-rstest-values-matrix-relational gap (weakly_exposed) limited #[rstest] with a #[values] matrix is not established as running (the equality family already refuses it; rstest_runs_body documents it)
idiom-seeded-loop-relational-bound gap (weakly_exposed) limited the assertion sits in a seeded loop, a conditional path

Both are within the case's acceptable verdicts (gap, limited); Rust false verdicts stay 3 (3/675 after main's new cases).

Proof

cargo test --locked -p ripr --test dead_context_assertion_admission   # 3 passed; matrix cell un-skipped
cargo test --locked -p ripr --lib owner_pin                          # 332 passed
cargo test --locked -p ripr --test owner_pin_execution               # 52 passed
cargo xtask verdict-corpus check-all                                 # 4 corpora, exit 0
cargo xtask precommit                                                # exit 0 on f85c522e

Claim Boundary

May claim: a boolean assert!/debug_assert! in a context ripr shows is dead (or otherwise not established) no longer credits a return-value finding, and a nested macro keeps credit only when it is a known pure comparison macro in a plain #[test]. Must not claim: that other nested macros (unknown, unresolved, user-defined) are proven to run; they now withhold credit. Module-level cfg gating around such tests is not separately tested. Establishing arbitrary macros (the issue's fuller fix) is left open.

Rollback

Revert the squash commit; two corpus rows return to their previous blessed state.

Spec-Test-Code Traceability

  • Tests: crates/ripr/tests/dead_context_assertion_admission.rs
  • Code: crates/ripr/src/analysis/classify/owner_pin.rs

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fp8NXWwUjH6mmCimsKAPes

…turn-value finding (#10389)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fp8NXWwUjH6mmCimsKAPes
…e reworded repair-route line (combined-tree drift on main)

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

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 181 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: beefaee3-f4b4-4683-870c-b8681656a9a5
Commits

Reviewing files that changed from the base of the PR and between 2e954f8 and 845b79b.

Files selected for processing: 10
  • changelog.d/10389-boolean-assert-dead-context-return-credit.md
  • crates/ripr/src/analysis/classify/owner_pin.rs
  • crates/ripr/src/analysis/classify/owner_pin/tests.rs
  • crates/ripr/src/analysis/language/rust/proximity_reach_tests.rs
  • crates/ripr/src/analysis/syntax/mod.rs
  • crates/ripr/src/analysis/syntax/owner_pin.rs
  • crates/ripr/tests/dead_context_assertion_admission.rs
  • docs/specs/RIPR-SPEC-0197-owner-return-pins.md
  • fixtures/rust-verdict-corpus/expected/rows/idiom-seeded-loop-relational-bound.json
  • fixtures/rust-verdict-corpus/expected/rows/lib-rstest-values-matrix-relational.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown
Contributor

merge-ready was requested, but this PR conflicts with main (head 25c383cd), so GitHub creates no test-merge ref and no qualification run can start. Merge main into the branch and resolve the conflicts, then remove and re-apply merge-ready.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fp8NXWwUjH6mmCimsKAPes
…son macros in plain #[test] tests (#10389)

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

@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 3 potential issues.

Devin Review

Copy link
Copy Markdown
Member Author

Review of record for head cc78c4e (diff since the first review: 4 commits).

Angles, each by an independent reviewer agent plus my own checks:

  • Correctness / false credit (twice): the first pass found dead contexts (uncalled nested fn, loop {}, if cfg!(any()), ? in an earlier macro) hidden by the function-level MacroOperandExit; fixed by keeping per-assertion verdicts and re-running them with the known comparison macros trusted (refusal_trusting_comparison_macros). The second pass ran 27 scratch crates (dead-context shapes, local macro_rules! shadows, #[ignore], let ... else, process::exit, async/closure/match-arm): no blocking defect. Its two residuals (inner or cfg-gated use of the same name) are fixed: any other or attributed use of the name now refuses.
  • Over-withholding: plain assert!(a == b) stays exposed; assert!(x > y), negated groups and grouped imports keep credit. Corpus check-all exit 0, Rust false verdicts unchanged (3).
  • Spec / contract: RIPR-SPEC-0197 updated (devin finding).
  • Performance: macro_rules name set and per-file imports now cached per index (devin finding).
  • CI on the earlier head: one lib test (proximity_reach_tests) assumed a weak assert! beside a custom macro still counted as an oracle; the new admission withholds it as assert_eq! already did, so the test now asserts the named assertion not credited evidence. Full ripr --lib 14638 passed locally.
  • The goldens check failure on 517ee1f is the main break from fix(python): treat a fixture renamed to caplog as an override #10444/fix(cli): define finding, unsuppressed, unknown, base-side and candidate line in the evidence legend (#9244 S5) #10426 crossing; this head carries fix(rust): refuse helper-chain forwarding through rebinding or opaque-macro wrappers #10351's byte-identical re-blesses of the two caplog fixtures.

Open bot threads: graphite unary-not, devin spec, devin perf (fixed, replied); devin fixture-compilability (not changed, replied). Ceiling unchanged. Merging after required CI is green on this head.


Generated by Claude Code

@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

  • The import parser accepts any tree beginning with the crate path and containing the macro name, so a valid grouped import is rejected while a path such as float_cmp::approx_eq::other may be accepted.

Verification questions

  • Confirm the integration matrix discriminates dead versus live assertion contexts, but it does not exercise a cfg-gated import of an otherwise known comparison macro.
  • Confirm the integration fixture imports float_cmp::approx_eq without declaring float-cmp, so the positive path is analyzer-only and cannot prove the macro import or invocation is valid Rust.
  • Confirm the macro-provenance oracle treats any same-named macro_rules! in the workspace as disqualifying, without testing that an unrelated macro in another file withholds credit as intended.

Refuted

  • The change introduces an unsafe worker handoff or JavaScript-backed lifetime crossing that requires detach/GC analysis.; refuted because: The diff contains no JavaScript runtime, worker handoff, GC-managed handle, native pointer, detach operation, or transfer boundary; it only updates Rust source-analysis state.
  • A stale backing-store view could make a cached macro import or definition set disagree with the source currently being classified.; refuted because: The changed values are memoized immutable BTreeSet snapshots scoped to a file or index; there is no mutable backing buffer, resize operation, detach, or transfer that could invalidate them.
  • The changed corpus rows indicate that the fix broadly grants return-value credit.; refuted because: The rows instead move to limited/static_unknown classifications, consistent with withholding credit where rstest matrices or seeded loops are not established as running.
  • The active-view lane found no changed ArrayBuffer, TypedArray, slice, allocation, or ownership-transfer surface relevant to resizable buffers.
  • The seeded review already established that the focused tests and corpus checks passed, so no oracle review is needed.; refuted because: Rejected as a permission to skip review, not as proof of oracle quality: the prior review addresses false credit and performance objections but does not close the uncovered import-provenance variants.

Evidence gaps

  • Final runtime verification is pending because the ripr sensor failed and the scheduled cargo-test receipt was not included in the supplied packet.
  • The two moved corpus rows are recorded as changed_since_labeling and one is abstained, so corpus consistency does not independently establish unchanged false-verdict behavior.
  • Model proof intent was rejected by deterministic validation.

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