Skip to content

shader_stats: --help exits 0, and an unknown option is refused instead of ignored - #2135

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
AAyberkU:shader-stats-help
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
AAyberkU:shader-stats-help

Conversation

@AAyberkU

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #2078 (comment) (new BUILD item)

What and why

scripts/shader_stats.py parses its arguments by hand, and two things went wrong:

  • -h and --help printed the usage to stderr and exited with code 1.
  • Every -- option other than --details was dropped without a word. shader_stats.py stats.csv disasm --detail (a typo) printed the summary with exit code 0, as if no option had been given.

Now help goes to stdout with exit code 0, and an unknown option or a wrong argument count is a usage error with exit code 2 and a one-line usage on stderr. This matches the other hand-parsed tools (classify_carve.py, and the spirv tools after #1678). Output for valid invocations is unchanged.

Tested

Python only: no game files and no GPU involved.

  • python -I tests/test_shader_stats.py: 17 tests pass (Windows 11, Python 3.12.10). 5 are new; 4 of them fail on main without the fix, the fifth checks that --details is still accepted.
  • python -m compileall -q make_game.py tools tests scripts: clean.

AI-assisted (Claude Code); I ran the tests above myself on the rebased branch.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (not a translator change)

🤖 Generated with Claude Code

https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs

…d of ignored

`-h`/`--help` printed the usage to stderr with exit code 1, and any other `--` option was dropped without a
word: `--detail` (a typo for `--details`) printed the summary with exit code 0. Help now goes to stdout with
exit code 0, and an unknown option or a wrong argument count is a usage error with exit code 2, as in the
other hand-parsed tools.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
@LocranKing

Copy link
Copy Markdown
Contributor

Tested c5904696 on Windows 11 Build 26200 (RTX 3060 Ti, driver 621.01, Python 3.12.10): pass

  • python -I -m compileall -q make_game.py tools tests scripts: exit 0
  • python -I make_game.py --help: exit 0
  • python -I tests/test_shader_stats.py -v: 17/17 OK (2.169s)

AI-assisted. No game files.

@UNYTIX

UNYTIX commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested c590469693ad. Command python -B -I tests/test_shader_stats.py -v.

17 passed. All four help and usage regressions failed on base 4eb6155 and passed here. Inputs came from the test suite.

Independent Windows 11 verification, Python 3.15.2. AI-assisted.

@ItsNotRexed
ItsNotRexed merged commit e06b7e9 into ItsNotRexed:main Nov 22, 2026
AAyberkU added a commit to AAyberkU/Leonida that referenced this pull request Nov 22, 2026
It was left out of this change while ItsNotRexed#2135 was open on the same file. With the guard added it leaves the
test's list of exceptions, which now holds only run_wine_tests.py.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
AAyberkU added a commit to AAyberkU/Leonida that referenced this pull request Nov 22, 2026
It was left out of this change while ItsNotRexed#2135 was open on the same file. With the guard added it leaves the
test's list of exceptions, which now holds only run_wine_tests.py.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
AAyberkU added a commit to AAyberkU/Leonida that referenced this pull request Nov 22, 2026
It was left out of this change while ItsNotRexed#2135 was open on the same file. With the guard added it leaves the
test's list of exceptions, which now holds only run_wine_tests.py.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
@AAyberkU
AAyberkU deleted the shader-stats-help branch November 22, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants