sampler_lod_probe: validate oracle payloads, non-finite calibration starts, and run errors #1676

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

@⁠IlyassRS3 on GitHub · 2026-11-25 07:50 UTC · original
IlyassRS3:fix/sampler-lod-probe-oracle-and-calibration → main · +101 −4 · 2 files · 1 commits · open

Item ID: SAMPLER-LOD-PROBE-ORACLE-AND-CALIBRATION (claimed in #1608)

Summary

  • Hardware oracle payload validation (tools/sampler_lod_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(table) containing only non-bool int words (masking w & 0xFFFFFFFF before struct.pack("<I", ...)), returning exit 2 with a clear diagnostic instead of crashing with uncaught IndexError/TypeError/struct.error or accepting extra/bool words.
  • Calibration finiteness & runtime error lifecycle:
    • Reject non-finite (inf/NaN) calibration level starts with exit 2 instead of accepting +inf as a valid level start when wave32 and wave64 agree.
    • Catch runner.Unavailable (exit 77) and RuntimeError (exit 2) raised during oracle.run() inside try ... finally: oracle.close().
  • Regression tests (tests/test_sampler_lod_probe.py):
    • Added tests covering malformed batch/word payloads across wave32 and wave64, +inf calibration start rejection, 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/sampler_lod_probe.py tests/test_sampler_lod_probe.py passed)
  • GPUs tested: none (hostless macOS synthetic/unit test run)
  • Tests run:
    • python3 -W error -I tests/test_sampler_lod_probe.py -v: Ran 15 tests ... OK
    • Mutation test (new tests/test_sampler_lod_probe.py against unpatched main tools/sampler_lod_probe.py): Ran 15 tests ... FAILED (failures=9, errors=10)
    • 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:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1676) `IlyassRS3:fix/sampler-lod-probe-oracle-and-calibration` → `main` · +101 −4 · 2 files · 1 commits · open Item ID: `SAMPLER-LOD-PROBE-ORACLE-AND-CALIBRATION` (claimed in https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ## Summary - **Hardware oracle payload validation (`tools/sampler_lod_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(table)` containing only non-bool `int` words (masking `w & 0xFFFFFFFF` before `struct.pack("<I", ...)`), returning exit `2` with a clear diagnostic instead of crashing with uncaught `IndexError`/`TypeError`/`struct.error` or accepting extra/bool words. - **Calibration finiteness & runtime error lifecycle**: - Reject non-finite (`inf`/`NaN`) calibration level starts with exit `2` instead of accepting `+inf` as a valid level start when wave32 and wave64 agree. - Catch `runner.Unavailable` (exit `77`) and `RuntimeError` (exit `2`) raised during `oracle.run()` inside `try ... finally: oracle.close()`. - **Regression tests (`tests/test_sampler_lod_probe.py`)**: - Added tests covering malformed batch/word payloads across wave32 and wave64, `+inf` calibration start rejection, `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/sampler_lod_probe.py tests/test_sampler_lod_probe.py` passed) - **GPUs tested**: none (hostless macOS synthetic/unit test run) - **Tests run**: - `python3 -W error -I tests/test_sampler_lod_probe.py -v`: `Ran 15 tests ... OK` - Mutation test (new `tests/test_sampler_lod_probe.py` against unpatched `main` `tools/sampler_lod_probe.py`): `Ran 15 tests ... FAILED (failures=9, errors=10)` - `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:25 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 07:50 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:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1676#pullrequestreview-6053703902) · **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:52 UTC · original

Independent verification (Windows, Python 3.11.9 -I -W error): oracle batch/word validation (len-1 batch, exact table length, non-bool ints masked before POISON pack — comparison correctly uses masked value), non-finite calibration-start guard, Unavailable->77 / RuntimeError->2 with finally-close — all match claims. test_sampler_lod_probe.py 15 OK; --oracle rule full run exit 0; bad --oracle -> argparse exit 2; compileall + line-endings + check_no_game_data clean. AI-assisted verification.

**@⁠whoalin1** on GitHub · 2026-11-25 08:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1676#issuecomment-7157578176) Independent verification (Windows, Python 3.11.9 `-I -W error`): oracle batch/word validation (len-1 batch, exact table length, non-bool ints masked before POISON pack — comparison correctly uses masked value), non-finite calibration-start guard, Unavailable->77 / RuntimeError->2 with finally-close — all match claims. `test_sampler_lod_probe.py` 15 OK; `--oracle rule` full run exit 0; bad `--oracle` -> argparse 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/1676/head:github-bot/gh-1676'
git switch 'github-bot/gh-1676'

Merge

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