tools/shader_diff.py: deduplicate --ops and guard generate_program/run_suite bounds #2294
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2294
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/shader-diff-safety"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: SHADER-DIFF-DEDUP-OPS-AND-EMPTY-INPUT-GUARDS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192589921)
What and why
--opspreserving first-seen order inmain()andrun_suite()(tools/shader_diff.py) so duplicate op names do not alter generation weights or replay strings.n_ops >= 0and non-empty matchingtemplatesupfront ingenerate_program(), raisingValueError.programs >= 1,max_ops >= 1,start >= 0, andlimit >= 1(when set) upfront inrun_suite(), raisingValueError.tests/test_shader_diff_exit.py.Tested
python -I tests/test_shader_diff_exit.py -v: 20 passed, 0 failed (detachedupstream/mainbaseline with only the updated test file fails with 2 failures).python -I tools/shader_diff.py --self-test: passed (canaries: match ok, mismatch detected, skip counted).python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tools/shader_diff.py tests/test_shader_diff_exit.py, andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Approving fca1c1b6c.
generate_programandrun_suitevalidate their counts, an op list that matches no template is an error instead of an empty program, and duplicate--opsentries are dropped in order. Building the template list earlier does not touch the RNG, so seeded programs are unchanged.Merged onto
maind1dff7949in one batch with 15 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_shader_diff_exit.py: 20 passed (main: 18). AI-assisted (Claude Code, Claude Opus 5.5).#2294 | head
fca1c1b6c034406ba6183ac441645a53310b1a7d|python3 -I tests/test_shader_diff_exit.py -v| red: 20 run, 2 failures | green: 20 passed | Red → greenThe baseline retained duplicate operations and mishandled invalid generation bounds.
Pinned main
33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Merged, thank you @kirigayakazima!
What it does: tools/shader_diff.py: deduplicate --ops and guard generate_program/run_suite bounds
How it was checked: sodove tested this PR at head
fca1c1b6con main33db04a70: the PR's own test fails on main and passes with this PR merged in (his result is linked from the batch summary in #1608). We then re-ran the same test locally on Windows 11 and got the same verdict: on main, red (2 failures); with the PR, green (20 OK).CI: the red jobs on this PR fail the same way on main, or on the older main it was built on (the
cs_dpp_cmp.asmtranslator fixture, since fixed on main, and the Windows runner's Visual Studio setup), so none comes from this change.Merged one by one with 20 other PRs of the same reviewed batch, pinned to the tested head.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.