shader: extract main(argv), atomic output writes, and error guards in mesh_entry_aot with CLI suite #2386
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2394"
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 R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-25T15:08:20Z.
Change
Harden
tools/mesh_entry_aot.pyfor programmatic and CLI execution while preserving its HLSL translation behavior and CLI arguments:__main__block intomain(argv=None) -> intforwardingargvtop.parse_args(argv).--outputbeing an existing directory, lacking a.hlslsuffix, or colliding withcontaineror--geometry-wordsvia_same_path()(Path.resolve()equality andPath.samefile()for hardlinks/aliases).tempfile.TemporaryDirectory(dir=a.output.parent)before committing withos.replace()so write/replace failures leave no partial files or temp directories.(OSError, ValueError, KeyError, json.JSONDecodeError, struct.error, zlib.error)cleanly viap.exit(1, ...)without raw Python tracebacks.tests/mesh_entry_aot_cli_check.pyand registermesh_entry_aot_cli_checkinCMakeLists.txt.Verification
Verified on commit
79851e14(rebased onupstream/main0b31989c):out/pe-env/Scripts/python.exe -B tests/mesh_entry_aot_cli_check.py -v->Ran 7 tests in 3.284s - OK(exit 0)out/pe-env/Scripts/python.exe -B tests/mesh_clip_cull_check.py-> passed (40 refusal checks + 7 guard-removal controls; exit 0)out/pe-env/Scripts/python.exe -B tests/mesh_amplification_refusal_check.py->mesh stage accepted; amplification and compute stages refused by name(exit 0)out/pe-env/Scripts/python.exe -B tests/form_coverage_check.py->form coverage checks passed(exit 0)out/pe-env/Scripts/python.exe -B tests/docs_links_check.py->Self-test passed. Checked 19 Markdown files and 464 links.(exit 0)out/pe-env/Scripts/python.exe -B tests/bidi_controls_check.py->Self-test passed. Checked 1719 tracked source, script and build/CI files: no bidirectional controls.(exit 0)Spot mutation checks against
tools/mesh_entry_aot.py(9/9 killed bytests/mesh_entry_aot_cli_check.py, restored cleanly):argvforwarding, bypass existing-directory check, bypass.hlslsuffix check, bypassresolve()collision check, bypasssamefile()collision check, bypassTemporaryDirectory+os.replace()staging, and individually dropstruct.error,KeyError, andzlib.errorhandlers (all returned exit 1).Evidence and follow-up
translate(MIT, repo-authored; no game files, dumps, binaries, or GPU/LLVM prerequisite).--output, non-.hlslsuffix, path collisions withcontainerand--geometry-wordsvia..alias and hardlink, missing inputs, invalid JSON,ValueError/KeyError/struct.error/zlib.errorhandling, andos.replace()/ staging write failures leaving zero temp directories.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-25T15:25:50Z.
Fixed in
369be3e5:tools/mesh_entry_aot.py:main()now formats guarded exception exits asf"{type(exc).__name__}: {exc}\n"(zero raw traceback), restoring theValueError: ...prefix expected bytests/mesh_multi_check.py.tests/mesh_entry_aot_cli_check.py: asserted theValueError:/<ExcType>:prefix in both subprocess and unit refusal tests.Verified in
liaisonafter369be3e5:{type(exc).__name__}:prefix caught (mesh_entry_aot_cli_check.pyexit 1).tests/mesh_entry_aot_cli_check.py(7/7 OK),tests/mesh_multi_check.py,tests/mesh_amplification_refusal_check.py,tests/form_coverage_check.py,tests/docs_links_check.py, andtests/bidi_controls_check.py: all exit 0.ctest --preset dev -R "^mesh_entry_aot_cli_check$"andctest --preset release -R "^mesh_entry_aot_cli_check$": 1/1 passed (7/7 OK) on both.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:22:04Z.
Review: COMMENTED
Review of head
369be3e5(Linux checks only; no Windows run by me, and I did not see author Windows results for this SHA).Checked:
tools/mesh_entry_aot.py:main(argv)extraction, directory/suffix/same-path guards (_same_pathalso catches hardlinks), staged write +os.replacein the output directory, narrowed error handling that exits 1 with a one-line message. Logic reads correct.main).mesh_entry_aot_cli_checksits next to the sibling mesh checks.Commands run:
python3 -B tests/mesh_entry_aot_cli_check.py-> 7 tests OKpython3 tests/docs_links_check.py-> OKpython3 tests/bidi_controls_check.py-> OKgit diff --check origin/main...HEAD-> cleanos.replace(staged, a.output)withpass-> 3 failuresMinor, non-blocking notes:
p.error; they now exit 1. Fine, just a behavior change for scripts that check the code.CMakeLists.txt: the newadd_testhas noTIMEOUTproperty, unlike its neighbourmesh_amplification_refusal. Suggest adding one (e.g. 60).AI-assisted; commands listed were executed locally.