Repository navigation
fix(rust): bound derived tuple projection evidence at direct returns - #4068
EffortlessSteven merged 11 commits into
Conversation
|
Warning Review limit reachedNext included review available in 59 seconds. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (15)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the top_level_projection_observes function to enforce that projections are observed before a function returns. It introduces a boundary check using return statements to ensure that observations occurring after a return are ignored, preventing incorrect certification of code arms. Additionally, comprehensive unit tests were added to verify this return boundary behavior and ensure that unreachable assertions do not incorrectly certify arms, while valid observations preceding a return are correctly handled. I have no feedback to provide as there were no review comments.
EffortlessSteven
left a comment
There was a problem hiding this comment.
Author source review — REVIEW_INCOMPLETE
Reviewed head: fa2ef59aba70eafcfb49e0eee0f3be49d30c5841
Integration basis: e839ba25179e5770bdb263fc4f95692637160852; GitHub currently reports test-merge f7cc19544652a9dc3686fb22145c0e9b0f26d988.
Claim and inspected surfaces. Read the complete three-file patch, the projection admission helper, tuple dispatch/direct-oracle restrictions, its shared consumer in tuple_match_derived.rs, and the existing public fixture/changed-arm selector. The change bounds assertion collection at the first direct top-level return without truncating the full-body uniqueness or shadowing authorities.
Wrong-behavior challenges retained. The new matrix places return before the input, owner, or each observation in every assertion order. Separate controls cover complete observation before return, nested uncalled scopes, literal/comment mentions, and duplicate owner calls after return. Public tests require exactly the changed current arm, an explicit WeaklyExposed/observation_unverified result for missing observations, and an Exposed positive. Parse failure cannot satisfy the unit negatives. These are inspected test intentions, not executed results.
Evidence observed. Candidate blob identities match; git diff --check and reverse-patch applicability pass; existing test blocks are unchanged. The first hosted run stopped before compilation on two signature-formatting differences. This head applies exactly that reported delta. Current-head run 36123909698 was still in progress when checked. CodeRabbit reported quota exhaustion; Gemini supplied a no-findings summary. Neither establishes the outstanding native proof. No inline review threads were present when checked.
Acceptance blockers. Current-head Rust compilation and test results; an executed boundary-removal red control with tests retained; the corresponding RIPR-SPEC-0108 corpus case and gate; completed proof-backed review. No additional source defect was established within this bounded delta.
Residual scope. Conditional/nested exits, diverging calls, and macro expansion remain outside this claim. This is static evidence admission, not runtime mutation-kill proof. No merge or auto-merge readiness is asserted.
EffortlessSteven
left a comment
There was a problem hiding this comment.
Evidence refresh on published head a8daf45-equivalent review (draft; no merge attempted):
Inspected changed surfaces:
- crates/ripr/src/analysis/classifier/evidence/tuple_match/derived_admission.rs (+26/-1): computes observation_end at first direct ReturnExpr statement; owner at/after boundary returns Some(false); observation scan takes observation_end.
- crates/ripr/src/analysis/classifier/evidence/tuple_match/derived_admission/return_boundary_tests.rs (new, unit tests).
- crates/ripr/tests/match_arm_tuple_derived_local.rs (new integration-style tests, +37).
Risks considered:
- Return-boundary narrowing could under-credit a tuple projection observed legitimately after an early return in a different branch. Mitigated: boundary only truncates the observation scan, binding/owner scans unchanged, and owner-position guard returns explicit false rather than unknown.
- ExprStmt/ReturnExpr shape check is AST-version-sensitive; acceptable within pinned ra_ap_syntax.
Repo invariants checked:
- Conservative-language posture preserved: change demotes over-credit toward explicit false, consistent with identity-not-tokens bias.
- No output-contract, schema, or public-API surface touched (classifier internals + tests only).
Validation signals (published head):
- Required gates green: Rust-gates, fixtures-gates, required-checks green; 0 unresolved threads.
Residual assumptions:
- Did not run the two new test files locally in this pass; green required CI is the oracle.
- Whether truncation at the first direct return matches intended semantics for multi-branch test bodies is a product-semantics question for the author.
Disposition: REVIEW_READY on evidence, merge held solely because the PR is draft. Flip to ready when the author confirms the semantics.
…260925 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ui933un54X4MJRygfjwdjW
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ui933un54X4MJRygfjwdjW
EffortlessSteven
left a comment
There was a problem hiding this comment.
Exact-head review (review-pr), author-side COMMENT
reviewed_head_sha: 1a53483b0e0e539e0dee2c6d34e2c4937b082fad
integration_basis: origin/main merged in at 5c9f81dc2 (clean; the branch was 75 commits behind)
claim_boundary: the derived tuple-arm projection admission (`top_level_projection_observes`) stops collecting assertions at the containing test's first direct top-level `return` statement, and rejects an owner call placed after it. Related to #3769 and #3807. This is not a support-tier promotion and not general control-flow reachability.
Blocking findings: none.
Surfaces inspected
tuple_match/derived_admission.rs:observation_endis the index of the first top-levelExprStmt(ReturnExpr). The owner-uniqueness and shadowing scans still read the whole body, which is conservative. An owner at or after the boundary givesSome(false), and the assertion loop is bounded bytake(observation_end). Both consumers, derived admission and derived discrimination, call this one helper, so there is no forked validator.- Nested scopes (
|| { return; }, a localfn), comment text and string literals do not move the boundary, because only direct statements are inspected and the scan is syntax-based, not textual. - A tail-expression
return(no semicolon) is not instatements()but is by definition last, so it cannot hide later assertions. - Actionability direction: the change can only turn
Some(true)intoSome(false). A finding can move fromExposedtoWeaklyExposed/observation_unverified, never the reverse, so it fails closed.
Simplification in this push: the boundary predicate is folded into one matches! with a guard. No behavior change; tuple_match lib tests 21/21.
Oracle and mutation challenge (run locally, toolchain 1.95.0)
- Revert (boundary disabled:
observation_endforced tostatements.len()):projection_return_boundary_requires_every_observation_before_returnFAILS (return position 0 ... left: Some(true), right: Some(false));- the public-API test
projection_return_boundary_unreachable_assertions_cannot_certify_the_armFAILS (the arm is certifiedExposedpast areturn;).
- Head:
cargo test -p ripr --lib projection_return_boundary3/3;cargo test -p ripr --test match_arm_tuple_derived_local16/16. The positive controlprojection_return_boundary_after_complete_observation_preserves_exposurekeepsExposed.cargo xtask precommitpasses, including clippy-D warnings.
Non-blocking suggestions and open author items
- The PR body's own checklist asks for a RIPR-SPEC-0108 honesty-corpus member for this false-promotion case. It is not added here. The unit and public-API regressions carry the proof for this head, and a corpus member would add an independent-invariant guard against a future re-bless. I recommend it as a follow-up.
- Conditional or nested exits, macro expansion and diverging calls are out of scope, as the PR states.
Exact-head CI: fresh run on this SHA: Rust gates success (run 36306557924), plus Ripr Rust Small Result, cargo-deny, dependency-review, pr-plan, ub-review and GitGuardian success. Lanes skipped by label routing are not engaged.
Missing review: Gemini (quota), CodeRabbit (rate limited) and Devin (credits) review is missing, not clean.
Disposition: REVIEW_READY (a COMMENT record; the author cannot approve).
Generated by Claude Code
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a53483b0e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm nested closure/local-fn returns and comment/string literals must not advance the boundary.
- Confirm negative-case corpus pinning to RIPR-SPEC-0108 honesty gate not yet done; Devin flagged it on match_arm_tuple_derived_local.rs:699.
- Confirm unit tests have no spec-test-code mapping; Devin flagged absence of explicit mapping to a spec requirement or explained omission.
- Confirm author PR body explicitly marks disposition REVIEW_INCOMPLETE pending cargo test red-control, runtime-confirmed false-promotion corpus addition (RIPR-SPEC-0108), and substantive exact-head review. No native proof yet. Reviewer concurrence must not substitute.
- Confirm pR is still in draft with disposition REVIEW_INCOMPLETE and authoring environment lacks a Rust toolchain, so local runtime proof is impossible; rely on hosted CI receipt referenced in PR body.
Parked follow-ups
- Boundary detection is AST-version sensitive: only direct top-level ReturnExpr statements bind observation_end. Nested returns (closures, fns), comment text, and string literals are correctly excluded by the ExprStmt/ReturnExpr shape check.
Evidence gaps
- Devin flagged missing spec-test mapping; author replied only on corpus pinning.
- Model proof intent was rejected by deterministic validation.
- Red control (new tests pass with the production boundary removed) is unexecuted; the PR body explicitly states the unpatched failure is source-derived only.
- Hosted Rust run on 1a53483 still in progress; cargo test execution has not produced a receipt that overrides the author's source-only validation.
…ection-return-boundary-20260925
…o RIPR-SPEC-0093 The return-boundary unit tests and public-API witnesses decide whether a MatchArm probe keeps the RIPR-SPEC-0093 observation_unverified downgrade or earns the derived tuple-arm exception, so register them and the derived_admission owner under that behavior (Devin review thread). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyH6Ya3zZA8atiNCVFyUub
…ection-return-boundary-20260925
…ectory `same_current_file` joined the probe location onto the canonical authority root. Probe locations are already `--root` as given joined with the changed path, so a relative root with a directory prefix (the fixture runner's `--root fixtures/<name>/input`, or `ripr check --root sub/dir`) resolved to `<root>/<root>/src/...`, failed, and silently skipped the derived tuple-arm admission. Absolute and `.` roots were unaffected. - canonicalize the probe location directly - public-API witnesses under a nested relative root: the positive control earns `exposed` (fails without the fix) and the return boundary holds - graduate the #4068 return-before-assertion false promotion into the RIPR-SPEC-0108 honesty corpus via fixture match_arm_tuple_derived_return_before_assertion (weakly_exposed); the fixture golden drifts to `exposed` with the derived_admission return boundary reverted, and a re-bless is rejected by the honesty gate - traceability under RIPR-SPEC-0093; `goldens check` and `fixtures` show no other golden moved Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyH6Ya3zZA8atiNCVFyUub
EffortlessSteven
left a comment
There was a problem hiding this comment.
Exact-head review of 40c36be (review-pr), disposition: REVIEW_READY once CI is green on this head.
Inspected:
- The original change:
derived_admission.rsbounds derived tuple-projection evidence at a direct return, so assertions afterreturn;no longer promote the arm toexposed. - The new fix in
tuple_match_derived.rs::same_current_file: probe locations are built as--rootas typed joined with the changed path (probes/diff.rs), so they already resolve from the working directory. The old code joined them onto the canonical root a second time. That worked only for an absolute root or., and a root with a directory prefix (--root ctl) silently lost the tuple-arm admission. The owner path join on the line above is correct, because owner files are root-relative. - Oracles:
relative_prefixed_root_keeps_the_derived_arm_admissionfails on the old line. It needs a nested workspace, because at equal depth the old bug resolves by coincidence.relative_prefixed_root_keeps_the_return_boundarykeeps the #4068 boundary under a relative root.- The new corpus case
rust_tuple_derived_return_before_assertion_no_promotiondrifts toexposedincargo xtask fixtureswithderived_admission.rsreverted, and the honesty gate rejects a re-bless of that drift.
- Golden impact:
goldens checkand the fullfixturesrun show 0 drift across 588 comparisons. The only new golden is the added fixture. - The corrected thread replies strike the earlier wrong cause.
Residual: probe_file.canonicalize() depends on the process working directory, which is the same assumption the probe path's construction already makes.
Outside review: Gemini out of quota, Devin out of credits, droid-review queued; that review is missing, not clean.
Generated by Claude Code
Summary
The derived tuple-arm admission helper scans top-level assertions after the owner call but skips
return;as a non-macro expression. Source inspection shows that assertions after the containing test has returned can still supply cardinality, receipt identity, and relation evidence.Bound
top_level_projection_observesat the first direct top-levelReturnExpr. Reject an owner call beyond that boundary and stop collecting assertions at it. Preserve the existing whole-body owner-uniqueness and shadowing checks. Complete observation before a later return still qualifies. Both derived admission and derived discrimination consume this one helper.Related: #3769, #3807. This is a focused correctness follow-up, not closure of either parent or a Rust support-tier promotion.
Regression coverage added
WeaklyExposedwithobservation_unverified; a return after complete observation must preserveExposed.Validation and acceptance
Candidate:
fa2ef59aba70eafcfb49e0eee0f3be49d30c5841Base:
e839ba25179e5770bdb263fc4f95692637160852Source-only checks completed: exact source blob identity verification;
git diff --check; reverse-patch applicability; existing test-block preservation; full published diff inspection. No local Rust compilation, rustfmt, or tests ran: the authoring environment has no Rust toolchain. Source checks are not runtime proof.Hosted Rust run
36123546493on the previous candidate stopped at formatting, reporting only brace placement in the two new integration-test signatures; compilation and tests were skipped. Commitfa2ef59applies those exact rustfmt corrections. Current-head Rust run36123909698is in progress; its native checks are not yet established.Required before acceptance:
cargo test -p ripr --lib projection_return_boundary --locked.cargo test -p ripr --test match_arm_tuple_derived_local --lockedand the applicable exact-head repository checks, including formatting.Disposition: REVIEW_INCOMPLETE. No merge or auto-merge requested.
Scope and rollback
This handles direct top-level return statements only. It does not establish general control-flow reachability, conditional/nested-exit handling, macro expansion, or diverging-call analysis. Static exposure remains distinct from runtime mutation killing. No dependency, schema, workflow, release, tag, or publication change. Before merge, close this draft unmerged to abandon the candidate; after merge, revert this focused change without rewriting history.