fma_mix_literal_probe: harden CLI parsing, hw oracle validation, and word masking #1672

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

@⁠IlyassRS3 on GitHub · 2026-11-25 07:43 UTC · original
IlyassRS3:fix/fma-mix-literal-probe-cli-and-oracle → main · +90 −2 · 2 files · 1 commits · open

Item ID: FMA-MIX-LITERAL-PROBE-CLI-AND-ORACLE (claimed in #1608)

Summary

  • Hardware oracle validation & Unavailable handling (tools/fma_mix_literal_probe.py):
    • In run_hw(), validate that oracle.run() returns a list/tuple matching len(cases) and that every non-string entry is a non-empty list/tuple whose first element is an int (not bool), raising RuntimeError (exit 2) instead of silently truncating via zip() or crashing with uncaught IndexError/TypeError.
    • Catch runner.Unavailable inside the run_hw() try/finally block in main() so ModeUnavailable during oracle.run() exits 77 cleanly while closing the oracle.
  • CLI validation & word masking:
    • Reject empty/whitespace --hw-arch and empty/trailing-comma --oracle tokens ("", "hw,", ",translator") with argparse exit code 2.
    • Mask word &= 0xFFFFFFFF in verdict() before exact 32-bit comparison.
  • Regression tests (tests/test_fma_mix_literal_probe.py):
    • Added tests covering malformed/empty CLI flags, malformed hw oracle payloads + Unavailable during run() + oracle closure, and 32-bit word masking in verdict().

Checklist & Verification

  • AI-assisted: yes
  • Game data included: none (python3 -I scripts/check_no_game_data.py tools/fma_mix_literal_probe.py tests/test_fma_mix_literal_probe.py passed)
  • GPUs tested: none (hostless macOS synthetic/unit test run)
  • Tests run:
    • python3 -W error -I tests/test_fma_mix_literal_probe.py -v: Ran 10 tests ... OK
    • Mutation test (new tests/test_fma_mix_literal_probe.py against unpatched main tools/fma_mix_literal_probe.py): Ran 10 tests ... FAILED (failures=9, 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
**@⁠IlyassRS3** on GitHub · 2026-11-25 07:43 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1672) `IlyassRS3:fix/fma-mix-literal-probe-cli-and-oracle` → `main` · +90 −2 · 2 files · 1 commits · open Item ID: `FMA-MIX-LITERAL-PROBE-CLI-AND-ORACLE` (claimed in https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ## Summary - **Hardware oracle validation & `Unavailable` handling (`tools/fma_mix_literal_probe.py`)**: - In `run_hw()`, validate that `oracle.run()` returns a `list`/`tuple` matching `len(cases)` and that every non-string entry is a non-empty `list`/`tuple` whose first element is an `int` (not `bool`), raising `RuntimeError` (exit `2`) instead of silently truncating via `zip()` or crashing with uncaught `IndexError`/`TypeError`. - Catch `runner.Unavailable` inside the `run_hw()` `try/finally` block in `main()` so `ModeUnavailable` during `oracle.run()` exits `77` cleanly while closing the oracle. - **CLI validation & word masking**: - Reject empty/whitespace `--hw-arch` and empty/trailing-comma `--oracle` tokens (`""`, `"hw,"`, `",translator"`) with argparse exit code `2`. - Mask `word &= 0xFFFFFFFF` in `verdict()` before exact 32-bit comparison. - **Regression tests (`tests/test_fma_mix_literal_probe.py`)**: - Added tests covering malformed/empty CLI flags, malformed hw oracle payloads + `Unavailable` during `run()` + oracle closure, and 32-bit word masking in `verdict()`. ## Checklist & Verification - **AI-assisted**: yes - **Game data included**: none (`python3 -I scripts/check_no_game_data.py tools/fma_mix_literal_probe.py tests/test_fma_mix_literal_probe.py` passed) - **GPUs tested**: none (hostless macOS synthetic/unit test run) - **Tests run**: - `python3 -W error -I tests/test_fma_mix_literal_probe.py -v`: `Ran 10 tests ... OK` - Mutation test (new `tests/test_fma_mix_literal_probe.py` against unpatched `main` `tools/fma_mix_literal_probe.py`): `Ran 10 tests ... FAILED (failures=9, 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`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:00:14 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 07:43 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 07:43 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1672#pullrequestreview-6053626585) · **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.
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/1672/head:github-bot/gh-1672'
git switch 'github-bot/gh-1672'

Merge

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