Skip to content

fix(classify): a changed condition hidden behind an absorbing literal min/clamp has no value sink (#10875) - #11730

Merged
EffortlessSteven merged 9 commits into
mainfrom
claude/10875-clamp-min
Oct 31, 2026
Merged

EffortlessSteven merged 9 commits into
mainfrom
claude/10875-clamp-min

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #10875
Acceptance delta (one sentence): let r: u32 = if n == 5 { 1 } else { 0 }; r.min(0) (and .clamp(L, L)) no longer reads exposed through the returned value but reads a named propagation limit, with a runtime-labelled not_discriminated corpus case.

Rule (fail-closed, new owner classify/absorbing_tail.rs, called from classifier/evidence.rs)

Body half: straight-line let statements plus one tail <r>.min(0) (unsigned return type) or <r>.clamp(L, L) (any primitive integer); r is read only by that tail; its let is if <changed comparison> { int literal } else { int literal } on the probe line; plain primitive return type, no fn generics, no nested items. (An untyped let r = ..; r.min(0) does not compile, E0689, so positives annotate the binding.)
Workspace half (needs workspace_complete): no indexed source holds no_implicit_prelude, no_core, include!, fn min/fn clamp, a type/struct/enum/union/trait/mod named as the primitive, a use/extern crate ... as <primitive>, or a macro_rules! body declaring an item by computed name (fn $n, type $n, ...).
Method spelling alone is never the evidence: a real #[no_implicit_prelude] crate with its own min returns the receiver and makes the condition observable (checked with rustc).

Limits (named)

  • The changed condition is not established as pure (index, overflow, panic, side effects). The result only demotes the finding to propagation_unknown; it never credits or flags a gap.
  • A substituted std/core package or ambient RUSTFLAGS changing the effective prelude is not authenticated by the index. Reviewer decision needed on whether that residual is acceptable.
  • The non-equivalent witness let cap = n / 6; ... r.min(cap) stays exposed (a known missed advisory), not misjudged.

Verification (head 41af688)

  • Reproduced before: f read exposed with sink r.min(0). After: propagation_unknown; r.min(cap) unchanged exposed.
  • Unit tests in absorbing_tail.rs (positives; negatives for non-literal operand, signed min(0), non-primitive/generic types, extra reads/shadow/macro/return/else-if/nested fn/turbofish, wrong probe, hostile workspaces incl. macro-generated items and extern renames).
  • Evidence-level tests through the real classifier call site (check_workspace, app/tests/absorbing_tail_pipeline.rs): positive reads propagation_unknown with the unknown sink; the parked r.min(cap) witness keeps its returned-value sink; custom min, no_implicit_prelude, macro-generated fn, use ... as u32 and extern crate ... as u32 workspaces each keep the ordinary sink.
  • Corpus absorbing-min-literal-floor (new authored subject; sha256 of both retained files re-checked): the edit-itself mutant ran under rustc 1.95.0 with cargo test and survived; cargo xtask verdict-corpus relabel --case absorbing-min-literal-floor replayed it, 0 drifted (the run report is a local target/ artifact, not committed). check --cases scores abstained; labeling_observation.ripr_commit is the candidate commit a57b3f5 whose code produced the observation (the final head only adds fixture metadata and wording).
  • cargo xtask precommit passes on this head.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YVdGzURKRuX6rB4sZzfMME

… min/clamp has no value sink (#10875)

A changed if condition that only picks a let binding which the owner's tail pins with .min(0) on an unsigned type or .clamp(L, L) now reads a propagation limit instead of exposed. Fail-closed: straight-line body, receiver read once, literal operands and arms, plain primitive return type, and a workspace with no no_implicit_prelude/no_core, include!, fn min/clamp definition or primitive-renaming item. Adds the runtime-labelled absorbing-min-literal-floor corpus case.

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

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 150 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: aa20ac92-7a39-4950-bf7b-2b2dd2fa5d86
Commits

Reviewing files that changed from the base of the PR and between ca39083 and 54fe98c.

Files selected for processing: 13
  • changelog.d/10875-absorbing-min-no-sink.md
  • crates/ripr/src/analysis/classifier/evidence.rs
  • crates/ripr/src/analysis/classify/absorbing_tail.rs
  • crates/ripr/src/analysis/classify/flow.rs
  • crates/ripr/src/analysis/classify/mod.rs
  • crates/ripr/src/app/tests/absorbing_tail_pipeline.rs
  • crates/ripr/src/app/tests/mod.rs
  • fixtures/rust-verdict-corpus/cases/authored-absorbing-min-literal-floor.diff
  • fixtures/rust-verdict-corpus/cases/authored-absorbing-min-literal-floor.json
  • fixtures/rust-verdict-corpus/expected/rows/authored-absorbing-min-literal-floor.json
  • fixtures/rust-verdict-corpus/subjects/authored-absorbing-tail.json
  • fixtures/rust-verdict-corpus/subjects/authored-absorbing-tail/Cargo.toml
  • fixtures/rust-verdict-corpus/subjects/authored-absorbing-tail/src/lib.rs.txt
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

… absorbing min rule (#10875)

Adds an evidence-level positive and negatives through check_workspace (parked r.min(cap) witness, custom min, no_implicit_prelude, macro-generated fn, primitive renames), refuses macro_rules bodies that declare items by computed name and extern crate renames, annotates typed lets in positives, documents that the condition is not proven pure, and cites the cargo replay of the corpus mutant.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzURKRuX6rB4sZzfMME
…literal-floor; static-language wording (#10875)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzURKRuX6rB4sZzfMME
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 31, 2026 16:48
@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!

Copy link
Copy Markdown
Member Author

Required-check failures at head 41af688 are main-side, not this PR's: check-rust-source-role-authority (app/repair_attempt/mod.rs #[cfg(test)] literal, from #11596) and two stale agent::refusal_tests::*dirty_production_premise* assertions. Neither file is touched here. The fix is #11734 (open, merge-ready). Plan: once #11734 lands, merge main into this branch and re-apply merge-ready; no changes to this PR's code.


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 new absorbing-tail route is narrow and sibling-helper coverage is not demonstrated across other runtime/classifier entry points.
  • The workspace guard detects trait declarations containing fn min/clamp, but an impl method defined under another name can still provide the selected method call.

Verification questions

  • Confirm literal matching strips only a suffix equal to the owner's primitive, so equivalent bounds such as 0x0 are not recognized even though min(0x0) is absorbing.
  • Confirm the classifier replaces all ordinary flow sinks with one Unknown sink when the shape matches, so no sibling sink route can preserve observable behavior.
  • Confirm the runtime test fixture itself is not a red/green discriminator: it asserts only the invariant output before and after the edit.
  • Confirm the evidence-level tests cover positive, non-literal, and several workspace-dispatch controls but not an impl-defined min method.
  • Confirm the evidence path replaces all local flow sinks with one Unknown sink when the absorbing shape matches, so unrelated sinks are discarded rather than merely suppressing the absorbing returned-value sink.
  • Confirm the new rule is limited to one straight-line let-binding, an if condition matching the probe, and a tail literal min(0) or clamp(L,L); it is not a general absorbing-helper analysis.

Evidence gaps

  • Execution evidence for the changed Rust paths remains incomplete because the cargo-test receipt is absent.
  • The corpus subject metadata declares retained Cargo.toml and src/lib.rs hashes, but those files are not present under the declared subject directory in this diff.
  • Model proof intent was rejected by deterministic validation.

Parked follow-ups

  • The PR documents that substituted std/core or ambient RUSTFLAGS can alter effective dispatch without index authentication.

Copy link
Copy Markdown
Member Author

Correction to my earlier comment: with main-side red cleared (#11734), Rust tests shard 4 at 9dfdb24 fails on this PR's own change. validator_rejects_a_label_that_contradicts_its_mutant_outcomes tampers cases[0], and the new corpus case id sorts before accounts-balance-add, so the tamper became a no-op. Fixing by renaming the case id so it no longer sorts first (the order-sensitive tests stay untouched), then re-requesting qualification.


Generated by Claude Code

EffortlessSteven and others added 5 commits October 31, 2026 15:27
…rts first

Corpus tests tamper with cases[0] and expect a discriminated case; the new
not_discriminated case sorted first and broke
validator_rejects_a_label_that_contradicts_its_mutant_outcomes. Rename only.

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

Copy link
Copy Markdown
Member Author

Review of record, head 54fe98c108df667b2be4e2a44e8f8c6ec2a24b5f (author work, repair commits a68e6f02..a60686fa, and a clean merge of current main).

Repair on this round: the previous run's only failure (shard 4, xtask reports::verdict_corpus::tests::validator_rejects_a_label_that_contradicts_its_mutant_outcomes) was caused by this PR. The corpus tests tamper with cases[0] and expect a discriminated case; the new not_discriminated case absorbing-min-literal-floor sorted first by file name, so the tamper stayed consistent and no violation fired. I renamed the case (json, diff and expected row, ids and the relabel command in its review text) to authored-absorbing-min-literal-floor, which sorts after accounts-*. Content is otherwise byte-identical. No test was excluded or rescored. Shards 1-3 and the Rust gates were green on the prior head.

Angles: correctness, tests, spec/contract, perf/security.

  • Correctness: absorbing_tail_sink is fail-closed. It needs workspace_complete, a single-function body whose tail is <r>.min(0) on an unsigned return or <r>.clamp(L, L) on a primitive integer, a binding read only by that tail, an if <changed comparison> {int} else {int} initializer on the probe line, and a workspace with no no_implicit_prelude, no_core, include!, fn min/fn clamp, primitive-renaming items, or computed-name macro items. It only demotes to propagation_unknown; it never credits or flags a gap. The non-equivalent r.min(cap) witness keeps its sink.
  • Tests: unit tests in absorbing_tail.rs, pipeline tests through check_workspace for the positive and each hostile workspace, and a runtime-labelled corpus row (mutant ran under rustc 1.95.0 and survived).
  • Spec/contract: no schema, tier or output-vocabulary change. Named limit carried in the PR body: a substituted std/core or ambient RUSTFLAGS changing the prelude is not authenticated by the index; it only affects a demotion to unknown, so I accept it as a documented residual.
  • Perf/security: the workspace scan runs only after the cheap body-shape match succeeds.

Findings: one (the corpus ordering break above), resolved. Merge is gated on a green Ripr Rust Small Result on this exact 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.

Reporter summary

The implementation appears sound for its narrow contract: the matched local tail pins the returned primitive, the replacement with one Unknown sink is consistent with the single-read/straight-line body invariant, and the corpus fixture correctly demonstrates a surviving, non-discriminating mutant rather than a red/green oracle. However, the strongest remaining concern is that the textual workspace guard cannot authenticate standard Ord dispatch or fully exclude custom/generated impl-defined min/clamp dispatch; the named substituted std/core and RUSTFLAGS residual is also not closed. Verification is incomplete because cargo-test timed out after 900 seconds and ripr failed with exit code 2, so the author-reported passing precommit is not supported by a successful receipt in this review wave.

@EffortlessSteven
EffortlessSteven merged commit 91b8fd0 into main Oct 31, 2026
78 of 88 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/10875-clamp-min branch October 31, 2026 21:01
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