Scripts: harden bvhb_shaders CLI argument handling, validation, and test coverage #1858
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1858
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1858"
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?
@heditrigui on GitHub · 2026-11-24 21:58 UTC · original
heditrigui:scripts/bvhb-shaders-cli-hardening→main· +175 −27 · 2 files · 1 commits · openSummary
Hardens CLI argument handling and validation in
scripts/re/bvhb_shaders.pyand expands unit test coverage inscripts/test_bvhb_shaders.py:-hand--helpCLI option support with usage docstrings and clean exit code 0.error: file not found: '<dll_path>'on stderr and exits code 1) instead of crashing with unhandled Python exceptions.extract_shaders(dll_bytes, out_dir=None)andmain(argv=None, out=None)functions so the module can be cleanly imported without executing top-level logic.scripts/test_bvhb_shaders.pyfrom 1 to 7 tests covering CLI argument flags, exit codes, missing files, shaders without RTS0 root signatures, and direct Python API extraction.Tested
python -m unittest scripts/test_bvhb_shaders.py(7 passed in 0.37s).python -m pytest scripts/(22 passed in 0.74s).scripts/pr_check.py --local.Not tested
scripts/tools are non-runtime code).AI use
@futurepro62 on GitHub · 2026-11-24 22:36 UTC · original
Tested exact head
ebf6f96, script tests only, since this PR has no test report yet.Tested
python -m pytest scripts/test_bvhb_shaders.pyat the head: 7 passed, 2 subtests passed.689f2db): does not get to run: collection fails withFileNotFoundError: ... '-q', because main'sbvhb_shaders.pyreadssys.argvat import time (which this PR changes).bvhb_shaders) conflict:git merge-treeof the two heads reports conflicts inscripts/re/bvhb_shaders.pyandscripts/test_bvhb_shaders.py, so whichever lands second needs a rebase.Not tested
AI use
@JJAutoCompare on GitHub · 2026-11-25 01:27 UTC · original
Tested
Clean checkout of
ebf6f96c60414ca63bf22792a7ff92ad697462acon Windows 11 Enterprise Evaluation 25H2 (build 26200.9974), AMD Ryzen 7 3800X, portable CPython 3.13.7 x64. This adds native Windows path and byte-for-byte extraction coverage to the earlier Python 3.14.3 pytest report.I compiled a one-function synthetic pixel shader with the Windows SDK 10.0.26100.0 x64
fxc.exe /nologo /T ps_5_0 /E main /Fo fixture.dxbc fixture.hlsland embedded the resulting 452-byte DXBC after a 16-byte prefix in a scratch wrapper. The working directory, wrapper path, and explicit output path contained spaces and Unicode (é,日).From the scratch working directory, with
$pythonpointing to the portable executable and$scriptto the checkout’sscripts/re/bvhb_shaders.py, I ran these seven checks with stdout and stderr captured through pipes.& $python -B $script -hand& $python -B $script --helpeach exited 0 and printed usage to stdout.& $python -B $scriptexited 2 and printed usage to stdout.& $python -B $script 'absent café shader.dll'and& $python -B $script $missingAbsoluteeach exited 1 with a file-not-found diagnostic on stderr and empty stdout. Redirected cp1252 stderr preservedéand escaped日in the absolute path as literal\u65e5.& $python -B $script $source $outputand& $python -B $script $sourceeach exited 0 and reported one container at0x10withRS: -. Both the explicit Unicode directory and the defaultbvhb_shadersdirectory contained exactly one00.dxbc, byte-identical to the 452-byte compiler output.7 passed, 0 failed, 0 ignored, 0 skipped.
Not tested
Coverage was limited to the Python CLI with a valid synthetic shader and missing-path diagnostics. Cargo, GPU execution, and retail assets were outside this run.
AI use
Codex (
gpt-6.2-sol) ran the checks and wrote this report.@DavidM1911 on GitHub · 2026-11-25 01:28 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@RavenCurseBurg on GitHub · 2026-11-26 04:31 UTC · original · edited 2026-11-26 04:38 UTC
Tested
ebf6f96c60414ca63bf22792a7ff92ad697462ac. The original #1759 patch does not apply directly to eitherscripts/re/bvhb_shaders.pyor its test file here. Candidate on this PR's head carries over the register-space formatting and the ASCII spelling for unbounded ranges. It keeps this PR's extraction API and CLI tests.I compiled two root signatures with Windows
d3dcompiler_47.dll(rootsig_1_0androotsig_1_1). Each used constants at b1/space2, a CBV at b2/space3 and a table with both finite and unbounded SRV ranges. I put the two DXBC containers in both orders and ranpython -B scripts/re/bvhb_shaders.py <input> <out-dir>with redirected UTF-8 and strict CP1252 output.On this PR, UTF-8 extracted both files but omitted the spaces. Under CP1252 each order stopped after writing the first file. On the candidate all four runs exited 0, both output files were byte-identical to the compiler output, and all summaries showed the expected spaces and counts.
The seven focused tests passed on the original head. On the candidate,
python -B -m unittest discover -s scripts -p "test_*.py"passed all 24 tests with no skips. Windows build 26100, i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) ported the formatting and ran the tests. No game files, GPU execution or Rust build.@luckyteagirl on GitHub · 2026-11-26 05:40 UTC · original · reviewed
Could candidate extraction distinguish an invalid part table from a valid DXBC container without
RTS0? Hereparts()skips an out-of-range chunk offset, butextract_shaders()still writes the candidate. With a synthetic 44-byte DXBC whose sole part offset is0x1000, followed by a valid-structureSHEXcontainer, the CLI exits 0, writes the malformed bytes as00.dxbc, and shifts the valid container to01.dxbc. Rejecting that candidate while preserving the no-RTS0case, plus a malformed-then-valid fixture, would make extraction and numbering reliable. Reproduced at exact headebf6f96c60414ca63bf22792a7ff92ad697462acwith synthetic bytes only; no DLL or GPU test. AI-assisted review with Codex.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.