fspx_prologue_probe: validate oracle batches/words, handle tuples/RuntimeError, reject empty --hw-arch #1685

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

@⁠IlyassRS3 on GitHub · 2026-11-25 08:07 UTC · original
IlyassRS3:fix/fspx-prologue-probe-oracle-and-cli → main · +101 −13 · 2 files · 1 commits · open

Item ID: FSPX-PROLOGUE-PROBE-ORACLE-AND-CLI (claimed in #1608)

Summary

  • Hardware oracle batch/word validation (tools/fspx_prologue_probe.py):
    • Validate that oracle.run(all_kernels, words=64) returns a list/tuple matching len(all_kernels), preventing an empty or truncated batch from silently passing with PASS: 50/50 (exit 0).
    • Added _extract_words() to accept both list and tuple kernel outputs, verify at least k.words non-bool int words (masking to 32 bits), and raise RuntimeError (exit 2) on short/malformed payloads instead of crashing with StopIteration (on matching short prefixes or tuple rows) or IndexError (in negative-control checks), while preserving exit 1 for string kernel rejections.
  • RuntimeError & CLI handling:
    • Catch RuntimeError from oracle.run() inside run_hw() (printing harness error: to stderr and exiting 2 while closing the oracle).
    • Reject empty/whitespace --hw-arch with argparse exit code 2.
  • Regression tests (tests/test_fspx_prologue_probe.py):
    • Added tests covering empty --hw-arch, tuple oracle rows passing cleanly, empty/short/long/None/short-positive/short-negative/bool/None-row payloads exiting 2 (never false-passing or crashing), and RuntimeError during oracle.run() exiting 2 while closing the oracle.

Checklist & Verification

  • AI-assisted: yes
  • Game data included: none (python3 -I scripts/check_no_game_data.py tools/fspx_prologue_probe.py tests/test_fspx_prologue_probe.py passed)
  • GPUs tested: none (hostless macOS synthetic/unit test run)
  • Tests run:
    • python3 -W error -I tests/test_fspx_prologue_probe.py -v: Ran 7 tests ... OK
    • Mutation test (new tests/test_fspx_prologue_probe.py against unpatched main tools/fspx_prologue_probe.py): Ran 7 tests ... FAILED (failures=2, errors=1)
    • 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:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1685) `IlyassRS3:fix/fspx-prologue-probe-oracle-and-cli` → `main` · +101 −13 · 2 files · 1 commits · open Item ID: `FSPX-PROLOGUE-PROBE-ORACLE-AND-CLI` (claimed in https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ## Summary - **Hardware oracle batch/word validation (`tools/fspx_prologue_probe.py`)**: - Validate that `oracle.run(all_kernels, words=64)` returns a `list`/`tuple` matching `len(all_kernels)`, preventing an empty or truncated batch from silently passing with `PASS: 50/50` (exit `0`). - Added `_extract_words()` to accept both `list` and `tuple` kernel outputs, verify at least `k.words` non-bool `int` words (masking to 32 bits), and raise `RuntimeError` (exit `2`) on short/malformed payloads instead of crashing with `StopIteration` (on matching short prefixes or tuple rows) or `IndexError` (in negative-control checks), while preserving exit `1` for string kernel rejections. - **RuntimeError & CLI handling**: - Catch `RuntimeError` from `oracle.run()` inside `run_hw()` (printing `harness error:` to stderr and exiting `2` while closing the oracle). - Reject empty/whitespace `--hw-arch` with argparse exit code `2`. - **Regression tests (`tests/test_fspx_prologue_probe.py`)**: - Added tests covering empty `--hw-arch`, tuple oracle rows passing cleanly, empty/short/long/`None`/short-positive/short-negative/`bool`/`None`-row payloads exiting `2` (never false-passing or crashing), and `RuntimeError` during `oracle.run()` exiting `2` while closing the oracle. ## Checklist & Verification - **AI-assisted**: yes - **Game data included**: none (`python3 -I scripts/check_no_game_data.py tools/fspx_prologue_probe.py tests/test_fspx_prologue_probe.py` passed) - **GPUs tested**: none (hostless macOS synthetic/unit test run) - **Tests run**: - `python3 -W error -I tests/test_fspx_prologue_probe.py -v`: `Ran 7 tests ... OK` - Mutation test (new `tests/test_fspx_prologue_probe.py` against unpatched `main` `tools/fspx_prologue_probe.py`): `Ran 7 tests ... FAILED (failures=2, errors=1)` - `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:44 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 08:07 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:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1685#pullrequestreview-6053891134) · **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): _extract_words validates list/tuple rows of non-bool ints (>=k.words, masked 32-bit), batch length checked, malformed -> RuntimeError -> harness-error exit 2 (old StopIteration/IndexError crashes gone), --hw-arch empty/whitespace rejected. test_fspx_prologue_probe.py 7 OK; --self-test ok (50 prologue cases + 8 negative controls); --hw-arch ""/" " -> 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/1685#issuecomment-7157359218) Independent verification (Windows, Python 3.11.9 `-I`): `_extract_words` validates list/tuple rows of non-bool ints (>=k.words, masked 32-bit), batch length checked, malformed -> `RuntimeError` -> harness-error exit 2 (old StopIteration/IndexError crashes gone), `--hw-arch` empty/whitespace rejected. `test_fspx_prologue_probe.py` 7 OK; `--self-test` ok (50 prologue cases + 8 negative controls); `--hw-arch ""`/`" "` -> 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/1685/head:github-bot/gh-1685'
git switch 'github-bot/gh-1685'

Merge

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