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

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

@⁠IlyassRS3 on GitHub · 2026-11-25 05:58 UTC · original
IlyassRS3:fix/dot-diff-skips-and-cli → main · +108 −14 · 2 files · 1 commits · open

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).
**@⁠IlyassRS3** on GitHub · 2026-11-25 05:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1613) `IlyassRS3:fix/dot-diff-skips-and-cli` → `main` · +108 −14 · 2 files · 1 commits · open 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`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:58:06 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 05:58 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 05:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1613#pullrequestreview-6052567993) · **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

@⁠GeorgiyDemo on GitHub · 2026-11-25 06:20 UTC · original

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.

**@⁠GeorgiyDemo** on GitHub · 2026-11-25 06:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1613#issuecomment-7154686589) 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.
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/1613/head:github-bot/gh-1613'
git switch 'github-bot/gh-1613'

Merge

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