shader: validate input paths and add OSError/struct guards in mesh_loop_census with CLI suite #2566
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2574"
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-25T21:27:50Z.
Summary
Hardens
tools/mesh_loop_census.pyCLI argument validation and error handling and registers a pure-Python CLI test suite in CTest:_validate_directory,_validate_backend): Reject nonexistent or non-directory input paths (upfront inmain()and eagerly inread_programs()before returning the iterator), and reject empty, whitespace-only, or existing-directory--llvm/--llvm-mcvalues before wiring the backend or scanning files.main(argv)): Type-annotatemain(argv: Sequence[str] | None = None) -> intwithraise SystemExit(main()), catch(OSError, ValueError, struct.error)and exit cleanly viaparser.exit(1, f"mesh_loop_census: {error}\n")without raw tracebacks, while preserving per-containerValueError/KeyError/struct.errortallies inPopulationand aggregate Markdown output.tests/mesh_loop_census_cli_check.py,CMakeLists.txt): Registermesh_loop_census_cli_checkcovering loop-free/counted/duplicate/non-DXBC/malformed classification without filename/register leakage,--llvm-mcdisassembler wiring andsys.argv/__main__entrypoint forwarding, missing/file directory and empty/directory backend rejection,OSError/ValueError/struct.errorguards (including subprocess runs against nonexistent backends), and Python 3.14-compatible argparse error checks.Verification
Rebased onto
upstream/main(18f2f85c) and verified:out\pe-env\Scripts\python.exe -B tests\mesh_loop_census_cli_check.py -v->Ran 6 tests in 12.426s/OK(exit 0)out\pe-env\Scripts\python.exe -B tests\mesh_loop_census_check.py->Mesh loop census classified 14 source-built programs; 14 mutants changed category(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 488 links.(exit 0)out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py->Self-test passed. Checked 1802 tracked source, script and build/CI files: no bidirectional controls.(exit 0)tools/mesh_loop_census.py: killed 12/12 mutations across_validate_directory,_validate_backend, eagerread_programs, andmain(argv)error guards.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:32:13Z.
Review: COMMENTED
Review of head
19b53833(same change as59e72ebd, plus the merge of main).Checked: tools/mesh_loop_census.py validation (
_validate_directory,_validate_backend, eagerread_programs,mainerror guard) and the new CTest registrationmesh_loop_census_cli_checknext tomesh_loop_census. Sibling testmesh_loop_census_checkis unchanged and still passes. No other open or merged PR covers this slice (#2284 added the tool, #2508 is a lowerer change).Commands run:
python3 -B tests/mesh_loop_census_cli_check.py-> Ran 6 tests, OKpython3 -B tests/mesh_loop_census_check.py-> 14 programs classified; 14 mutants changed categorypython3 tests/docs_links_check.py-> self-test passedpython3 tests/bidi_controls_check.py-> no bidirectional controlsgit diff --check origin/main...HEAD-> clean_validate_directory-> new suite FAILS (1 failure)OSErrorfrom themainexcept clause -> new suite FAILS (1 error)No blocking findings. Win2025 WARP run follows separately.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:36:07Z.
Win2025 WARP receipt for head
19b53833after updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
19b5383383d356874860bf77ed9244042ca80853:--preset dev):cmake --build --preset dev -- -j 2):1.71s(configure2.08s)ctest --preset dev -R 'mesh_loop_census' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (4.71s:mesh_loop_census0.70s,mesh_loop_census_cli_check4.57s)/O2(--preset release):cmake --build --preset release -- -j 2):4.72s(configure2.28s)ctest --preset release -R 'mesh_loop_census' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (3.83s:mesh_loop_census0.66s,mesh_loop_census_cli_check3.70s)tests/mesh_loop_census_check.pyok (0.5s)sccache: 18/46 hits; wall20.2sAI-assisted; commands listed were executed locally.