Skip to content

fix(classify): bool-owner next step names the deciding input; guard operands compare tokens (#15149) - #15537

Merged
EffortlessSteven merged 12 commits into
mainfrom
claude/project-thread-j1fibr-15149
Nov 27, 2026
Merged

EffortlessSteven merged 12 commits into
mainfrom
claude/project-thread-j1fibr-15149

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #15149
Acceptance delta (one sentence): A weakly exposed return value of a -> bool owner whose reaching related tests already assert its exact result no longer gets the broad-assertion advice (it now asks for a deciding input), and the dropped-guard agreement rule compares retained operands as sequences of words, literals and punctuation runs, so a as u8 == 0 → aasu8 == 0 counts as a rewrite and is not read as a dropped guard.
Source review: REVIEW_READY c07a79f

Why

Both halves of #15149 (deferred CodeRabbit findings on #14194):

  1. decision.rs emitted "Replace broad assertions with exact equality..." for every weakly exposed return value. For a -> bool owner, assert!(f(x)) is assert_eq!(f(x), true), so that rewrite checks the same values and cannot separate old n == 1 from new n == 1 || n == 2 (fixtures/rust_predicate_appended_int_arm_old_input). The missing piece is a deciding input.
  2. compact_operand removed every space outside literals, so a as u8 == 0 and aasu8 == 0 compared equal. The guard-operand rule then withheld credit for a genuine rewrite.

Change

  • crates/ripr/src/analysis/classify/decision.rs: new bool_owner_exact_result_next_step. It applies to a weakly_exposed return_value probe of an owner declaring -> bool when every contributing reach-establishing row's oracle is assert!(owner(..)) / assert!(!owner(..)). Plain, std::/core:: rooted, path-qualified and message-argument forms are accepted. Any other row keeps the family template: compound, wrapped, method receiver, turbofish, debug_assert!, assert_ne!, or unreadable. The new step names the owner and asks for "a test with an input whose boolean result differs between the old and new code". It names no value, because the return-value finding has no deciding-input fact. This is guidance only: class, stages, evidence and repair eligibility are unchanged, and nothing becomes newly actionable.
  • crates/ripr/src/analysis/classifier/finding.rs: the new step is called after the ux(suggest): generic Next step lines presume assertion shapes the related test does not have #7393 exact-oracle step, for non-assertion-shaped owners only, and only when every matched related row is listed (truncated windows keep the template).
  • crates/ripr/src/analysis/classify/owner_pin/short_circuit.rs: compact_operand is replaced by operand_tokens. Words and numbers are separate entries split at whitespace, each run of adjacent punctuation is one entry with inner spacing dropped, and literals stay verbatim. Layout-only edits (a % 2 / a%2, Vec<Vec<u8> > / Vec<Vec<u8>>) still match, so withholding is kept. Identifier/keyword/type merges (a as u8 / aasu8) do not. In decision.rs, a reaching row whose miss is MissingExactAssertion also keeps the old advice (review repair at 9f8b54c).
  • Specs: RIPR-SPEC-0197 rule 5 text now describes words, literals and punctuation runs. RIPR-SPEC-0259 gains a boolean-owner bullet, test mapping and implementation mapping. .ripr/traceability.toml lists the new tests.
  • Goldens re-blessed via cargo xtask goldens bless <fixture> --reason "RIPR-SPEC-0259: ...": rust_predicate_appended_int_arm_old_input, rust_predicate_appended_str_arm_false_side_only, rust_predicate_appended_char_arm_old_input (added on main, re-blessed after merging main), guard_operand_dropped_agreement. In each, the drift is confined to recommended_next_step / suggested_next_action and their human rendering. rust_nested_use_owner is no longer changed: its owner thr has a cross-package rival, so the asserted-call identity check keeps the old advice.
  • changelog.d/15149-bool-owner-guidance-and-operand-tokens.md (Fixed).

Proof

Environment: Linux, bash. CARGO_PROFILE_DEV_DEBUG=0 CARGO_BUILD_JOBS=1 CARGO_INCREMENTAL=0. Lib/integration tests used --no-default-features --features lang-rust.

GREEN (candidate):

  • cargo test -p ripr --lib --no-default-features --features lang-rust -- bool_owner_exact_result operand_tokens a_space_that_separates layout_whitespace: exit 0, 6 passed
  • cargo test -p ripr --no-default-features --features lang-rust --test short_circuit_or_tail: exit 0, 9 passed (includes the new a_word_merged_across_a_space_is_a_rewritten_operand_not_a_dropped_guard)

RED (production reverted in a temporary edit: bool_owner_exact_result_next_step short-circuited to None; push_code_tokens word reading disabled, which reproduces whitespace-stripped comparison):

  • lib filter above: exit 101. 4 failed: bool_owner_exact_result_rows_name_the_deciding_input, bool_owner_exact_result_step_needs_every_reaching_row_to_assert_the_owner_result, a_space_that_separates_words_is_part_of_the_retained_operand, operand_tokens_split_words_and_read_punctuation_by_longest_match. The 2 layout controls still passed.
  • --test short_circuit_or_tail: exit 101. a_word_merged_across_a_space_is_a_rewritten_operand_not_a_dropped_guard failed at its Exposed assertion. The 8 existing guard/or-tail tests passed.
  • Before re-bless, cargo xtask goldens check-with-fixtures showed recommendation_changed drift in exactly the four fixtures listed above.

Discriminating negatives: the layout-only control (n != 0 && aasu8==0 → aasu8 == 0) still stays below exposed. Broad or other-shaped bool assertions, non-bool owners, predicate probes, exposed class, no owner, no rows, and proximity-only rows all keep the family template.

Gates on head:

  • cargo fmt --check: exit 0
  • cargo xtask goldens check-with-fixtures: exit 0 (1015 fixtures compared)
  • cargo xtask check-evidence-promotion-honesty: exit 0
  • cargo xtask verdict-corpus check-all: exit 0
  • cargo xtask precommit: exit 0

Review repair (9f8b54c)

An independent review of a5428fc found that strict Rust-token comparison could read a layout-only punctuation edit (Vec<Vec<u8> > vs Vec<Vec<u8>>) as a rewrite and drop the withholding. It also asked for parity with the exact-oracle step on MissingExactAssertion rows, and for wider shape coverage. All three are repaired.

  • RED with the new tests on a5428fc production code: lib filter exit 101. a_layout_only_generic_close_keeps_the_dropped_guard_read and bool_owner_exact_result_step_needs_every_reaching_row_to_assert_the_owner_result (the missing_exact_assertion row) failed.
  • GREEN on 9f8b54c: cargo test -p ripr --lib --no-default-features --features lang-rust -- bool_owner_exact_result short_circuit::tests exit 0, 19 passed; --test short_circuit_or_tail exit 0, 9 passed.
  • Gates on 9f8b54c: fmt, goldens check-with-fixtures (1015, no drift), check-evidence-promotion-honesty, verdict-corpus check-all and precommit all exit 0.

Review repair (d60f739)

Two Devin findings on 9f8b54c were confirmed and fixed in af71f7c: tuple-field spacing (x.0.0 vs x.0 .0) read as a rewrite and dropped the withholding, and a same-named rival assertion could receive the exact-owner guidance. A word is now only identifier characters, with . always punctuation. The asserted call must resolve to the owner through shared_owner_call_identity / OwnerCallIdentity::resolve_call; without a shared identity only a bare call with no same-named rival counts.

  • RED on 9f8b54c production: lib filter exit 101 (a_tuple_field_spacing_edit_keeps_the_dropped_guard_read, operand_tokens_split_words_and_merge_punctuation_runs, bool_owner_step_needs_the_asserted_call_to_be_the_owner); --test bool_owner_next_step exit 101 on the rival case while the positive control holds.
  • GREEN on d60f739: lib filter 25 passed, bool_owner_next_step 2 passed, short_circuit_or_tail 9 passed; fmt, goldens check-with-fixtures (1023), check-evidence-promotion-honesty, verdict-corpus check-all and precommit all exit 0.
  • Merged origin/main (b6a0227); re-blessed rust_predicate_appended_char_arm_old_input (deciding input ';'), and restored rust_nested_use_owner to main's goldens.
  • A qualified asserted call with no same-package rival (for example crate::is_small(..)) keeps the old advice; it could be widened later.

Main refresh (c07a79f)

dc6eccf merges origin/main after a week of movement. The spec test lists and linked issues are unioned. guard_operand_dropped_agreement takes main's goldens and is re-blessed (only the expected bool-owner step in human.txt). rust_predicate_appended_int_arm_old_input takes main's goldens with no re-bless needed. Main's #15596 raw-string test is ported from compact_operand to operand_tokens with the same assertions. #16039's exact-oracle step still runs first, and the bool-owner step only when that returns nothing; their preconditions (a strong exact oracle versus bare assert!(owner(..)) rows) cannot both hold. On c07a79f: focused lib tests (29, including #16039's), bool_owner_next_step (2), short_circuit_or_tail (9), fmt, goldens (1133), honesty corpus, verdict corpus and precommit exit 0.

Not established

  • No hosted CI has run on this head.
  • Full workspace / default-feature lib test suite was not run locally (container memory). Only the focused filters above were run.
  • The boolean-owner step names no concrete input value: the return-value finding carries no deciding-input fact. The sibling predicate finding may still name one (for example n == 2), but this PR does not cross-link findings.
  • The human Missing check: No strong assertion was detected line on these findings is unchanged classifier wording.
  • Bool owners asserted through a method receiver (x.is_ok_flag()) or a bound result still get the template.
  • Two goldens were first blessed while the tree was dirty, which recorded an environment-dependent repair-start line. They were re-blessed from a clean committed tree in follow-up commits, and the final goldens check-with-fixtures passes.

https://claude.ai/code/session_01YVdGzSEGc73M5dJJGUFL6S


Generated by Claude Code

…erands compare tokens (#15149)

A weakly exposed return value of a `-> bool` owner whose reaching related
tests already assert its exact result (`assert!(f(..))`, `assert!(!f(..))`)
no longer advises replacing broad assertions with exact equality; the next
step asks for an input whose boolean result differs between the old and
new code (RIPR-SPEC-0259). The dropped-guard agreement rule compares
retained operands as Rust token sequences, so `a as u8 == 0` rewritten to
`aasu8 == 0` is a rewrite, not a dropped guard (RIPR-SPEC-0197 rule 5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzSEGc73M5dJJGUFL6S
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzSEGc73M5dJJGUFL6S
…ly from a clean tree (#15149)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzSEGc73M5dJJGUFL6S
@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 20, 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 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 138 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: b14b8f36-60fe-486d-902a-fa72c50cd9f5
Commits

Reviewing files that changed from the base of the PR and between f250f4a and c07a79f.

Files selected for processing: 24

  • .ripr/traceability.toml
  • changelog.d/15149-bool-owner-guidance-and-operand-tokens.md
  • crates/ripr/src/analysis/classifier/finding.rs
  • crates/ripr/src/analysis/classify/decision.rs
  • crates/ripr/src/analysis/classify/mod.rs
  • crates/ripr/src/analysis/classify/owner_pin/short_circuit.rs
  • crates/ripr/tests/bool_owner_next_step.rs
  • crates/ripr/tests/short_circuit_or_tail.rs
  • docs/specs/RIPR-SPEC-0197-owner-return-pins.md
  • docs/specs/RIPR-SPEC-0259-next-step-oracle-shape.md
  • fixtures/guard_operand_dropped_agreement/expected/CHANGELOG.md
  • fixtures/guard_operand_dropped_agreement/expected/check.json
  • fixtures/guard_operand_dropped_agreement/expected/human-full.txt
  • fixtures/guard_operand_dropped_agreement/expected/human.txt
  • fixtures/rust_predicate_appended_char_arm_old_input/expected/CHANGELOG.md
  • fixtures/rust_predicate_appended_char_arm_old_input/expected/check.json
  • fixtures/rust_predicate_appended_char_arm_old_input/expected/human-full.txt
  • fixtures/rust_predicate_appended_char_arm_old_input/expected/human.txt
  • fixtures/rust_predicate_appended_int_arm_old_input/expected/check.json
  • fixtures/rust_predicate_appended_int_arm_old_input/expected/human-full.txt
  • fixtures/rust_predicate_appended_str_arm_false_side_only/expected/CHANGELOG.md
  • fixtures/rust_predicate_appended_str_arm_false_side_only/expected/check.json
  • fixtures/rust_predicate_appended_str_arm_false_side_only/expected/human-full.txt
  • fixtures/rust_predicate_appended_str_arm_false_side_only/expected/human.txt
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…-owner rows (#15149)

Review of #15537 at a5428fc:
- operand_tokens keeps word and literal boundaries but merges each run of
  adjacent punctuation, so a layout-only edit such as `Vec<Vec<u8> >` vs
  `Vec<Vec<u8>>` stays a retained operand and the withholding is kept
  (splitting `>>` from `> >` dropped it, fail-open toward exposed).
- bool_owner_exact_result_next_step keeps the family template when a
  reaching row is annotated missing_exact_assertion, as
  exact_oracle_gap_next_step does; the owner match by last path segment is
  documented.
- Tests cover the core::/::std::/::core:: rooted forms and turbofish, bound
  result, double negation and closure negatives. RIPR-SPEC-0197 rule 5,
  RIPR-SPEC-0259 and the changelog fragment follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzSEGc73M5dJJGUFL6S
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 20, 2026 03:01
@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!

@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.

SOURCE_REVIEW_READY for head 9f8b54c

Exact-head review. An independent static review of a5428fc covered the decision.rs producer, the finding.rs call site, operand_tokens, the specs, traceability, the changelog and the 4 re-blessed goldens. It found no high or medium issues. Its low findings were repaired at 9f8b54c:

  • operand_tokens now merges each run of adjacent punctuation, so layout-only edits such as Vec<Vec > vs Vec<Vec> keep the dropped-guard withholding (fail-closed). Word boundaries still separate a as u8 from aasu8.
  • A reaching MissingExactAssertion row keeps the old advice, matching exact_oracle_gap_next_step.
  • New positive and negative shape cases cover the spec claims.

I read the 9f8b54c delta directly. The new step changes guidance text only, with no class, stage or actionability change. Focused tests, goldens (no drift), honesty corpus, verdict corpus and precommit exit 0 on this head; hosted qualification is next.


Generated by Claude Code

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

Devin Review

…p needs the asserted call to be the owner (#15149)

Review of #15537 at 9f8b54c:
- operand_tokens no longer absorbs a decimal point into a number, so
  `x.0.0` and `x.0 .0` read the same and a tuple-field spacing edit keeps
  the guard-agreement withholding (fail-open fixed).
- bool_owner_exact_result_next_step asks whether the asserted call itself
  is the owner: with a same-package rival the shared OwnerCallIdentity must
  settle the spelled call on the owner; otherwise only a bare call with no
  same-named function in the index counts. A test that calls the owner
  but asserts a rival keeps the family template.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzSEGc73M5dJJGUFL6S
…-j1fibr-15149

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzSEGc73M5dJJGUFL6S
…r the bool-owner next step (#15149)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzSEGc73M5dJJGUFL6S
…the asserted-call identity check (#15149)

Restores the fixture's goldens to their main content: its thr owner has a
same-named function in another package, so the bool-owner step fails closed.

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

@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.

REPAIR_REQUIRED

Head: 9f8b54c
Stage: source review, published head
Disposition: red. The new token comparison reads a layout-only tuple-field edit as a rewritten operand, so the guard-agreement refusal is lost and an unchanged test result is credited as exposed.

Blocking finding

push_code_tokens (crates/ripr/src/analysis/classify/owner_pin/short_circuit.rs:443-471) keeps a . inside a word only when the word starts with an ASCII digit and the next character is a digit (lines 459-461). So 0.0 is one token, while 0 .0 is the word 0, the punctuation run ., and the word 0.

Trigger: change fn f(n: u32) -> bool { n != 0 && ((n,),).0 .0 == 4 } to fn f(n: u32) -> bool { ((n,),).0.0 == 4 }. Both spellings are the same consecutive tuple-field access, and tests asserting f(4) and !f(5) return identical results before and after. The retained operand's token sequences differ (["((n,),)", "0", ".", "0"] against ["((n,),).", "0.0"]), so the comparison at line 344 does not match it, it is pushed into differing, and parse_operand on a tuple-field access returns None. The ? at line 348 then makes attempt return None, ShortCircuitTail::parse returns None, and the pin keeps its current reading with no withholding.

Consequence: a false promotion. The previous whitespace-compacting comparison recognized the retained operand; the new one rejects it, so a test whose result is unchanged is credited as exposing the change.

Required repair

  • Distinguish a decimal literal from consecutive tuple-field indices, so field-access spacing is layout while 1.5 stays one token.
  • Add a GuardOperandChange::read regression for both spacing directions and an integration control in the existing short-circuit-tail tests. Keep the cast-word separation and generic-closing punctuation controls.

Non-blocking

The second finding on decision.rs:781 (a rival same-named assertion accepted as the owner's) is plausible and unrefuted, but I did not verify it against call_identity.rs and reveal.rs on this head. It should be dispositioned in the same repair round rather than left open.

Not checked

No local cargo test on this head; the hosted shards are the execution evidence. I read the committed source at the head.

@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.

SOURCE_REVIEW_READY for head d60f739

Exact-head review of the delta since 9f8b54c:

  • af71f7c addresses both Devin threads and the matching published-head review. operand_tokens treats . as punctuation, so tuple-field spacing keeps the dropped-guard withholding. The boolean-owner step now requires the asserted call to resolve to the owner via shared_owner_call_identity and OwnerCallIdentity::resolve_call; without a shared identity only a bare, rival-free call qualifies. I read asserted_call_settles_on_owner in finding.rs: every unsettled path answers false and keeps the family template.
  • b6a0227 merges main; 4d34877 re-blesses rust_predicate_appended_char_arm_old_input (guidance text only, deciding input ';'); d60f739 restores rust_nested_use_owner to main's goldens, the conservative direction.

Both review threads are answered and resolved. On this head: focused lib tests (25), bool_owner_next_step (2), short_circuit_or_tail (9), fmt, goldens check-with-fixtures (1023), honesty corpus, verdict corpus and precommit exit 0. Guidance text only; no class, stage or actionability change. Hosted qualification is next.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Correction to my readiness review for d60f739: "Guidance text only; no class, stage or actionability change" applies to the boolean-owner next step. The operand-token half intentionally changes one class reading. A word merged across a space (a as u8 == 0 to aasu8 == 0) is now a rewritten operand rather than a retained one, so that case is no longer withheld by the dropped-guard rule; a_word_merged_across_a_space_is_a_rewritten_operand_not_a_dropped_guard pins it. Every layout-only edit (spacing, punctuation runs, tuple fields) still keeps the withholding.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven added this pull request to the merge queue Nov 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

merge-ready is set, but this PR conflicts with main (head d60f7390), so GitHub creates no test-merge ref and no qualification run can start. 1. Merge main into the branch and resolve the conflicts. 2. Remove and re-apply merge-ready to request admission and qualification only. 3. After qualification is green, enqueue the PR through the native queue route; re-applying the label does not enqueue it.

…-j1fibr-15149

Resolutions: RIPR-SPEC-0197 and RIPR-SPEC-0259 take both sides; the
guard_operand_dropped_agreement and rust_predicate_appended_int_arm_old_input
goldens take main's versions for re-blessing; the #15021 raw-string test
from main is ported from compact_operand to operand_tokens.

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

@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.

SOURCE_REVIEW_READY for head c07a79f

Exact-head review of the main refresh since d60f739. I compared the PR's decision.rs and finding.rs against main's side of merge dc6eccf. The production delta is identical to the previously reviewed change. The bool-owner branch sits after #16039's exact-oracle branch in build_finding_with_origins, so when both could apply the exact-oracle step stands. The conflict resolutions are a union of the spec test lists and linked issues, main's goldens plus one re-bless of guard_operand_dropped_agreement human.txt (the expected bool-owner step), and main's #15596 raw-string test ported to operand_tokens with the same assertions.

Both earlier review threads remain resolved. On this head: focused lib tests (29, including #16039's), bool_owner_next_step (2), short_circuit_or_tail (9), fmt, goldens check-with-fixtures (1133), honesty corpus, verdict corpus and precommit exit 0. Hosted qualification is next.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 32164ee Nov 27, 2026
19 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-j1fibr-15149 branch November 27, 2026 02:36
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