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

Merged
leonida/mandy
quietfold merged 1 commit from fix/smem-neg-probe-run-errors into main 2026-11-28 14:55:35 +00:00

Pull request successfully merged and closed

quietfold commented 2026-11-25 08:19:05 +00:00

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
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] reviewed 2026-11-25 08:19:20 +00:00
copilot-pull-request-reviewer[bot] left a comment
No description provided.
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

#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.

#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

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)

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 description provided.