Skip to content

Make slice reference mismatches fail the snippet - #9746

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:test/slice-fixture-failure-20261108
Nov 8, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:test/slice-fixture-failure-20261108

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

builtin_slice.test_all_slices() collected and printed comparison failures but still exited successfully. Raise AssertionError after printing the diagnostics so the snippet harness and CI actually fail. Also fix the reversed expected/actual values in the diagnostic.

This is a two-line test-only change on main. It is independent of #9745: it fixes the existing snippet used by the native harness as well as the WASI coverage enabled there, without duplicating its workflow changes.

Verification

Using the existing generator with CPython 3.15.1:

Fixture Original snippet Patched snippet
Correct 2,250 reference cases pass pass
One deliberately incorrect reference incorrectly exits 0 exits 1 with AssertionError: 1 slices failed

Verified both outcomes on CPython 3.15.1 and RustPython wasm32-wasip1 / Wasmer 7.5.0. The WASI checks reused the previously built interpreter; this patch changes no interpreter code. Pre-commit hooks and independent review pass. Native workspace/CAPI aggregate tests and Clippy were not rerun locally for this test-only change; GitHub CI remains pending.

AI assistance: OpenAI Codex diagnosed the false-positive test, made the two-line change, ran positive and negative controls, and reviewed the result independently.

Preserve all slice diagnostics but raise instead of merely printing the failure count. Correct the expected and actual values in each diagnostic.

Assisted-by: OpenAI Codex:version-unavailable
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@youknowone
youknowone marked this pull request as ready for review November 8, 2026 11:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T11:02:55.821719Z 7eaa023 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@youknowone
youknowone merged commit 615f00f into RustPython:main Nov 8, 2026
20 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7eaa02371c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

for f in failures:
print(f)
print(len(failures), "slices failed")
raise AssertionError(f"{len(failures)} slices failed")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the existing snippet test logic

Replacing the summary print with raise changes the pass/fail logic of the existing test_all_slices(). Root AGENTS.md explicitly says “NEVER modify test assertions, test logic, or test data”; this restriction applies to snippet tests too. Preserve the existing function and add separate fail-on-mismatch coverage using the permitted new-test approach, or obtain an explicit policy exception before changing its logic.

AGENTS.md reference: AGENTS.md:L278-L278

Useful? React with 👍 / 👎.

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.

3 participants