[PR #1687] vcmp16_opsel_probe: validate oracle batch/word types and handle run errors #1702

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/1687
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/vcmp16-opsel-probe-oracle-validation


📝 Commits (1)

  • 36f0b75 vcmp16_opsel_probe: validate oracle batch/word types and handle run errors

📊 Changes

2 files changed (+61 additions, -3 deletions)

View changed files

📝 tests/test_vcmp16_opsel_probe.py (+44 -0)
📝 tools/vcmp16_opsel_probe.py (+17 -3)

📄 Description

Item ID: VCMP16-OPSEL-PROBE-ORACLE-VALIDATION (claimed in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156727807)

Summary

  • Hardware oracle payload validation (tools/vcmp16_opsel_probe.py):
    • Require oracle.run(...) to return a list/tuple of exact length 1 (preventing non-sequence TypeError, string indexing, or silent extra-result drops).
    • Reject bool and non-int word elements inside the kernel word list with "harness error:" and exit 2 (masking valid ints to 32 bits).
  • Runtime error lifecycle:
    • Catch runner.Unavailable (exit 77) and RuntimeError (exit 2) raised during oracle.run() inside try ... finally: oracle.close().
  • Regression tests (tests/test_vcmp16_opsel_probe.py):
    • Added tests covering string/int/extra batch results, bool/None word elements, runner.Unavailable during run() -> exit 77, and RuntimeError during 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/vcmp16_opsel_probe.py tests/test_vcmp16_opsel_probe.py passed)
  • GPUs tested: none (hostless macOS synthetic/unit test run)
  • Tests run:
    • python3 -W error -I tests/test_vcmp16_opsel_probe.py -v: Ran 16 tests ... OK
    • Mutation test (new tests/test_vcmp16_opsel_probe.py against unpatched main tools/vcmp16_opsel_probe.py): Ran 16 tests ... FAILED (failures=3, errors=3)
    • 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/1687 **Author:** [@IlyassRS3](https://github.com/IlyassRS3) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/vcmp16-opsel-probe-oracle-validation` --- ### 📝 Commits (1) - [`36f0b75`](https://github.com/ubiquitarianism/leonida/commit/36f0b752467175ca4972c20e95957faaac180924) vcmp16_opsel_probe: validate oracle batch/word types and handle run errors ### 📊 Changes **2 files changed** (+61 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_vcmp16_opsel_probe.py` (+44 -0) 📝 `tools/vcmp16_opsel_probe.py` (+17 -3) </details> ### 📄 Description Item ID: `VCMP16-OPSEL-PROBE-ORACLE-VALIDATION` (claimed in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156727807) ## Summary - **Hardware oracle payload validation (`tools/vcmp16_opsel_probe.py`)**: - Require `oracle.run(...)` to return a `list`/`tuple` of exact length `1` (preventing non-sequence `TypeError`, string indexing, or silent extra-result drops). - Reject `bool` and non-`int` word elements inside the kernel word list with `"harness error:"` and exit `2` (masking valid ints to 32 bits). - **Runtime error lifecycle**: - Catch `runner.Unavailable` (exit `77`) and `RuntimeError` (exit `2`) raised during `oracle.run()` inside `try ... finally: oracle.close()`. - **Regression tests (`tests/test_vcmp16_opsel_probe.py`)**: - Added tests covering string/int/extra batch results, `bool`/`None` word elements, `runner.Unavailable` during `run()` -> exit `77`, and `RuntimeError` during `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/vcmp16_opsel_probe.py tests/test_vcmp16_opsel_probe.py` passed) - **GPUs tested**: none (hostless macOS synthetic/unit test run) - **Tests run**: - `python3 -W error -I tests/test_vcmp16_opsel_probe.py -v`: `Ran 16 tests ... OK` - Mutation test (new `tests/test_vcmp16_opsel_probe.py` against unpatched `main` `tools/vcmp16_opsel_probe.py`): `Ran 16 tests ... FAILED (failures=3, errors=3)` - `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#1702
No description provided.