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

Open
opened 2026-11-26 20:21:54 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1613
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/dot-diff-skips-and-cli


📝 Commits (1)

  • 803575d dot_diff: fail on skipped programs, reject invalid counts/empty --ops, and accept argv

📊 Changes

2 files changed (+108 additions, -14 deletions)

View changed files

📝 tests/test_dot_diff.py (+70 -0)
📝 tools/dot_diff.py (+38 -14)

📄 Description

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).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1613 **Author:** [@IlyassRS3](https://github.com/IlyassRS3) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/dot-diff-skips-and-cli` --- ### 📝 Commits (1) - [`803575d`](https://github.com/ubiquitarianism/leonida/commit/803575d2a7af7e358f55c77ca46ee24ad5cdc30e) dot_diff: fail on skipped programs, reject invalid counts/empty --ops, and accept argv ### 📊 Changes **2 files changed** (+108 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_dot_diff.py` (+70 -0) 📝 `tools/dot_diff.py` (+38 -14) </details> ### 📄 Description 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`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1625
No description provided.