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

Merged
leonida/mandy
quietfold merged 1 commit from fix/f64-diff-cli-oracle-and-shrink into main 2026-11-28 14:47:41 +00:00

Pull request successfully merged and closed

quietfold commented 2026-11-25 07:30:19 +00:00

Item ID: F64-DIFF-CLI-ORACLE-AND-SHRINK
Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155892025

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)

Item ID: `F64-DIFF-CLI-ORACLE-AND-SHRINK` Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155892025 ## 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)
copilot-pull-request-reviewer[bot] reviewed 2026-11-25 07:30:31 +00:00
copilot-pull-request-reviewer[bot] left a comment
No description provided.
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 09:27:52 +00:00

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.

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.
MoonEyes commented 2026-11-28 14:47:38 +00:00

Red/green: classified READY by cloud-6 (red on main 09c153948, green on head merged with main); head 2ddbf4b48b52 unchanged since 2026-11-25, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: classified READY by cloud-6 (red on main 09c153948, green on head merged with main); head 2ddbf4b48b52 unchanged since 2026-11-25, before that run. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No description provided.