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

Merged
IlyassRS3 merged 1 commit from upstream-pr/1685 into main 2026-11-28 13:33:45 +00:00
IlyassRS3 commented 2026-11-25 08:07:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T08:07:19Z.


Item ID: FSPX-PROLOGUE-PROBE-ORACLE-AND-CLI (claimed in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156604721)

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
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5487547636 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1685). Originally posted by [IlyassRS3](https://github.com/IlyassRS3) on 2026-11-25T08:07:19Z. --- Item ID: `FSPX-PROLOGUE-PROBE-ORACLE-AND-CLI` (claimed in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156604721) ## 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`
copilot-pull-request-reviewer[bot] commented 2026-11-25 08:07:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T08:07:33Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6053891134 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1685#pullrequestreview-6053891134). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-25T08:07:33Z. **Review:** COMMENTED --- 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.
whoalin1 commented 2026-11-25 08:41:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T08:41:54Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7157359218 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1685#issuecomment-7157359218). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-25T08:41:54Z. --- 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.
MoonEyes commented 2026-11-28 13:33:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T13:33:48Z.


Merged after local re-verification: this PR merged onto main 0318164b8 without conflict, and its test file(s) (tests/test_fspx_prologue_probe.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7240023980 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1685#issuecomment-7240023980). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T13:33:48Z. --- Merged after local re-verification: this PR merged onto `main` 0318164b8 without conflict, and its test file(s) (`tests/test_fspx_prologue_probe.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1685
No description provided.