cvt_f16_omod_probe: harden --modes/--waves, upfront atomic JSON writes, and result count guard #1639

Merged
leonida/mandy
quietfold merged 1 commit from fix/cvt-f16-omod-probe-json-and-cli into main 2026-11-28 11:43:10 +00:00

Pull request successfully merged and closed

quietfold commented 2026-11-25 06:44:52 +00:00

Item ID: CVT-F16-OMOD-PROBE-JSON-AND-CLI
Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155090450

Summary

Harden CLI argument parsing, JSON report writing, and harness error handling in tools/cvt_f16_omod_probe.py:

  • --modes / --waves / --hw-arch guards: reject empty/trailing comma tokens (32,, ,rne_d0_i0, 32,,64), deduplicate repeated modes/waves so kernels and total_cases are not double-counted (and --waves 32,32 does not diff wave32 against itself), and reject empty/whitespace --hw-arch.
  • Upfront --json validation: reject empty/whitespace paths, trailing separators, directories, non-directory parent blockers, and unwritable existing targets before opening hw_oracle.
  • Atomic write_report(): serialize upfront with allow_nan=False and LF endings, handle non-regular targets like /dev/null directly, resolve symlinks before staging to preserve symlink targets, apply file_mode.published_mode, and publish via replace_retry.replace.
  • Harness guards: return a harness_errors entry when len(raw_results) != len(meta) in evaluate_results() (preventing KeyError after zip() truncation), and catch ValueError from asm.family(oracle.arch) cleanly (exit 77).
  • Tests (tests/test_cvt_f16_omod_probe.py): added 4 test methods covering malformed/duplicate --modes/--waves, empty --hw-arch/--json, upfront blocker/trailing-sep rejection, atomic/symlink/NaN//dev/null writes, result count mismatch, and unknown arch family.

Verification

  • AI-assisted: yes
  • GPUs tested: none (CPU synthetic unit tests + FakeOracle on macOS; no GPU, AMD clang, or game data present)
  • python3 -W error -I tests/test_cvt_f16_omod_probe.py -v: 15 passed, 1 skipped (AMD clang absent)
  • Mutation check against unpatched main: ran=16 failures=2 errors=11 (skipped=1)
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed
  • python3 -I scripts/check_no_game_data.py tools/cvt_f16_omod_probe.py tests/test_cvt_f16_omod_probe.py: passed
  • python3 -m compileall -q tools/cvt_f16_omod_probe.py tests/test_cvt_f16_omod_probe.py: passed
Item ID: `CVT-F16-OMOD-PROBE-JSON-AND-CLI` Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155090450 ### Summary Harden CLI argument parsing, JSON report writing, and harness error handling in `tools/cvt_f16_omod_probe.py`: - **`--modes` / `--waves` / `--hw-arch` guards**: reject empty/trailing comma tokens (`32,`, `,rne_d0_i0`, `32,,64`), deduplicate repeated modes/waves so kernels and `total_cases` are not double-counted (and `--waves 32,32` does not diff wave32 against itself), and reject empty/whitespace `--hw-arch`. - **Upfront `--json` validation**: reject empty/whitespace paths, trailing separators, directories, non-directory parent blockers, and unwritable existing targets *before* opening `hw_oracle`. - **Atomic `write_report()`**: serialize upfront with `allow_nan=False` and LF endings, handle non-regular targets like `/dev/null` directly, resolve symlinks before staging to preserve symlink targets, apply `file_mode.published_mode`, and publish via `replace_retry.replace`. - **Harness guards**: return a `harness_errors` entry when `len(raw_results) != len(meta)` in `evaluate_results()` (preventing `KeyError` after `zip()` truncation), and catch `ValueError` from `asm.family(oracle.arch)` cleanly (exit `77`). - **Tests (`tests/test_cvt_f16_omod_probe.py`)**: added 4 test methods covering malformed/duplicate `--modes`/`--waves`, empty `--hw-arch`/`--json`, upfront blocker/trailing-sep rejection, atomic/symlink/NaN/`/dev/null` writes, result count mismatch, and unknown arch family. ### Verification - AI-assisted: yes - GPUs tested: none (CPU synthetic unit tests + FakeOracle on macOS; no GPU, AMD clang, or game data present) - `python3 -W error -I tests/test_cvt_f16_omod_probe.py -v`: 15 passed, 1 skipped (AMD clang absent) - Mutation check against unpatched `main`: `ran=16 failures=2 errors=11 (skipped=1)` - `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed - `python3 -I scripts/check_no_game_data.py tools/cvt_f16_omod_probe.py tests/test_cvt_f16_omod_probe.py`: passed - `python3 -m compileall -q tools/cvt_f16_omod_probe.py tests/test_cvt_f16_omod_probe.py`: passed
copilot-pull-request-reviewer[bot] reviewed 2026-11-25 06:45:08 +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:52:50 +00:00

Independent verification (Windows, Python 3.11.9 -I -W error): --modes/--waves malformed-token rejection, empty --hw-arch/--json guards, dedup, upfront atomic JSON writes, result-count guard — all match claims. test_cvt_f16_omod_probe.py 16 OK (1 skip, matches body); --self-test ok (36 inputs, 1440 cases/wave); hygiene checks clean. AI-assisted verification.

Independent verification (Windows, Python 3.11.9 `-I -W error`): `--modes`/`--waves` malformed-token rejection, empty `--hw-arch`/`--json` guards, dedup, upfront atomic JSON writes, result-count guard — all match claims. `test_cvt_f16_omod_probe.py` 16 OK (1 skip, matches body); `--self-test` ok (36 inputs, 1440 cases/wave); hygiene checks clean. AI-assisted verification.
sodove commented 2026-11-28 11:27:05 +00:00

#1639 | head 11d2b004900316331b205c3920fa531be913bfe7 | python3 -I tests/test_cvt_f16_omod_probe.py -v | red: 16 run, 2 failures, 11 errors | green: 16 passed | Red → green

The suite covers malformed CLI input, report publication, oracle result lengths and assembly checks. The merged tests passed with AMD clang available.

Copied the PR tests onto clean main 4a54aedcb6b66525e0c9f72a6ea10263337c9141 for the baseline, then merged that main into the recorded PR head and reran those files. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. Batch claim.

#1639 | head `11d2b004900316331b205c3920fa531be913bfe7` | `python3 -I tests/test_cvt_f16_omod_probe.py -v` | red: 16 run, 2 failures, 11 errors | green: 16 passed | **Red → green** The suite covers malformed CLI input, report publication, oracle result lengths and assembly checks. The merged tests passed with AMD clang available. Copied the PR tests onto clean main `4a54aedcb6b66525e0c9f72a6ea10263337c9141` for the baseline, then merged that main into the recorded PR head and reran those files. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7238450840).
DadaCap commented 2026-11-28 11:43:12 +00:00

Merged, thank you @IlyassRS3! This PR (cvt_f16_omod_probe: harden --modes/--waves, upfront atomic JSON writes, and result count guard) passed its own tests with main merged in during sodove's verification of this shader batch, so it went in with the batch.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

Merged, thank you @IlyassRS3! This PR (cvt_f16_omod_probe: harden --modes/--waves, upfront atomic JSON writes, and result count guard) passed its own tests with main merged in during sodove's verification of this shader batch, so it went in with the batch. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.
Sign in to join this conversation.
No description provided.