shader: harden probe_root_devices validation and add offline unit suite #1928
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1935"
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-24T21:42:43Z.
Change
Harden input, inventory, and output validation in
tools/probe_root_devices.pyand add an offline synthetic PE32+/DXBC/RTS0unit and refusal suite intests/probe_root_devices_check.py, registered in CTest asprobe_root_devices_check:argv=Noneand return0inmain(argv=None)for programmatic invocation and clean exit propagation (raise SystemExit(main())).rows[0]is adictwith safe.get(...)lookups in thecompute_root/compute_tablescontrol loop, validatesix-apis.jsonparses as adict, and check thatb"RTS0"is present in each container's DXBC parts before hashing.dest.parent.mkdir(parents=True, exist_ok=True)runs before writing viaNamedTemporaryFileand unlink the temporary file on error before replacingdest.(OSError, ValueError, KeyError, TypeError, struct.error, pefile.PEFormatError, subprocess.SubprocessError)and exit cleanly with code1(parser.exit(1, ...)) without a Python traceback.tests/probe_root_devices_check.py(8 tests coveringmeasure(),--warp-only/dual-backend control runs,RTS0deduplication & atomic write, control failure rows, missing/mismatched image SHA-256, missing/invalidsix-apis.json, non-PE/subprocess errors, and build-inside-report-dir refusal) and registerprobe_root_devices_checkinCMakeLists.txt.AI-assisted.
Verification
python.exe -B tests/probe_root_devices_check.py -v:Ran 8 tests in 0.285s—OK(withtools/probe_root_devices.pyreverted as a mutation sanity check, 7/8 tests error/fail as expected).cmake --preset dev -DINTAKE_PYTHON=...&ctest --preset dev -N:Total Tests: 1219.ctest --preset dev --no-tests=error -R "^probe_root_devices_check$" -V:1/1passed (8/8tests OK).cmake --preset release -DINTAKE_PYTHON=...&ctest --preset release -N:Total Tests: 1219.ctest --preset release --no-tests=error -R "^probe_root_devices_check$" -V:1/1passed (8/8tests OK).python.exe -B tests/form_coverage_check.py,python.exe -B tests/docs_links_check.py,python.exe -B tests/bidi_controls_check.py: all exited0.Evidence and follow-up
All fixtures in
tests/probe_root_devices_check.pyare synthetic AMD64 PE32+ images with DXBC/RTS0containers built in memory and mockedroot_device_probe.exeoutputs; no packaged binaries or GPU hardware are required for CTest execution.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T22:00:16Z.
Review: COMMENTED
Review of head
93f8cee93d(files: CMakeLists.txt, tests/probe_root_devices_check.py, tools/probe_root_devices.py).Commands run locally:
git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts.gh pr checks 1935: all pass (the /O2 and chart jobs are skipped).git diff --check origin/main...HEAD: clean.python3 tests/bidi_controls_check.py: pass.python3 tests/docs_links_check.py: pass.python3 -B tests/probe_root_devices_check.pyon Linux: cannot run as is. It needspefileandsys.getwindowsversion. With pefile installed and agetwindowsversionshim: 8 tests OK.python3 x2w_pipe.py win2025 1935 --wait 900: Debug and Release /O2 both pass.probe_root_devices_checkandroot_device_controls_warppassed 2/2 in each.Mutations (run on Linux with the shim, then
git checkout -- .):remaining_flags != 0withFalsein the control check. The suite FAILED, so it is covered.if b"RTS0" not in container_parts:withif False:. The suite still PASSED, so the mutation survived. See P2.Findings:
P1: none.
P2
container_parts[b"RTS0"]raisesKeyError. The outer handler catches that and exits 1, but with a bare'RTS0'message. Please add a case with a container that has no RTS0 and assert exit code 1 and the "missing RTS0" text on stderr.P3
sys.getwindowsversion()is called before thetry, so the tool still fails with a traceback on non-Windows. The test file also needs it, soprobe_root_devices_checkonly works on Windows. This is fine while it is registered only underINTAKE_PYTHON, but a short comment or a Windows-only guard in the test would make that explicit.except ... TypeErrorhides programming errors as "exit 1" messages.KeyErrorandTypeErrorare caught for malformed inventory input, which is the intent, so consider narrowing them to the inventory-reading block.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T22:00:27Z.
Review: COMMENTED
Review of head
93f8cee93d(files: CMakeLists.txt, tests/probe_root_devices_check.py, tools/probe_root_devices.py).Commands run locally:
git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts.gh pr checks 1935: all pass (the /O2 and chart jobs are skipped).git diff --check origin/main...HEAD: clean.python3 tests/bidi_controls_check.py: pass.python3 tests/docs_links_check.py: pass.python3 -B tests/probe_root_devices_check.pyon Linux: cannot run as is. It needspefileandsys.getwindowsversion. With pefile installed and agetwindowsversionshim: 8 tests OK.python3 x2w_pipe.py win2025 1935 --wait 900: Debug and Release /O2 both pass.probe_root_devices_checkandroot_device_controls_warppassed 2/2 in each.Mutations (run on Linux with the shim, then
git checkout -- .):remaining_flags != 0withFalsein the control check. The suite FAILED, so it is covered.if b"RTS0" not in container_parts:withif False:. The suite still PASSED, so the mutation survived. See P2.Findings:
P1: none.
P2
container_parts[b"RTS0"]raisesKeyError. The outer handler catches that and exits 1, but with a bare'RTS0'message. Please add a case with a container that has no RTS0 and assert exit code 1 and the "missing RTS0" text on stderr.P3
sys.getwindowsversion()is called before thetry, so the tool still fails with a traceback on non-Windows. The test file also needs it, soprobe_root_devices_checkonly works on Windows. This is fine while it is registered only underINTAKE_PYTHON, but a short comment or a Windows-only guard in the test would make that explicit.except ... TypeErrorhides programming errors as "exit 1" messages.KeyErrorandTypeErrorare caught for malformed inventory input, which is the intent, so consider narrowing them to the inventory-reading block.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T21:56:26Z.
The locked-destination control failed on
93f8cee9: the old report survived but a temporary file was left behind. Cleanup now runs after both write and replace failures, and the test confirms the old report is preserved and no temporary file remains. All nine offline checks pass.Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-24T22:09:22Z.
Merged
upstream/main(resolving theCMakeLists.txtconflict) and addressed the review feedback:test_container_missing_rts0_exits_1_cleanlyandtest_malformed_inventory_entry_exits_1_cleanlyintests/probe_root_devices_check.py, confirming a container withoutRTS0exits1withmissing RTS0onstderr.(KeyError, TypeError)handling intools/probe_root_devices.pytosix-apis.jsonentry parsing so missingRTS0is handled exclusively by the explicit check, and documented the Windows-onlysys.getwindowsversion()requirement intests/probe_root_devices_check.py.probe_root_devices_check(11/11) androot_device_controls_warpin bothdevandrelease, plusform_coverage_check.py,docs_links_check.py, andbidi_controls_check.py.AI-assisted.