texoff_probe: validate oracle batch/word payloads and handle run errors #1684

Open
github-bot wants to merge 1 commit from github-bot/gh-1684 into main AGit
Owner

@⁠IlyassRS3 on GitHub · 2026-11-25 08:04 UTC · original
IlyassRS3:fix/texoff-probe-oracle-validation → main · +95 −3 · 2 files · 1 commits · open

Item ID: TEXOFF-PROBE-ORACLE-VALIDATION (claimed in #1608)

Summary

  • Hardware oracle payload validation (tools/texoff_probe.py):
    • Validate that oracle.run([k]) returns a list/tuple of length 1, and that its non-string element is a list/tuple of exact length len(rows) containing only non-bool int words (masking w & 0xFFFFFFFF before the tsharp.POISON check and struct.pack("<I", ...)), returning exit 2 cleanly instead of crashing with IndexError/TypeError/struct.error or accepting extra/bool words.
  • 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_texoff_probe.py):
    • Added tests covering malformed batch/word payloads across wave32 and wave64, 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/texoff_probe.py tests/test_texoff_probe.py passed)
  • GPUs tested: none (hostless macOS synthetic/unit test run)
  • Tests run:
    • python3 -W error -I tests/test_texoff_probe.py -v: Ran 13 tests ... OK
    • Mutation test (new tests/test_texoff_probe.py against unpatched main tools/texoff_probe.py): Ran 13 tests ... FAILED (failures=8, errors=11)
    • python3 -m compileall -q make_game.py tools tests: passed
    • python3 -I tests/test_text_write_line_endings.py: Ran 3 tests ... OK
**@⁠IlyassRS3** on GitHub · 2026-11-25 08:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1684) `IlyassRS3:fix/texoff-probe-oracle-validation` → `main` · +95 −3 · 2 files · 1 commits · open Item ID: `TEXOFF-PROBE-ORACLE-VALIDATION` (claimed in https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ## Summary - **Hardware oracle payload validation (`tools/texoff_probe.py`)**: - Validate that `oracle.run([k])` returns a `list`/`tuple` of length `1`, and that its non-string element is a `list`/`tuple` of exact length `len(rows)` containing only non-bool `int` words (masking `w & 0xFFFFFFFF` before the `tsharp.POISON` check and `struct.pack("<I", ...)`), returning exit `2` cleanly instead of crashing with `IndexError`/`TypeError`/`struct.error` or accepting extra/bool words. - **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_texoff_probe.py`)**: - Added tests covering malformed batch/word payloads across wave32 and wave64, `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/texoff_probe.py tests/test_texoff_probe.py` passed) - **GPUs tested**: none (hostless macOS synthetic/unit test run) - **Tests run**: - `python3 -W error -I tests/test_texoff_probe.py -v`: `Ran 13 tests ... OK` - Mutation test (new `tests/test_texoff_probe.py` against unpatched `main` `tools/texoff_probe.py`): `Ran 13 tests ... FAILED (failures=8, errors=11)` - `python3 -m compileall -q make_game.py tools tests`: passed - `python3 -I tests/test_text_write_line_endings.py`: `Ran 3 tests ... OK`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:00:42 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 08:04 UTC · original · reviewed

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.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-25 08:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1684#pullrequestreview-6053852392) · **reviewed** 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.
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-25 08:41 UTC · original

Independent verification (Windows, Python 3.11.9 -I): oracle.run must return exactly-1 batch of list/tuple of non-bool ints (previously raw[0] could IndexError/TypeError); words masked before tsharp.POISON pack; Unavailable->77, RuntimeError->2 inside try/finally close. test_texoff_probe.py 13 OK; neighbors tex_mode_probe 37, d16_image_probe 13, image_d16_probe 22 all OK; --oracle hw->77 / bogus->exit 2; compileall + line-endings + check_no_game_data clean. AI-assisted verification.

**@⁠whoalin1** on GitHub · 2026-11-25 08:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1684#issuecomment-7157359874) Independent verification (Windows, Python 3.11.9 `-I`): oracle.run must return exactly-1 batch of list/tuple of non-bool ints (previously `raw[0]` could IndexError/TypeError); words masked before `tsharp.POISON` pack; `Unavailable`->77, `RuntimeError`->2 inside try/finally close. `test_texoff_probe.py` 13 OK; neighbors tex_mode_probe 37, d16_image_probe 13, image_d16_probe 22 all OK; `--oracle hw`->77 / bogus->exit 2; compileall + line-endings + `check_no_game_data` clean. AI-assisted verification.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1684/head:github-bot/gh-1684'
git switch 'github-bot/gh-1684'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1684'
git switch 'github-bot/gh-1684'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1684'
git switch 'github-bot/gh-1684'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1684'
git switch 'main'
git merge --squash 'github-bot/gh-1684'
git switch 'main'
git merge --ff-only 'github-bot/gh-1684'
git switch 'main'
git merge 'github-bot/gh-1684'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.