f64_diff: harden CLI guards, validate hw oracle batch/word counts, and propagate HarnessError out of shrink() #1663

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

@⁠IlyassRS3 on GitHub · 2026-11-25 07:30 UTC · original
IlyassRS3:fix/f64-diff-cli-oracle-and-shrink → main · +105 −7 · 2 files · 1 commits · open

Item ID: F64-DIFF-CLI-ORACLE-AND-SHRINK
Claim: #1608

Summary

  • CLI validation (tools/f64_diff.py): reject empty/whitespace/trailing-comma --ops (previously --ops "" silently ran all 47 ops), deduplicate --ops tokens, reject empty --hw-arch/--exe (previously --exe "" silently fell back to default vk_harness), and reject zero-case runs (--no-sweep --programs 0 without --known) with exit 2.
  • Hardware oracle result & shrink validation: guard hw is None, exact batch length in run_batch(), exact single-result return in run_one(), and 4-word list/tuple payloads (previously a short word list like [0, 1] produced a false shader mismatch exit 1 instead of HarnessError exit 2). Propagate HarnessError out of shrink() instead of swallowing it.
  • GPU subprocess safety: add errors="replace" and OSError -> HarnessError handling to glslc, spirv-as, and vk_harness invocations in prepare_gpu() / run_gpu().
  • Tests (tests/test_f64_diff.py): add 2 regression tests covering all of the above (keeping existing all-skipped-exits-0 tests intact).

Verification

  • python3 -W error -I tests/test_f64_diff.py -v: 34 passed, 0 failed (1.112s).
  • Mutation check against unpatched main: ran=34, failures=12, errors=0.
  • python3 -m compileall -q tools/f64_diff.py tests/test_f64_diff.py, python3 -I tests/test_text_write_line_endings.py, python3 -I scripts/check_no_game_data.py: all pass.

AI-assisted: yes
GPUs tested: none (CPU unit tests with stubbed hardware oracle and SPIR-V interpreter; no game data)

**@⁠IlyassRS3** on GitHub · 2026-11-25 07:30 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1663) `IlyassRS3:fix/f64-diff-cli-oracle-and-shrink` → `main` · +105 −7 · 2 files · 1 commits · open Item ID: `F64-DIFF-CLI-ORACLE-AND-SHRINK` Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608 ## Summary - **CLI validation (`tools/f64_diff.py`)**: reject empty/whitespace/trailing-comma `--ops` (previously `--ops ""` silently ran all 47 ops), deduplicate `--ops` tokens, reject empty `--hw-arch`/`--exe` (previously `--exe ""` silently fell back to default `vk_harness`), and reject zero-case runs (`--no-sweep --programs 0` without `--known`) with exit `2`. - **Hardware oracle result & shrink validation**: guard `hw is None`, exact batch length in `run_batch()`, exact single-result return in `run_one()`, and 4-word list/tuple payloads (previously a short word list like `[0, 1]` produced a false shader mismatch exit `1` instead of `HarnessError` exit `2`). Propagate `HarnessError` out of `shrink()` instead of swallowing it. - **GPU subprocess safety**: add `errors="replace"` and `OSError` -> `HarnessError` handling to `glslc`, `spirv-as`, and `vk_harness` invocations in `prepare_gpu()` / `run_gpu()`. - **Tests (`tests/test_f64_diff.py`)**: add 2 regression tests covering all of the above (keeping existing all-skipped-exits-0 tests intact). ## Verification - `python3 -W error -I tests/test_f64_diff.py -v`: **34 passed, 0 failed** (1.112s). - Mutation check against unpatched `main`: **ran=34, failures=12, errors=0**. - `python3 -m compileall -q tools/f64_diff.py tests/test_f64_diff.py`, `python3 -I tests/test_text_write_line_endings.py`, `python3 -I scripts/check_no_game_data.py`: all pass. AI-assisted: yes GPUs tested: none (CPU unit tests with stubbed hardware oracle and SPIR-V interpreter; no game data)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:59:55 +00:00
Author
Owner

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

Independent verification (Windows, Python 3.11.9 -I -W error): --ops/--hw-arch/--exe empty-token guards, dedup via dict.fromkeys, zero-case guard placement verified (after --list-ops/--self-test, before oracle open), run_batch/run_one payload validation, shrink() HarnessError propagation, subprocess errors="replace"+OSError->HarnessError — all match claims. test_f64_diff.py 34 OK (matches claim); --self-test 11 invariants ok; all bad-CLI probes exit 2; compileall + line-endings + check_no_game_data clean. AI-assisted verification.

**@⁠whoalin1** on GitHub · 2026-11-25 09:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1663#issuecomment-7158365309) Independent verification (Windows, Python 3.11.9 `-I -W error`): `--ops`/`--hw-arch`/`--exe` empty-token guards, dedup via dict.fromkeys, zero-case guard placement verified (after --list-ops/--self-test, before oracle open), run_batch/run_one payload validation, shrink() HarnessError propagation, subprocess errors="replace"+OSError->HarnessError — all match claims. `test_f64_diff.py` 34 OK (matches claim); `--self-test` 11 invariants ok; all bad-CLI probes 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/1663/head:github-bot/gh-1663'
git switch 'github-bot/gh-1663'

Merge

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