Skip to content

fix(classify): a helper returning its two parameters sinks its condition at the first branch (#6694) - #13169

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/parameter-branch-sink
Nov 5, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
claude/parameter-branch-sink

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #6694
Acceptance delta (one sentence): A private generic helper whose whole body is if cond { a } else { b } over two distinct parameters now has its condition as a return sink, so a boundary change tested through an exact forwarding wrapper reads exposed instead of propagation_unknown.

What was wrong

#6780 already established the wrapper-to-helper reach (RIPR-SPEC-0159) and paired the wrapper's exact pin with the helper boundary (RIPR-SPEC-0186): on current main the issue's capped / capped_score example reads reach yes, infection yes, discriminate yes, and still propagation_unknown. The residual named on the issue is owner-local: predicate_flow_sinks finds no value sink for if cap < value { / cap / } else { / value / } because next_branch_value only accepts branch lines that look like a call, literal or arithmetic, never a bare parameter name, and tail_if_branch_value only reads the one-line form.

Change

tail_if_parameter_branches (analysis/classify/flow.rs, called from predicate_flow_sinks) sinks the condition at the first branch value for the rustfmt tail form, fail-closed: the if is the helper's entire body (no earlier statement can rebind a parameter), the owner returns a non-unit value, the probe is that if condition, and both branches are bare, distinct parameter names of the owner (call_parameter_names). Literal, call, repeated or non-parameter branches keep the existing adjacency reading. No new validator: the sink feeds the existing propagation, pairing and oracle stages, so the exact-wrapper-pin requirement is still enforced where it was.

Proof

  • Unit: parameter_returning_tail_if_sinks_the_condition_only_when_whole_and_distinct (positive; statement before the if, same parameter in both branches, non-parameter branch, trailing statement, unit-returning owner all give no sink).
  • Real binary / public API (helper_wrapper_reach.rs): generic_helper_behind_a_constant_argument_wrapper_pairs now asserts exposed; parameter_returning_helper_is_exposed_only_through_an_exact_forwarding_wrapper has the positive plus negatives for a wrapper that transforms the argument (value * step()), a non-exact wrapper assertion (assert!(.. > 5)), and two helpers of the same name. Each is not exposed.
  • Verdict corpus: spot-cap-generic-via-wrapper moves limited to credited (its ideal verdict); it is the only row that moved. Its missed-credit.toml entry is removed, the case's hard_case text updated, and expected/ re-blessed. 330/330 spec examples, operator grid 21/21, overclaim 0/49.
  • cargo xtask goldens check, fixtures, precommit (includes clippy -D warnings), cargo test -p ripr --lib (17939 pass), helper_wrapper_reach (93 pass).
  • RIPR-SPEC-0186 behavior and test mapping updated; changelog fragment changelog.d/6694-parameter-returning-helper-sink.md.

Not run: the full Rust-only lane (--no-default-features --features lang-rust); the shared disk repeatedly filled during this work, and the last lane run on main already had an unrelated registered_proptest_profile failure.

The strsim generic_hamming / generic_jaro pilot seams from the issue use a different body shape and are not covered by this rule; the issue can stay open for them or be closed on the corpus case, a call for the reviewer.


Generated by Claude Code

…ion at the first branch (#6694)

A private generic helper whose whole body is if cond { a } else { b } over
two distinct parameters (capped(value, cap)) had no return sink for its
condition, so a boundary change tested through an exact forwarding wrapper
read propagation_unknown although reach, activation and the wrapper pairing
(#6780) were already established. The rustfmt tail form now sinks the
condition at the first branch parameter, fail-closed: the if is the whole
body, the owner returns a value, the probe is that condition and the
branches are distinct bare parameters. spot-cap-generic-via-wrapper now
credits.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNUoLUbb9AWcGogtEPEAMB
@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 Nov 5, 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 152 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: 08e578e6-5888-43fc-9181-7e920bfe6ae8
Commits

Reviewing files that changed from the base of the PR and between cfdb62e and 0002d74.

Files selected for processing: 7

  • changelog.d/6694-parameter-returning-helper-sink.md
  • crates/ripr/src/analysis/classify/flow.rs
  • crates/ripr/tests/helper_wrapper_reach.rs
  • docs/specs/RIPR-SPEC-0186-same-test-boundary-oracle-pairing.md
  • fixtures/rust-verdict-corpus/cases/spot-cap-generic-via-wrapper.json
  • fixtures/rust-verdict-corpus/expected/rows/spot-cap-generic-via-wrapper.json
  • fixtures/rust-verdict-corpus/missed-credit.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REVIEW_READY

Source review of head 0002d74. An independent no-stake adversarial pass found no blocking items: the new sink requires the probe to be the helper's sole if condition, a seven-line body with no earlier statement, a non-unit return, and two distinct bare parameter names. The listed shadowing and non-bare forms all fail closed. Tests carry negatives (statement before the if, repeated parameter, non-parameter branch, trailing statement, unit return, transforming wrapper, loose assertion, duplicate helper name) that would fail if the rule were over-broad. Only spot-cap-generic-via-wrapper moved in the verdict corpus.

Non-blocking: docs/PUBLIC_PROOF.md still shows the old row (advisory drift); no unit negative for "probe is not this if" (code-guarded). Local proof from the author: precommit, goldens, fixtures, verdict-corpus, lib tests, helper_wrapper_reach. Hosted exact-head proof pending.


Generated by Claude Code

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

ripr static exposure check

Commit 0002d748f618 · run · advisory, static evidence only (not a mutation run).

#ripr agent static-advisory base=cfdb62e56d53830fcf8bc12b8e37fd8741b1b67e findings=37 gaps=0 infection_unknown=2 static_unknown=25 weakly_exposed=10
stop=ripr cannot tell from reading the code whether tests would notice; nothing more is fixable from the test side
limits=infection_unknown:2,static_unknown:25,weakly_exposed:10

Took 57s.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bounded source review — 2026-11-05 UTC

  • reviewed_head_sha: 0002d748f6186eea39f9d53cc782ac0e18f39514.
  • integration_basis: PR base cfdb62e56d53830fcf8bc12b8e37fd8741b1b67e; authored patch and candidate source reviewed. No newly executed integration qualification.
  • claim_boundary: #6694 multiline whole-helper parameter branch sink only; strsim bodies excluded
  • changed_surfaces_and_semantic_owners_inspected: Read complete 7-file diff, flow.rs predicate_flow_sinks and propagation functions, helper_wrapper_reach added controls, SPEC0186 and verdict row. Whole-body/line/identity/distinct-parameter gates prevent statements and repeated arms from this path. New positive class expectation would fail old missing-sink behavior; wrapper negatives retain lower classifications. Body-mutating conditions and sink pairing beyond supplied cases not executed.
  • blocking_findings: No additional actionable source finding established in this bounded review. Existing blockers and draft constraints retain their recorded scope.
  • non_blocking_suggestions: None added.
  • refuted_or_stale_findings: Existing thread dispositions retained; any specific repaired or refuted case is described in the inspection above. No thread is resolved by this review.
  • proof_and_ci_observed: Immutable source and changed tests inspected. No native tests, hosted job logs or artifact qualification independently executed/inspected in this pass.
  • proof_or_review_missing: No workspace Cargo tests, complete golden suite, hosted job logs/artifact receipts, or full integration qualification independently executed/inspected by this reviewer. Existing author and bot reports retained as reported only. No REVIEW_READY claim.
  • affected_currentness_dimensions: This record binds source inspection to the head above. It does not establish fresh base-composition, hosted execution, package, release or cross-platform qualification.
  • residual_assumptions_and_non_claims: Source/test reading and historical author reports are not additional test executions. No merge-readiness approval is implied.
  • disposition: REVIEW_INCOMPLETE; no new actionable source finding in the stated inspection.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REVIEW_READY

Final source review of head 0002d74, superseding the earlier bounded REVIEW_INCOMPLETE on this head (that pass inspected source only and found no actionable finding). Two independent no-stake source passes found no blocking items on the whole-helper parameter-branch sink. Hosted exact-head jobs (gates, 4 test shards, goldens, fixtures) have now run on this head; the only failure was the review-disposition recheck reading the stale incomplete review. Non-blocking: docs/PUBLIC_PROOF.md drift (advisory).


Generated by Claude Code

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REVIEW_READY

Final source review of head 0002d74. Two independent no-stake passes found no blocking items in the whole-helper parameter-branch sink; the fail-closed gates and negative tests were read and hold. Non-blocking: docs/PUBLIC_PROOF.md drift (advisory). Hosted exact-head jobs have run on this head.


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