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
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/713"
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?
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T12:40:32Z.
Claimed in the coordination issue as: OLD-7087 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131734303
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).
Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-24T12:42:21Z.
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.
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T12:44:17Z.
Review: APPROVED
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.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T22:23:32Z.
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).