shader: harden rdna_cvt_pk_u8 CLI validation and atomic writes with CLI suite #2611
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2619"
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-25T23:28:17Z.
Change
Harden CLI argument/path validation, atomic output writes, and temporary workdir cleanup in
tools/rdna_cvt_pk_u8.py, and add a pure-Python CLI test suite intests/rdna_cvt_pk_u8_cli_check.pyregistered inCMakeLists.txt(shader_rdna_cvt_pk_u8_cli_check,TIMEOUT 60).main()tomain(argv=None) -> intusingap.parse_args(argv)and replacesys.exit('error: --asm-only needs --arch')with stderr +return 2._validate_args()and_validate_output_path():--show >= 0,--keepnon-empty and not an existing non-directory/broken symlink/file-parent,--comparenot a directory,--out/--jsonnon-empty and not a trailing-slash path/symlink/directory/non-regular file/file-parent, and reject path collisions (exact, resolved alias, or hardlinksamefile()) across--out,--json,--compare, and--keep.--outand--jsonwith sibling-temp_write_atomic()leaving zero.tmpleftovers on failure, clean up auto-created temporary workdirs infinally, and catch(OSError, ValueError, json.JSONDecodeError)with clean stderr + exit 1 and zero tracebacks.Verification
Commit:
483897b0(rebased onupstream/main66026a39) on Windows without\pe-env\Scripts\python.exe -B:out\pe-env\Scripts\python.exe -B tools\rdna_cvt_pk_u8.py --self-test-> exit 0 (self-test OK)out\pe-env\Scripts\python.exe -B -m unittest -v tests\rdna_cvt_pk_u8_cli_check.py-> exit 0 (Ran 9 tests ... OK)out\pe-env\Scripts\python.exe -B tests\startup_gfx2hlsl_cvt_pk_u8_check.py-> exit 0 (all measured/model/translation/refusal controls OK)out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py-> exit 0 (form coverage checks passed)out\pe-env\Scripts\python.exe -B tests\docs_links_check.py-> exit 0 (Checked 19 Markdown files and 506 links.)out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py-> exit 0 (Checked 1851 tracked source, script and build/CI files: no bidirectional controls.)tools/rdna_cvt_pk_u8.py(--show < 0, output symlink guard,samefileguard,--out/--comparecollision guard, temp cleanup in_write_atomic): 5/5 killed bytests/rdna_cvt_pk_u8_cli_check.py.Evidence and follow-up
tests/rdna_cvt_pk_u8_cli_check.pyis pure-Python (MIT License), mockingHipandbuildagainst the existing public fixturetests/data/rdna_cvt_pk_u8_measured.tsv(5432 rows) without requiring a GPU or ROCm toolchain.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:32:18Z.
Review: COMMENTED
Review of head
483897b0(comment only, no approval).Scope: tools/rdna_cvt_pk_u8.py CLI validation, atomic writes, temp workdir cleanup; new tests/rdna_cvt_pk_u8_cli_check.py (9 cases) registered in CMakeLists.txt. No other open or merged PR covers this slice (#2467 changed the lowering, not this CLI).
Findings: none blocking. The path collision check (exact, resolved alias, hardlink), the symlink/directory guards and the sibling-temp write all have a test that fails when they are broken.
Commands run locally on this head:
Not covered by this review: a Windows run (a Win2025 receipt follows separately).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:34:12Z.
Win2025 WARP receipt for head
483897b0(regex forced to the PR's new test).Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
483897b0cb8937b50fa7dee27089c912eaa6a59d:--preset dev):cmake --build --preset dev -- -j 2):17.65s(configure3.70s)ctest --preset dev -R 'shader_rdna_cvt_pk_u8_cli_check' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (7.88s:shader_rdna_cvt_pk_u8_cli_check7.63s)/O2(--preset release):cmake --build --preset release -- -j 2):41.70s(configure4.62s)ctest --preset release -R 'shader_rdna_cvt_pk_u8_cli_check' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (7.55s:shader_rdna_cvt_pk_u8_cli_check7.32s)sccache: 24/42 hits; wall87.1sAI-assisted; commands listed were executed locally.