smem_neg_probe: handle Unavailable/RuntimeError during oracle.run() and mask 32-bit words #1690

Merged
IlyassRS3 merged 1 commit from upstream-pr/1690 into main 2026-11-28 14:55:35 +00:00
IlyassRS3 commented 2026-11-25 08:19:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T08:19:05Z.


Item ID: SMEM-NEG-PROBE-RUN-ERRORS (claimed in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156857639)

Summary

  • Runtime error lifecycle & 32-bit word masking (tools/smem_neg_probe.py):
    • Catch runner.Unavailable (exit 77) and RuntimeError (exit 2) raised during oracle.run() inside try ... finally: oracle.close() instead of crashing with unhandled tracebacks.
    • Mask oracle words with & 0xFFFFFFFF before comparing with expected 32-bit words and formatting.
  • Regression tests (tests/test_smem_neg_probe.py):
    • Added tests covering 32-bit word masking, runner.Unavailable during oracle.run() -> exit 77, and RuntimeError during oracle.run() -> exit 2, verifying oracle.close() on every path.

Checklist & Verification

  • AI-assisted: yes
  • Game data included: none (python3 -I scripts/check_no_game_data.py tools/smem_neg_probe.py tests/test_smem_neg_probe.py passed)
  • GPUs tested: none (hostless macOS synthetic/unit test run)
  • Tests run:
    • python3 -W error -I tests/test_smem_neg_probe.py -v: Ran 12 tests ... OK
    • Mutation test (new tests/test_smem_neg_probe.py against unpatched main tools/smem_neg_probe.py): Ran 12 tests ... FAILED (failures=1)
    • python3 -m compileall -q make_game.py tools tests: passed
    • python3 -I tests/test_text_write_line_endings.py: Ran 3 tests ... OK
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5487695826 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1690). Originally posted by [IlyassRS3](https://github.com/IlyassRS3) on 2026-11-25T08:19:05Z. --- Item ID: `SMEM-NEG-PROBE-RUN-ERRORS` (claimed in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156857639) ## Summary - **Runtime error lifecycle & 32-bit word masking (`tools/smem_neg_probe.py`)**: - Catch `runner.Unavailable` (exit `77`) and `RuntimeError` (exit `2`) raised during `oracle.run()` inside `try ... finally: oracle.close()` instead of crashing with unhandled tracebacks. - Mask oracle words with `& 0xFFFFFFFF` before comparing with expected 32-bit words and formatting. - **Regression tests (`tests/test_smem_neg_probe.py`)**: - Added tests covering 32-bit word masking, `runner.Unavailable` during `oracle.run()` -> exit `77`, and `RuntimeError` during `oracle.run()` -> exit `2`, verifying `oracle.close()` on every path. ## Checklist & Verification - **AI-assisted**: yes - **Game data included**: none (`python3 -I scripts/check_no_game_data.py tools/smem_neg_probe.py tests/test_smem_neg_probe.py` passed) - **GPUs tested**: none (hostless macOS synthetic/unit test run) - **Tests run**: - `python3 -W error -I tests/test_smem_neg_probe.py -v`: `Ran 12 tests ... OK` - Mutation test (new `tests/test_smem_neg_probe.py` against unpatched `main` `tools/smem_neg_probe.py`): `Ran 12 tests ... FAILED (failures=1)` - `python3 -m compileall -q make_game.py tools tests`: passed - `python3 -I tests/test_text_write_line_endings.py`: `Ran 3 tests ... OK`
copilot-pull-request-reviewer[bot] commented 2026-11-25 08:19:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T08:19:20Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6054025723 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1690#pullrequestreview-6054025723). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-25T08:19:20Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
zmasi commented 2026-11-28 11:25:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T11:25:11Z.


#1690 | head b1a254502c (merged cleanly with main 4a54aedcb) | python -I tests/test_smem_neg_probe.py | red on main: FAILED (failures=1) (1 != 0 when oracle words carry high bits above bit 31, plus uncaught runner.Unavailable / RuntimeError during oracle.run()) | green on PR+main: 12 tests OK | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited 32-bit w & 0xFFFFFFFF word masking and runner.Unavailable -> exit 77 + RuntimeError -> exit 2 handling inside try / finally: oracle.close() in tools/smem_neg_probe.py. Also passed tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238538557 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1690#issuecomment-7238538557). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T11:25:11Z. --- #1690 | head b1a254502c109bcf0b141218dd3b084aacdbac93 (merged cleanly with main 4a54aedcb) | `python -I tests/test_smem_neg_probe.py` | red on main: `FAILED (failures=1)` (`1 != 0` when oracle words carry high bits above bit 31, plus uncaught `runner.Unavailable` / `RuntimeError` during `oracle.run()`) | green on PR+main: `12 tests OK` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited 32-bit `w & 0xFFFFFFFF` word masking and `runner.Unavailable -> exit 77` + `RuntimeError -> exit 2` handling inside `try` / `finally: oracle.close()` in `tools/smem_neg_probe.py`. Also passed `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py`.
MoonEyes commented 2026-11-28 14:55:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:55:32Z.


Red/green: pytest tests/test_smem_neg_probe.py fails on main (1 failed, 11 passed, 22 subtests passed) and passes on head b1a254502c merged with main (12 passed, 22 subtests passed).
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241042256 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1690#issuecomment-7241042256). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T14:55:32Z. --- Red/green: `pytest tests/test_smem_neg_probe.py` fails on main (1 failed, 11 passed, 22 subtests passed) and passes on head b1a254502c10 merged with main (12 passed, 22 subtests passed). Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1690
No description provided.