cvt_diff: reject empty/zero-program runs, invalid counts, and malformed --ops; accept argv (CVT-DIFF-CLI-AND-EMPTY-RUN-GUARDS) #1615

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

@⁠IlyassRS3 on GitHub · 2026-11-25 06:04 UTC · original
IlyassRS3:fix/cvt-diff-cli-and-empty-run-guards → main · +89 −7 · 2 files · 1 commits · open

Item ID: CVT-DIFF-CLI-AND-EMPTY-RUN-GUARDS (unlisted; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at submission time, and no open PR touches tools/cvt_diff.py).

What changed

  • Reject zero-program / empty runs and invalid counts (tools/cvt_diff.py, main, run_suite):
    • Previously --no-sweep --programs 0 and --no-sweep --programs 0 --exhaustive-f16 --ops v_cvt_flr_i32_f32 (an f32 op where the f16 exhaustive stage generates zero programs) printed 0/0 programs match and exited 0 (false pass). Now empty configurations are refused upfront and any total_run == 0 run exits 2.
    • Reject --programs < 0 and --max-ops < 1 (previously --max-ops 0 crashed inside rng.randint(1, max_ops)), and validate programs / max_ops in run_suite() against negative and bool values.
  • Harden --ops parsing and accept argv=None in main(argv=None): reject empty/blank/trailing-comma --ops (previously --ops "" silently ran all 8 ops) and deduplicate repeated op names so sweep/grid/random counts aren't skewed.
  • Synthetic regression tests (tests/test_cvt_diff.py): 4 new tests in CliGuards covering all of the above (no game files, no GPU).

Verification

  • AI-assisted: yes
  • GPUs tested: none (CPU-only Python tool on macOS)
  • python3 -W error -I tests/test_cvt_diff.py -v: 30 passed
  • python3 -W error -I tests/test_text_write_line_endings.py: passed
  • python3 -I scripts/check_no_game_data.py tools/cvt_diff.py tests/test_cvt_diff.py: clean
  • python3 -m compileall -q tools/cvt_diff.py tests/test_cvt_diff.py: clean
  • Mutation test (CliGuards suite of tests/test_cvt_diff.py against unpatched main:tools/cvt_diff.py): 11 failures, 3 errors across the 4 CLI tests.
**@⁠IlyassRS3** on GitHub · 2026-11-25 06:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1615) `IlyassRS3:fix/cvt-diff-cli-and-empty-run-guards` → `main` · +89 −7 · 2 files · 1 commits · open Item ID: `CVT-DIFF-CLI-AND-EMPTY-RUN-GUARDS` (unlisted; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at submission time, and no open PR touches `tools/cvt_diff.py`). ## What changed - **Reject zero-program / empty runs and invalid counts (`tools/cvt_diff.py`, `main`, `run_suite`)**: - Previously `--no-sweep --programs 0` and `--no-sweep --programs 0 --exhaustive-f16 --ops v_cvt_flr_i32_f32` (an f32 op where the f16 exhaustive stage generates zero programs) printed `0/0 programs match` and exited `0` (false pass). Now empty configurations are refused upfront and any `total_run == 0` run exits `2`. - Reject `--programs < 0` and `--max-ops < 1` (previously `--max-ops 0` crashed inside `rng.randint(1, max_ops)`), and validate `programs` / `max_ops` in `run_suite()` against negative and `bool` values. - **Harden `--ops` parsing and accept `argv=None` in `main(argv=None)`**: reject empty/blank/trailing-comma `--ops` (previously `--ops ""` silently ran all 8 ops) and deduplicate repeated op names so sweep/grid/random counts aren't skewed. - **Synthetic regression tests (`tests/test_cvt_diff.py`)**: 4 new tests in `CliGuards` covering all of the above (no game files, no GPU). ## Verification - AI-assisted: yes - GPUs tested: none (CPU-only Python tool on macOS) - `python3 -W error -I tests/test_cvt_diff.py -v`: **30 passed** - `python3 -W error -I tests/test_text_write_line_endings.py`: passed - `python3 -I scripts/check_no_game_data.py tools/cvt_diff.py tests/test_cvt_diff.py`: clean - `python3 -m compileall -q tools/cvt_diff.py tests/test_cvt_diff.py`: clean - Mutation test (`CliGuards` suite of `tests/test_cvt_diff.py` against unpatched `main:tools/cvt_diff.py`): **11 failures, 3 errors** across the 4 CLI tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:58:12 +00:00
Author
Owner

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

Merge

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