Repository navigation
shader_library: reject an unknown --stages name instead of writing nothing - #8728
Open
MarchalMaxim wants to merge 2 commits into
Open
MarchalMaxim wants to merge 2 commits into
MarchalMaxim wants to merge 2 commits into
Conversation
…thing --stages was split on commas with no check: a typo such as "--stages px" wrote zero programs and exited 0, and "--stages \"cs, ps\"" silently dropped ps because the token was " ps". Each token is now stripped and checked against the stage names the tool gives (cs, ps, vs, ms, slot6 and the slotN fallback for slots 3-5). An unknown or empty name is a usage error (exit 2) before the input is read or the output folder is made. "all" works as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit strips each --stages token but compared the whole value with "all" unstripped, so " all" was refused as "unknown stage 'all' (give 'all' or ...)", and "all,cs" got the same self-contradicting message. Strip before the "all" check and say 'all' is given alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: a new item, claim
What and why
tools/shader_library.pysplit--stageson commas with no validation and kept a program only if its stages intersected that set.--stages pxwrote 0 programs and exited 0 ("4 programs; 0 written"), and--stages "cs, ps"wrote only the cs program because the second token was" ps".Each token is now stripped and checked against the names the tool can produce:
cs, plusSLOTS.get(slot, f"slot{slot}")for the 7 graphics slots (ps, vs, ms, slot3 to slot6). An unknown or empty name is a parser error (exit 2) before the input is opened or a folder is created:--stages: unknown stage 'px' (give 'all' alone, or some of cs,ms,ps,slot3,slot4,slot5,slot6,vs).Behaviour notes:
all(surrounding spaces ignored) still writes every program, including unused ones.allcombined with other names (all,cs) is a usage error.unusedis rejected; it could never match a program under the old filter either.--stagesis now checked even when only--saveis given, where an invalid value used to be ignored.Tested
Windows 11, CPython 3.11.9, CPU only, no game files or GPU. Every input is built by hand in the test.
python -I tests/test_shader_library.py: with the new tests on unmodified code (clean worktree of main, only the test file copied in), 12 tests, 1 failure and 5 errors; with the fix, all tests in the file pass.python -I tests/test_text_write_line_endings.pyfails here ontools/leonida_tui.py:753andtools/wave_diff.py:373, the same on unmodified main; this branch touches neither.python -I -m compileall -qandpython -I scripts/check_no_game_data.pyon both changed files: exit 0.Other open PRs near this code: #8201 (
--savepaths that overlap extraction outputs), #6478 and #5787 (input checks) edit the same part ofmain(); none of them validates--stages. Expect a small textual conflict with whichever lands first. The new usage-error test uses a missing input file on purpose, to show the check runs before the input is opened.AI-assisted: yes (Claude Code; the fix was written by one agent and re-verified red/green by a second, independent one)
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator rule.)🤖 Generated with Claude Code