OLD-7087: restore old upstream PR 7087 - audit_shader4_regs: --limit must be at least 1; 0 audited nothing and printed a zero report #713
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!713
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/713/head"
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?
@aslan2142 on GitHub · 2026-11-24 12:40 UTC · original
aslan2142:audit-shader4-limit-zero→main· +41 −20 · 2 files · 1 commits · merged 2026-11-25 22:23 UTCClaimed in the coordination issue as: OLD-7087 #14
Restoration of my original pull request, old upstream PR 7087 in
ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at21625bca8c. The one commit cherry-picked cleanly and is unchanged. The tool is stillscripts/audit_shader4_regs.py, as it was in the original. Main has no shared helper for checking that a count is positive, so the PR keeps its ownshader_counttype function, written like thebyte_countintools/anim_index.py.What and why
--limit 0passes the non-negative check, andfiles[:0]keeps no listing.=== CS (0 shaders; ...) ===for every stage and exits 0. A typo gives an empty audit that looks real.--limitnow takes ashader_counttype: a value below 1 or a non-number is an argparse error that names the option, with exit 2 and no report or JSON written.audit()raisesValueErrorfor a limit below 1, so callers that bypass the command line get the same check.None) still audits everything.Tested
Linux, Python 3.14.10, CPU only, synthetic inputs (hand-written
.slistings in temporary folders, no game files).python -I tests/test_audit_shader4_regs.py: 20 tests, OK. On main the same 20 pass, but with this PR's test changes 5 subtests fail (--limit 0,-1andx;audit()with 0 and -1).--limit 0,-1andxexit 2 with nothing on stdout and no JSON.--limit 1on a folder with two listings audits one.--limit 2and--limit 3audit both.--limit 0to leave the listing out. It now adds a second listing that sorts first and uses--limit 1.python -m compileall -q tools tests scripts,git diff --checkandpython -I scripts/check_no_game_data.pyon the two changed files: all clean.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. (n/a: no translator change)AI-assisted (Claude Code, Claude Opus 5.5).
@GeorgiyDemo on GitHub · 2026-11-24 12:42 UTC · original
Ran
165402ddeon Apple M5 Pro, macOS 26.7.3 (25G342), Python 3.15.2, againstmaind42773d07:tests/test_audit_shader4_regs.py: 20 tests OK at this head.main'sscripts/audit_shader4_regs.pyfails 5 of 20, so the--limitbehaviour is actually covered by the new tests.No GPU leg (the tool is CPU-only). AI-assisted.
@abnalstlll-byte on GitHub · 2026-11-24 12:44 UTC · original · approved these changes
Reviewed and verified OLD-7087 restoration. Enforcing --limit\ must be at least 1 via \shader_count\ argument type prevents empty audits from outputting misleading zero reports. Comprehensive standard-library test coverage in \ ests/test_audit_shader4_regs.py\ validates argument parsing, programmatic \udit()\ bounds checks, and JSON output behavior. Approved.
@aslan2142 on GitHub · 2026-11-25 22:23 UTC · original
Merged:
audit_shader4_regs:--limitmust be at least 1.main, and no review point is open.tests/test_audit_shader4_regs.pypasses onmain+ this head (Linux, CPython 3.14).main7359f21b2+165402dde: the semantic suite passes (492 files, 6,315 tests, 0 files failed);test_audit_shader4_regspass; the 15 docs and writer tests pass;check_no_game_data.pyis clean on the 2 changed files.AI-assisted (Claude Code, Claude Opus 5.5).