Repository navigation
fix(oracles): a test inside two same-length sequences is never an exact oracle (#8101) - #8370
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
In-session proof plus independent review (Sonnet subagent) of exact head e8112f4 on main f2603bc. Hosted CI runs from the merge-ready label.
Generated by Claude Code |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
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.
CI Failure Diagnosis on Rust Gates (
|
|
The failed Generated by Claude Code |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
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. View limit details
Comment |
Pull request was converted to draft
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
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_elementsrejects 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.
|
The Generated by Claude Code |
Pull request was converted to draft
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
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.
|
Generated by Claude Code |
Pull request was converted to draft
…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
04989b0 to
04bcb63
Compare
There was a problem hiding this comment.
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.
#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>
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)]againstvec[y, expected]and[matches!(r, Err(E::Bad))]against[expected]readexact_error_variant/strong, although the unwrapped comparison caps becauseexpectedmay 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 atrelational_check/weak (RIPR-SPEC-0231 rule 1). A literal element (vec[r == Err(E::Bad)]againstvec[true]) and plain values (vec[total(2)]againstvec[expected]orvec[5]) keep their readings.How:
compares_test_with_non_literalnow hands its two sides tosides_compare_test_with_non_literal, which gains asequence_elementsstep (an optionalvec!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 achangelog.dfragment.Proof: on main f2603bc the listed spellings read
ExactErrorVariant/Strong. On this headcargo xtask precommitexits 0,cargo test -p ripr --lib analysis::extractpasses (225), andcargo xtask verdict-corpus check-allexits 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