Repository navigation
Make slice reference mismatches fail the snippet - #9746
Conversation
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
|
Caution Review failedThe pull request is closed.
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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") |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
builtin_slice.test_all_slices()collected and printed comparison failures but still exited successfully. RaiseAssertionErrorafter 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:
AssertionError: 1 slices failedVerified 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.