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

Open
opened 2026-11-26 20:22:09 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1690
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/smem-neg-probe-run-errors


📝 Commits (1)

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

📊 Changes

2 files changed (+50 additions, -1 deletions)

View changed files

📝 tests/test_smem_neg_probe.py (+43 -0)
📝 tools/smem_neg_probe.py (+7 -1)

📄 Description

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1690 **Author:** [@IlyassRS3](https://github.com/IlyassRS3) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/smem-neg-probe-run-errors` --- ### 📝 Commits (1) - [`b1a2545`](https://github.com/ubiquitarianism/leonida/commit/b1a254502c109bcf0b141218dd3b084aacdbac93) smem_neg_probe: handle Unavailable/RuntimeError during oracle.run() and mask 32-bit words ### 📊 Changes **2 files changed** (+50 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_smem_neg_probe.py` (+43 -0) 📝 `tools/smem_neg_probe.py` (+7 -1) </details> ### 📄 Description 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` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1704
No description provided.