dot_diff: fail on skipped programs, reject invalid counts/empty --ops, and accept argv (DOT-DIFF-SKIPS-AND-CLI) #1613

Merged
leonida/mandy
quietfold merged 1 commit from fix/dot-diff-skips-and-cli into main 2026-11-28 10:39:16 +00:00

Pull request successfully merged and closed

quietfold commented 2026-11-25 05:58:28 +00:00

Item ID: DOT-DIFF-SKIPS-AND-CLI (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/dot_diff.py).

What changed

  • Fail on skipped programs in main() (tools/dot_diff.py): unlike cvt_diff.py, div_fixup_diff.py, and mode_diff.py, dot_diff.py did not track total_skip, so a run where every generated program skipped translation exited 0 (false pass). Now total_skip is tallied across stages and exits 1 with SKIPPED <N> program(s) when non-zero; a zero-program run exits 2.
  • Validate --programs, --max-ops, and empty runs upfront:
    • Reject --programs < 0, --max-ops < 1 (which previously crashed inside rng.randint(1, max_ops)), and --no-sweep --programs 0 (which previously ran 0 programs and exited 0) with exit 2.
    • Skip the random stage when --programs 0 is combined with sweep/grid.
    • Guard run_suite() against negative/bool programs and < 1/bool max_ops.
  • Harden --ops parsing and accept argv=None in main(argv=None): reject empty/blank/trailing-comma --ops (previously --ops "" silently ran all 12 ops), trim whitespace around "gfx103x", and deduplicate repeated op names so sweep/grid/random weights aren't skewed.
  • Synthetic regression tests (tests/test_dot_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_dot_diff.py -v: 21 passed
  • python3 -W error -I tests/test_text_write_line_endings.py: passed
  • python3 -I scripts/check_no_game_data.py tools/dot_diff.py tests/test_dot_diff.py: clean
  • python3 -m compileall -q tools/dot_diff.py tests/test_dot_diff.py: clean
  • Mutation test (tests/test_dot_diff.py against unpatched main:tools/dot_diff.py): 11 failures, 3 errors across the 21 tests (all 4 new tests fail on unpatched main).
Item ID: `DOT-DIFF-SKIPS-AND-CLI` (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/dot_diff.py`). ## What changed - **Fail on skipped programs in `main()` (`tools/dot_diff.py`)**: unlike `cvt_diff.py`, `div_fixup_diff.py`, and `mode_diff.py`, `dot_diff.py` did not track `total_skip`, so a run where every generated program skipped translation exited `0` (false pass). Now `total_skip` is tallied across stages and exits `1` with `SKIPPED <N> program(s)` when non-zero; a zero-program run exits `2`. - **Validate `--programs`, `--max-ops`, and empty runs upfront**: - Reject `--programs < 0`, `--max-ops < 1` (which previously crashed inside `rng.randint(1, max_ops)`), and `--no-sweep --programs 0` (which previously ran 0 programs and exited `0`) with exit `2`. - Skip the `random` stage when `--programs 0` is combined with sweep/grid. - Guard `run_suite()` against negative/`bool` `programs` and `< 1`/`bool` `max_ops`. - **Harden `--ops` parsing and accept `argv=None` in `main(argv=None)`**: reject empty/blank/trailing-comma `--ops` (previously `--ops ""` silently ran all 12 ops), trim whitespace around `"gfx103x"`, and deduplicate repeated op names so sweep/grid/random weights aren't skewed. - **Synthetic regression tests (`tests/test_dot_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_dot_diff.py -v`: **21 passed** - `python3 -W error -I tests/test_text_write_line_endings.py`: passed - `python3 -I scripts/check_no_game_data.py tools/dot_diff.py tests/test_dot_diff.py`: clean - `python3 -m compileall -q tools/dot_diff.py tests/test_dot_diff.py`: clean - Mutation test (`tests/test_dot_diff.py` against unpatched `main:tools/dot_diff.py`): **11 failures, 3 errors** across the 21 tests (all 4 new tests fail on unpatched `main`).
copilot-pull-request-reviewer[bot] reviewed 2026-11-25 05:58:43 +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.
GeorgiyDemo commented 2026-11-25 06:20:16 +00:00

Tested 803575d2a on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 42537e7b6 (Python GPU differential tool; no campaign run):

  • pytest 9.2.0 on tests/test_dot_diff.py: 21 passed, 28 subtests passed at this head.
  • The same file on main: 14 failed, 18 passed, 17 subtests — the skipped-program failure, count/--ops validation and argv handling are not there.
  • Not run: an actual dot_diff campaign on the GPU; only the unit tests.

AI-assisted; synthetic fixtures only, no game data.

Tested `803575d2a` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `42537e7b6` (Python GPU differential tool; no campaign run): - pytest 9.2.0 on `tests/test_dot_diff.py`: **21 passed, 28 subtests passed** at this head. - The same file on `main`: **14 failed**, 18 passed, 17 subtests — the skipped-program failure, count/`--ops` validation and argv handling are not there. - Not run: an actual `dot_diff` campaign on the GPU; only the unit tests. AI-assisted; synthetic fixtures only, no game data.
MoonEyes commented 2026-11-28 10:39:08 +00:00

Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 18 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18). Targeted batch of 18 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No description provided.