Skip to content

fix(oracles): a test inside two same-length sequences is never an exact oracle (#8101) - #8370

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/project-thread-8gdu22
Oct 17, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
claude/project-thread-8gdu22

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Before: assert_eq!(vec[r == Err(E::Bad)], vec[expected]), the array form [r == Err(E::Bad)] against [expected], vec[x, r == Err(E::Bad)] against vec[y, expected] and [matches!(r, Err(E::Bad))] against [expected] read exact_error_variant/strong, although the unwrapped comparison caps because expected may be the failing value. The tuple forms already capped.

After: two arrays or vec! literals of the same length are compared element by element, so a test compared with a non-literal inside one caps at relational_check/weak (RIPR-SPEC-0231 rule 1). A literal element (vec[r == Err(E::Bad)] against vec[true]) and plain values (vec[total(2)] against vec[expected] or vec[5]) keep their readings.

How: compares_test_with_non_literal now hands its two sides to sides_compare_test_with_non_literal, which gains a sequence_elements step (an optional vec! prefix, one bracketed literal, split at top-level commas) and recurses on each element pair when both sides have the same length. Adds a unit test, RIPR-SPEC-0231 rule 1 text, a traceability entry and a changelog.d fragment.

Proof: on main f2603bc the listed spellings read ExactErrorVariant/Strong. On this head cargo xtask precommit exits 0, cargo test -p ripr --lib analysis::extract passes (225), and cargo xtask verdict-corpus check-all exits 0 with no corpus movement.

Not done: sequences of different lengths, [x; n] repeat forms and nested sequences beyond the element recursion stay as on main.

Refs #8101


Generated by Claude Code

@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 self-assigned this Oct 17, 2026

Copy link
Copy Markdown
Member Author

In-session proof plus independent review (Sonnet subagent) of exact head e8112f4 on main f2603bc. Hosted CI runs from the merge-ready label.

  • Independent review: no blocking findings. Across 21 probes plus nested arrays 50 and 2000 deep, the only difference from the parent is strong to weak; no panic, no raise. Genuine pins stay strong (vec[total(2), 3] vs vec[5, 3], vec[a, b] vs vec[c, d], vec[r == Err(E::Bad)] vs vec[true]). Unequal lengths read as on main. With only bool_operands.rs reverted to the parent, the new test fails on its first case (expected RelationalCheck/Weak, got ExactErrorVariant/Strong).
  • Behavior note: the repeat form vec[r == Err(E::Bad); 3] vs vec[expected; 3] also caps now, a safe underclaim.
  • Local proof: cargo xtask precommit exit 0; cargo test -p ripr --lib analysis::extract 225 passed; cargo xtask verdict-corpus check-all exit 0, no corpus movement.
  • Non-claims: a test inside an index (v[r == Err(E::Bad)] vs x) still reads strong as on main; logged on oracles: follow-ups from the #8091 review (Not::not over a group, Some() wrappers, turbofish and nested-== underclaims) #8101. Missing: CodeRabbit and Gemini reviews (rate-limited).

Generated by Claude Code

@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 enabled auto-merge (squash) October 17, 2026 05:13

@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 reviewer attention before upstream: findings remain.

Confirmed findings

  • sequence_elements uses array.starts_with('[') on the trimmed side after strip_prefix('vec!'); leading whitespace inside the literal like vec![ ... ] still starts with '[' so length check holds, but vec! with whitespace before '[' after trim_start would miss. Minor; only theoretical inputs.

Refuted

  • Helper should be promoted to arguments.rs alongside split_top_level_commas to avoid future duplication across oracle classifiers.; refuted because: bool_operands.rs already houses the orchestrator (whole_comparison_sides, compares_test_with_non_literal); sequence_elements is a thin 5-line wrapper strictly used by that orchestrator. Cross-module move would expand PR surface beyond #8101 without functional gain and would require updating traceability and tests.
  • sequence_elements returns Some for any square-bracketed side regardless of contents, causing false recursion or trivial match for empty arrays; refuted because: guarded by array.starts_with('[') && contents.len()+2 == array.len() and explicit left.len()==right.len(); recursion requires a test-vs-non-literal pair to return true.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

CI Failure Diagnosis on Rust Gates (39005468576 / 117316985227)

The run failed in cargo nextest on:

FAIL [0.260s] ripr::cli_smoke check_python_finding_with_repair_card_points_at_the_card

Root Cause

This branch predates PR #8275 (1187b906b), which converted the default verdict output from (preview_limited) to (analysis complete). The test assertion at crates/ripr/tests/cli_smoke.rs:17588 still expects (preview_limited).

Resolution

This known issue is being addressed by PR #8392 / PR #8372. Once landed on main, rebasing onto main will bring in the updated expectation and unblock the gates.

Copy link
Copy Markdown
Member Author

The failed Rust gates run on the previous head was not caused by this diff. check_python_finding_with_repair_card_points_at_the_card still expected the old "(preview_limited)" suffix on the triage State line, which #8341 removed on main and fixed in the same test. It failed locally the same way before the merge and passes after it. Merged main into the branch (no conflicts) and re-ran the oracle tests locally; CI should now re-run on the new head.


Generated by Claude Code

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

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 63 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: f28e1fbb-7355-4317-879a-53b240e8955d
📥 Commits

Reviewing files that changed from the base of the PR and between d91a25d and 04bcb63.

📒 Files selected for processing: 5
  • .ripr/traceability.toml
  • changelog.d/8101-sequence-test-comparison.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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@EffortlessSteven
EffortlessSteven marked this pull request as draft October 17, 2026 05:59
auto-merge was automatically disabled October 17, 2026 05:59

Pull request was converted to draft

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 05:59
@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 enabled auto-merge (squash) October 17, 2026 06:00

@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 recursion uses any() over element pairs; if the first pair is test-vs-non-literal it returns true, but if the first pair is literal-vs-non-literal it also returns true via the asserted-by-literal branch. A pair like (literal, non_literal) hit first would short-circuit before reaching a later test pair, capping that pair but matching the test-pair behavior. This is benign for this PR's goal (we want to cap), but is worth a question.
  • Confirm unit test covers [expected] vs [matches!(r, Err(E::Bad))] element pairing but does not explicitly assert that arrays of different lengths fall through to the literal/cast-bool paths unchanged; PR body notes 'Not done: sequences of different lengths' which is consistent but not test-pinned.
  • Confirm sequence_elements guards on array.starts_with('[') after strip_prefix('vec!')+trim_start; a literal preceded by whitespace like 'vec! [a,b]' trims the leading whitespace inside the literal and contents.len()+2==array.len() still holds, but 'vec![a,b]' vs '[a,b]' read fine. Marginal whitespace-only gap, not reachable from real assertions.

Refuted

  • sequence_elements returns Some for any square-bracketed side, allowing recursion into literal-only arrays like vec![true] vs vec![expected] and producing a false Weak cap; refuted because: Guarded by delimited_contents_at that requires array.starts_with('[') && contents.len()+2 == array.len(); a vec![true] vs vec![expected] still recurses but both elements are literal/literal (via literal_spelling_value after mask_comments_and_strings) so the recursion yields false and the outer branches fall through to whole_comparison_sides/literal checks. Existing test vec![r == Err(E::Bad)] vs vec![true] pins ExactErrorVariant/Strong, so literal-element path is preserved.
  • sequence_elements returns Some for any square-bracketed side regardless of contents, causing false recursion or trivial match for empty arrays.; refuted because: Guarded by array.starts_with('[') && contents.len()+2 == array.len() and explicit left.len()==right.len(); recursion requires a test-vs-non-literal pair to return true via the literal() branch.
  • sequence_elements returns Some for any bracketed side regardless of contents, causing false recursion or trivial match for empty arrays; refuted because: signature guards via delimited_contents_at (bracket-balance aware, skips masked regions) plus strict contents.len()+2==array.len() length match, plus the recursion itself requires a literal-vs-non-literal element pair to register a hit; empty arrays fail the length check.

Parked follow-ups

  • Behavior note from seeded review states repeat form vec![...; 3] vs vec![expected; 3] now also caps as a safe underclaim, not a regression of pin.
  • Repeat forms vec![x; n] are explicitly out of scope per PR body and review summary; sequence_elements rejects them because contents are not top-level comma-split, so a single-element test compared with a non-literal inside a repeat would still read strong. Parked for #8101 follow-up.

Copy link
Copy Markdown
Member Author

The Rust gates failure on head 9f2cab5 is not this PR's. cargo xtask goldens check reports one_hop_field_projection human.txt as formatting-only drift: the committed golden still has the pre-#8275 summary line. The fixture and the plain-language render both landed on main, so main fails this check too. #8351 already re-blesses these eight goldens (it is open and labelled merge-ready), and this diff touches no output or fixture. I'm not re-blessing them here, to avoid a conflict with #8351. Once #8351 merges I'll merge main into this branch and push so CI re-runs; the Python test failure from the earlier head is already gone.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as draft October 17, 2026 06:51
auto-merge was automatically disabled October 17, 2026 06:51

Pull request was converted to draft

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 06:51
@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 enabled auto-merge (squash) October 17, 2026 06:51

@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 unit test covers same-length element pairing and pins, but does not explicitly assert that arrays of different lengths fall through to the existing literal/cast-bool paths unchanged.
  • Confirm sequence_elements guard relies on contents.len()+2==array.len() after delimited_contents_at; nested bracket literals like [[a,b],c] would not satisfy and fall through, which is consistent with 'Not done: nested sequences'.

Refuted

  • Helper sequence_elements should be promoted to arguments.rs alongside split_top_level_commas to avoid future duplication across oracle classifiers.; refuted because: bool_operands.rs already houses the orchestrator (whole_comparison_sides, compares_test_with_non_literal); sequence_elements is a thin 5-line wrapper strictly used by that orchestrator, calling super::arguments helpers. Cross-module move expands PR surface beyond #8101 without functional gain and requires traceability/test updates.

Parked follow-ups

  • The unit test does not pin the 'unequal lengths fall through unchanged' path; PR body notes this is by design but the seam is not test-pinned. Keep parked; covered by the unchanged-when-unequal path through literal()/cast-bool() rejection which the seed already documents.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • mutation-witness not executed; profile disables build leases and cargo-mutants is a heavy/manual witness requiring --allow-heavy.

Copy link
Copy Markdown
Member Author

Rust gates on head a49f1ff fails again in cargo xtask goldens check, and it is not this PR's. #8412 (merged to main) added the stub-route line to human output and 35 fixture human.txt goldens now drift, so every PR on current main fails here. #8418 re-blesses exactly those 35 and is open and labelled merge-ready. This diff touches no output or fixtures. I'll merge main into the branch once #8418 lands and push so CI re-runs.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as draft October 17, 2026 07:21
auto-merge was automatically disabled October 17, 2026 07:21

Pull request was converted to draft

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 07:21
@settings settings Bot removed the merge-ready label Oct 17, 2026
…ct oracle (#8101)

assert_eq!(vec![r == Err(E::Bad)], vec![expected]) and the array and multi-element
forms read exact_error_variant/strong although the unwrapped comparison caps. Read
two same-length arrays or vec! literals element by element (RIPR-SPEC-0231 rule 1).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01352r3L9MMnGrWmdDZf6CHm
@EffortlessSteven
EffortlessSteven force-pushed the claude/project-thread-8gdu22 branch from 04989b0 to 04bcb63 Compare October 17, 2026 08:13
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 17, 2026 08:13
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 08:13

@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 reviewer attention before upstream: findings remain.

Confirmed findings

  • Test does not pin the documented 'unequal lengths / [x;n] / nested sequences fall through unchanged' seams; PR body marks these as 'not done' but no negative-case assertion guards against future regressions.
  • Element recursion uses .any() over pairs, so a literal-vs-non-literal pair hit before a test-vs-non-literal pair short-circuits true. This is benign for the cap goal but the unit test does not pin ordering behavior; minor architectural surface only.

Verification questions

  • Confirm sequence_elements recursion short-circuits via Any on element pairs; a (literal, non_literal) hit first still caps later (test, non_literal) pairs, aligned with the PR goal.
  • Confirm unit test does not pin unequal-length fall-through; PR body declares 'Not done: sequences of different lengths' as on main.

Refuted

  • Red/green pin is incomplete because 'unequal lengths fall through unchanged' is not test-pinned.; refuted because: False premise: PR body and RIPR-SPEC-0231 explicitly exclude that seam from this PR's scope; refuting it here would expand surface beyond #8101. The two genuine-pin assertions already guard the more important regression risk (over-capping).
  • Helper placement risks future copy-paste if another oracle classifier needs sequence element recursion; refuted because: Architecturally valid but premature: no current second caller exists, and the helper sits beside its orchestrator plus the spec change. YAGNI applies; a future PR can lift it when a second consumer appears.

Parked follow-ups

  • Unit test pins same-length element pairing and pinned strong cases, but does not pin the 'different lengths fall through unchanged' seam nor nested sequences.
  • Smallest-complete-fix: PR body 'Not done' boundaries (different lengths, repeat forms, nested sequences beyond element recursion) are explicit and test-pinned.
  • Whitespace-only edge case vec! [a,b] could miss the bracket parity check after trim; unreachable from real assertion macro invocations.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven merged commit d61523c into main Oct 17, 2026
35 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-8gdu22 branch October 17, 2026 11:02
EffortlessSteven added a commit that referenced this pull request Oct 18, 2026
#8101) (#8621)

* fix(oracles): a test held in a value wrapper is never exact (#8101)

`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

* fix(oracles): peel a wrapper off a literal-compared operand only when 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

* fix(oracles): a repeat array holds one value in the same-length sequence 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

* Cap empty repeats and mismatched constructors (review of 6b1c3c4)

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

* Cap tests in any unmatched value wrapper (review of ed1a892)

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

* Cap wrapped tests in unequal-length sequences; scope the spec to call, 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

---------

Co-authored-by: Claude <noreply@anthropic.com>
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