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

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

📋 Pull Request Information

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

Base: main ← Head: fix/fspx-prologue-probe-oracle-and-cli


📝 Commits (1)

  • 59138bd fspx_prologue_probe: validate oracle batches/words, handle tuples/RuntimeError, reject empty --hw-arch

📊 Changes

2 files changed (+101 additions, -13 deletions)

View changed files

📝 tests/test_fspx_prologue_probe.py (+60 -0)
📝 tools/fspx_prologue_probe.py (+41 -13)

📄 Description

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

🔄 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/1685 **Author:** [@IlyassRS3](https://github.com/IlyassRS3) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/fspx-prologue-probe-oracle-and-cli` --- ### 📝 Commits (1) - [`59138bd`](https://github.com/ubiquitarianism/leonida/commit/59138bdc57f259d73ee287f8c2c644e8ad92bd47) fspx_prologue_probe: validate oracle batches/words, handle tuples/RuntimeError, reject empty --hw-arch ### 📊 Changes **2 files changed** (+101 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_fspx_prologue_probe.py` (+60 -0) 📝 `tools/fspx_prologue_probe.py` (+41 -13) </details> ### 📄 Description 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` --- <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#1699
No description provided.