Skip to content

fix(rust): a test held in a value wrapper no longer earns exact credit (#8101) - #8621

Merged
EffortlessSteven merged 7 commits into
mainfrom
claude/project-thread-4g2cqz-some-wrappers
Oct 18, 2026
Merged

EffortlessSteven merged 7 commits into
mainfrom
claude/project-thread-4g2cqz-some-wrappers

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Before: on main, a boolean test held in a value wrapper still earned exact/strong credit when the wrapper's equality did not say the test held. assert_eq!(Some(r == Err(E::Bad)), Some(false)), assert_eq!(Ok::<bool, ()>(..), Ok(expected)), assert_eq!(Wrapper(..), true), assert_eq!(Box::new(..), b), assert_eq!([matches!(..); n], [true; n]), assert_eq!([r == Err(E::Bad), x == 1], [false, true]), and Some(..).unwrap()/.expect(..)/.clone()/.to_owned() forms all read ExactValue/ExactErrorVariant strong.

After: those readings cap to RelationalCheck/weak. A wrapped test reads through its wrapper only against the same wrapper around a literal (same constructor, turbofish aside, or same nonzero repeat count), so assert_eq!(Some(x == 3), Some(true)), assert_eq!(Box::new(x == 3), Box::new(true)) and assert_eq!([x == 3; 2], [true; 2]) still pin, and wrapped plain values (Some(x) vs Some(3), v vs vec[1, 2]) are untouched.

How: bool_operands.rs gains wrapper_contents/value_wrapper_argument (constructor, new/from path call, [..], [..; n], vec[..]), passthrough_receiver, unwrapped_wrapper_argument (only Some/Ok), shaped_wrapper_argument (shape comparison; new/from only for Box/Rc/Arc) and holds_wrapped_test. sides_compare_test_with_non_literal peels matched shapes, pairs sequence elements with a polarity check, and fails closed on any other wrapper holding a test. Builds on #8297 (shared constructors) and #8370 (sequence pairing).

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Spec: RIPR-SPEC-0231 rule 1 (caps may only lower a reading)
Governing issue or accepted claim: Refs #8101 (claim comment on the issue); residuals filed as #8615
Acceptance delta (one sentence): a test held in a call, array or vec! wrapper no longer earns exact/strong credit unless the other side wraps true the same way.

Candidate Relationships

Candidate branch: claude/project-thread-4g2cqz-some-wrappers. Prerequisites #8297 and #8370 are merged. No replacement.

Scope Classification

  • One production behavior

Non-goals: struct literals, statement blocks and field/method access on a wrapper (#8615); safe-direction underclaims listed there.

Support-tier Impact

  • none

Policy Impact

  • none

Proof

cargo test -p ripr --lib analysis::extract      # 236 passed
cargo xtask verdict-corpus check-all            # Rust 12/488 false (unchanged), oracle 44/44, overclaim 0
cargo xtask check-evidence-promotion-honesty    # pass, incl. new rust_test_wrapped_in_some_not_exact
cargo xtask goldens check                       # pass
cargo xtask precommit                           # pass

Discrimination: the regression rows in bool_valued_operands_read_as_what_they_assert were probed on main d314d7e, where every capped row read strong; the exact controls read strong on both.

Three independent review passes ran on intermediate heads; their blocking findings are fixed in the last three commits (rows added for each).

Claim Boundary

May claim: the listed wrapper forms cap. Must not claim: all wrapped tests cap (see #8615).

Rollback

Revert the squash commit; no schema, output-contract or workflow change.

Spec-Test-Code Traceability

  • Spec: docs/specs/RIPR-SPEC-0231-rust-oracle-kind-admission.md
  • Tests: crates/ripr/src/analysis/extract/oracles/relational_tests.rs
  • Code: crates/ripr/src/analysis/extract/oracles/bool_operands.rs
  • Golden outputs: fixtures/test_wrapped_in_some_not_exact
  • Metrics: n/a

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.

CI Economics

n/a

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.

Generated by Claude Code

`assert_eq!(Some(r == Err(E::Bad)), Some(expected))` and the `Ok::<_, _>`,
constructor, `Box::new`, `[..]`, `[..; n]`, `vec![..]` and
`.unwrap()`/`.expect(..)`/`.clone()` spellings read exact/strong because
the wrapper hid the test and `Some(false)` was no literal. A value wrapper
now holds the test it wraps and the literal it wraps, so a wrapped test
compared with a non-literal or `false` caps, while the same test asserted
true through `Some(true)` still pins.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EAoMKstQhYv56x2g6gEHZG
… the literal is wrapped too (#8101)

Review of 5f6ffed: peeling `Wrapper(matches!(..))` against a bare `true`
dropped the unread-call cap the equality-macro form relied on. The
operand now loses a value wrapper only together with one around the
literal, and `Some(..).unwrap()` opens to what it holds. Adds rows for
`Wrapper::from`, `.to_owned()` and the bare-literal wrappers; widens the
changelog and spec wording.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EAoMKstQhYv56x2g6gEHZG
…-4g2cqz-some-wrappers

# Conflicts:
#	docs/specs/RIPR-SPEC-0231-rust-oracle-kind-admission.md
…nce rule (#8101)

After merging main's sequence rule (#8370), `[x == 3; 2]` against
`[true; 2]` read its elements as `x == 3; 2` and `true; 2` and capped.
A repeat array now yields its repeated value. Re-blesses the new
fixture for main's human-output wording.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EAoMKstQhYv56x2g6gEHZG
A repeat array holds a read value only with a nonzero literal count, a
wrapper pair peels only when both sides share the constructor shape (and
::new/::from only for Box/Rc/Arc), and a repeat compared with a list of a
different length compares the test with non-literal names.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EAoMKstQhYv56x2g6gEHZG
A test inside a wrapper reads through it only against the same wrapper
shape around a literal (turbofish ignored); otherwise it caps. Only Some
and Ok unwrap, unknown-length repeats pair nothing, and a sequence element
test paired with anything but true caps.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EAoMKstQhYv56x2g6gEHZG
…, array and vec! wrappers

Struct literals, blocks and wrapper field/method access are filed as #8615.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EAoMKstQhYv56x2g6gEHZG
@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 marked this pull request as ready for review October 17, 2026 23:21
@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 17, 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 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 77 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
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 05bac536-b79f-4403-9c2a-7f08d8802526
📥 Commits

Reviewing files that changed from the base of the PR and between fb21cee and c09beb8.

📒 Files selected for processing: 14
  • .ripr/traceability.toml
  • changelog.d/8101-value-wrapped-tests.md
  • crates/ripr/src/analysis/extract/oracles/bool_operands.rs
  • crates/ripr/src/analysis/extract/oracles/relational_tests.rs
  • docs/specs/RIPR-SPEC-0231-rust-oracle-kind-admission.md
  • fixtures/evidence-promotion-honesty-corpus/corpus.json
  • fixtures/test_wrapped_in_some_not_exact/SPEC.md
  • fixtures/test_wrapped_in_some_not_exact/diff.patch
  • fixtures/test_wrapped_in_some_not_exact/expected/CHANGELOG.md
  • fixtures/test_wrapped_in_some_not_exact/expected/check.json
  • fixtures/test_wrapped_in_some_not_exact/expected/human-full.txt
  • fixtures/test_wrapped_in_some_not_exact/expected/human.txt
  • fixtures/test_wrapped_in_some_not_exact/input/Cargo.toml
  • fixtures/test_wrapped_in_some_not_exact/input/src/lib.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm wrapper_contents duplicates shape detection already covered by shared_constructor_arguments for tuple-style constructors; sequence path repeats top-level-semicolon logic adjacent to sequence_elements' new repeat-value branch.
  • Confirm ripr sensor failed (exit 2) per sensor-status; reviewer cannot independently verify that the new boolean-operand code paths compile and produce the asserted readings across the full corpus beyond author-reported cargo test -p ripr --lib analysis::extract 236 passed. The PR proof block claims pass; treat as advisory until independent witness runs.

Refuted

  • No ripgrep hits in changed files for JS/typed-array surface; ub-active-view scope is out-of-domain for this PR.
  • This PR introduces a JS worker handoff, async capture, GC, detach, or transfer boundary that the lane must gate.; refuted because: Diff is source-ub Rust analyzer edits for RIPR-SPEC-0231 #8101 with new text/peeling helpers, a new fixture, a new corpus entry, and a spec normative paragraph. No JS, no worker/thread/IPC, no transferable or async surface, and no FFI bindings are touched. Lane scope does not apply.
  • Wrapper around a test asserted via bare literal (Wrapper(matches!(..)) vs true) could still read as exact if Wrapper was treated like Some/Ok via shared_constructor_arguments; refuted because: bool_literal_comparison_reading trims to operand only (no peer shape check) and unwrapped_wrapper_argument restricts to Some/Ok; Wrapper(matches!(..)) vs true hits the bare-literal path with no shaped-wrapper match, returns Capped via sides_compare_test_with_non_literal -> holds_wrapped_test; weak row confirms.
  • Box::from(slice) / Box::<[u8]>::from(slice) allocation failure may be invoked by the shaped_wrapper_argument pass-through for Box::new; refuted because: Not raised by this PR diff or seeded thread; shaped_wrapper_argument never constructs a Box, only inspects source text. Calibrated out per lane instructions.
  • passthrough_receiver's arity-1 check on .expect could mis-handle Option::expect-style or Result::expect-style calls with extra generic args; refuted because: split_top_level_commas returns the count of top-level commas only; generic/type args are not top-level commas at the call-arg depth. The contract documented in code matches the standard library's single-message signature.
  • pointer-offset arithmetic in shaped_wrapper_argument risks OOB/UAF when inner is not a subslice of text; refuted because: value_wrapper_argument returns a str slice of the same input text via delimited_contents_at / final_group_open; shaped_wrapper_argument checks (inner.as_ptr() as usize).checked_sub(text.as_ptr() as usize) which is Some only when inner's start >= text's start; inner is a subslice so the offset is well-defined and bounds-checked.

Parked follow-ups

  • Parked follow-ups in #8615 (struct literals, statement blocks, field/method access on a wrapper) are explicitly out of scope; surfaces not widened by this PR. Sibling scan confirms no helper change covers them.
  • Passthrough chain (.unwrap/.expect/.clone/.to_owned) is symmetric: passthrough_receiver unwraps one operand, and the new shaped_wrapper_argument loop in bool_literal_comparison_reading iterates until stable.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Review of record, head c09beb8

CI on this head: required Ripr Rust Small Result success (hosted Rust gates success), source-of-truth, wheel and clean-install lanes success; ub-review was cancelled and is not a required check.

Angles, each by an independent reviewer agent reading the exact diff (no cargo):

  • Correctness and edge cases (two passes on earlier heads, one on the final delta): found wrongly-strong readings for empty or unknown-length repeats, SomeWrapper(..).unwrap(), mismatched or arbitrary new/from wrappers, a test paired with false in a list, an unequal-length repeat holding a multi-argument wrapper, and wrappers around == tests. All fixed in ed1a892, 1ab6ecb and c09beb8 with a regression row each; no remaining panic or non-termination path (all slicing via .get, every loop continue shrinks an input).
  • Tests and regressions: no existing expectation changed (110 added, 0 removed in relational_tests.rs); every new branch has a capping row and an exact control. Gates locally on this head: extract tests 236 passed, verdict corpus Rust 12/488 false (unchanged), oracle 44/44, honesty pass, goldens pass, precommit pass.
  • Spec and contract: spec paragraph, changelog and fixture agree with the code; struct literals, blocks and field/method access are scoped out to rust: a test inside a struct literal, a block, or behind a wrapper's field/method still earns exact/strong credit #8615. Optional wording and missing-row items from this pass are recorded on rust: a test inside a struct literal, a block, or behind a wrapper's field/method still earns exact/strong credit #8615.
  • Policy: no new unwrap/expect/panic in production code, no allow attributes.

The github-actions review (COMMENTED) raises two verification questions: whether wrapper_contents duplicates shared_constructor_arguments (it does not replace it; it also covers arrays, vec! and new/from calls, and the shared-constructor branch still runs) and an unverified-proof note, which the local gate results above answer. Nothing blocking.

Resolutions: all blocking findings fixed; optional items filed on #8615.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 68d1aae into main Oct 18, 2026
35 of 36 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-4g2cqz-some-wrappers branch October 18, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants