shader: harden compile_lds_request CLI, path guards, and replay checks with offline unit suite #3138

Manually merged
github merged 2 commits from github-bot/gh-3136 into main 2026-11-28 08:50:29 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-11-27 16:24 UTC · original
Ammmae0x:shader/compile-lds-request-cli → main · +823 −37 · 4 files · 2 commits · merged 2026-11-28 08:34 UTC

Change

Harden tools/startup/compile_lds_request.py CLI path validation, entrypoint error handling, and replay bundle verification, and add an offline unit/CLI/mutation suite:

  • Extract main(argv=None) -> int and invoke raise SystemExit(main()) under if __name__ == '__main__'.
  • Validate inputs and writable output/cache directories upfront in _validate_paths (_validate_regular_file for the .c67 marker, all five companion files .root/.data/.desc/.sa/.sb, and --compiler; --sdk exists and is a directory; output and --cache are not regular files and are not under a file-backed or dangling-link parent). Symlinked output/cache are allowed: the bundle is written through a TemporaryDirectory inside the output and moved into place with an atomic rename, so a symlink is the caller's chosen location; only a component that is not a directory at all is refused.
  • Guard and artifact errors raise a dedicated CompileLdsRequestError (a ValueError subclass); main() catches only (gfx.Unsupported, subprocess.CalledProcessError, CompileLdsRequestError), emitting a concise error: ... diagnostic on stderr and returning 1. Anything else — including a real translator bug — keeps its traceback instead of being swallowed into a clean error.
  • ComputeStage.body() refuses out-of-range branch targets cleanly with gfx.Unsupported('branch target ... is outside the compute stage') instead of a KeyError from the block-index lookup.
  • A damaged replay.json in an existing bundle now reports damaged replay artifact replay.json in <dest> instead of re-raising the rename OSError ("Directory not empty"); a missing or damaged artifact file in the bundle is reported the same way.
  • Add offline synthetic .c67 suite tests/startup_compile_lds_request_cli_check.py (mocking subprocess.run to cover warm bundle reuse, damaged artifact sha256 / replay.json detection, missing companion and hostile path refusals, --rw-image/conditional s_barrier/.data mismatch refusals, and 7 fast self-mutations) and register shader_compile_lds_request_cli_check via tests/cmake/shader_compile_lds_request_cli.cmake and tests/checks/python-linux/shader_compile_lds_request_cli.txt.

Verification

Verified on commit bd78c395 in slot-3:

  • out\pe-env\Scripts\python.exe -B tests/startup_compile_lds_request_cli_check.py -v -> Ran 4 tests ... OK (exit 0, including 8 fast self-mutations).
  • out\pe-env\Scripts\python.exe -B tests/native_lds_control_flow_check.py -> uniform barrier and wave-level EXEC branch passed; divergent barrier and back edge rejected (exit 0).
  • out\pe-env\Scripts\python.exe -B tests/startup_tools_lint_check.py -> PASS: 14 files under tools/startup parse; control snippet rejected and valid snippet accepted (exit 0).
  • out\pe-env\Scripts\python.exe -B tests/run_checks_fragments_check.py -> run_checks_fragments_check ok (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 96 Markdown files and 586 links. (exit 0).
  • out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py -> Self-test passed. Checked 2311 tracked source, script and build/CI files: no bidirectional controls. (exit 0).
  • Spot mutation audit on tools/startup/compile_lds_request.py: 3/3 mutations killed (disable _validate_paths(args) -> exit 1; disable bundle sha256 check -> exit 1, 2 failures; disable symlink guard in _validate_writable_dir -> exit 1, 2 failures).
  • tests/native_lds_request_check.py was not run locally because compile_dxil.exe is not built in this py_fast worktree or primary out\build\dev.

Review-feedback verification on commit 6b9db222 (Linux; no Windows toolchain on this host):

  • python3 -B tests/startup_compile_lds_request_cli_check.py -v -> Ran 6 tests ... OK (exit 0, including 7 fast self-mutations, the new FIFO/dangling-symlink-parent refusals, the translator-traceback regression test and the out-of-range branch test).
  • python3 -B tests/native_lds_control_flow_check.py -> uniform barrier and wave-level EXEC branch passed; divergent barrier and back edge rejected (exit 0).
  • /tmp/pe-env/bin/python -B tests/form_coverage_check.py -> form coverage checks passed (exit 0; system python3 lacks iced_x86, the venv provides it).
  • python3 -B tests/docs_links_check.py -> Self-test passed. Checked 96 Markdown files and 586 links. (exit 0).
  • python3 -B tests/bidi_controls_check.py -> Self-test passed. Checked 2311 tracked source, script and build/CI files: no bidirectional controls. (exit 0).
  • Spot mutation audit on tools/startup/compile_lds_request.py: 5/5 mutations killed (restore the broad except; remove the branch-target guard; re-add the symlink refusal; remove the FIFO guard; bare-raise on damaged replay.json — each made the suite fail, and the source was restored cleanly after each).
  • tests/native_lds_request_check.py was not run locally: it needs a built compile_dxil binary and DXC, which are not available on this Linux host. A Windows CTest/compile_dxil run is still needed.

Evidence and follow-up

All .c67 request bundles in tests/startup_compile_lds_request_cli_check.py are synthetically constructed in-test from tests/startup_gfx2hlsl_compute_check.py cases; no external binaries or game files are used.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

**@⁠Ammmae0x** on GitHub · 2026-11-27 16:24 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3136) `Ammmae0x:shader/compile-lds-request-cli` → `main` · +823 −37 · 4 files · 2 commits · merged 2026-11-28 08:34 UTC ## Change Harden `tools/startup/compile_lds_request.py` CLI path validation, entrypoint error handling, and replay bundle verification, and add an offline unit/CLI/mutation suite: - Extract `main(argv=None) -> int` and invoke `raise SystemExit(main())` under `if __name__ == '__main__'`. - Validate inputs and writable output/cache directories upfront in `_validate_paths` (`_validate_regular_file` for the `.c67` marker, all five companion files `.root`/`.data`/`.desc`/`.sa`/`.sb`, and `--compiler`; `--sdk` exists and is a directory; `output` and `--cache` are not regular files and are not under a file-backed or dangling-link parent). Symlinked output/cache are allowed: the bundle is written through a `TemporaryDirectory` inside the output and moved into place with an atomic rename, so a symlink is the caller's chosen location; only a component that is not a directory at all is refused. - Guard and artifact errors raise a dedicated `CompileLdsRequestError` (a `ValueError` subclass); `main()` catches only `(gfx.Unsupported, subprocess.CalledProcessError, CompileLdsRequestError)`, emitting a concise `error: ...` diagnostic on `stderr` and returning `1`. Anything else — including a real translator bug — keeps its traceback instead of being swallowed into a clean error. - `ComputeStage.body()` refuses out-of-range branch targets cleanly with `gfx.Unsupported('branch target ... is outside the compute stage')` instead of a `KeyError` from the block-index lookup. - A damaged `replay.json` in an existing bundle now reports `damaged replay artifact replay.json in <dest>` instead of re-raising the rename `OSError` ("Directory not empty"); a missing or damaged artifact file in the bundle is reported the same way. - Add offline synthetic `.c67` suite `tests/startup_compile_lds_request_cli_check.py` (mocking `subprocess.run` to cover warm bundle reuse, damaged artifact `sha256` / `replay.json` detection, missing companion and hostile path refusals, `--rw-image`/conditional `s_barrier`/`.data` mismatch refusals, and 7 fast self-mutations) and register `shader_compile_lds_request_cli_check` via `tests/cmake/shader_compile_lds_request_cli.cmake` and `tests/checks/python-linux/shader_compile_lds_request_cli.txt`. ## Verification Verified on commit `bd78c395` in `slot-3`: - `out\pe-env\Scripts\python.exe -B tests/startup_compile_lds_request_cli_check.py -v` -> `Ran 4 tests ... OK` (exit 0, including 8 fast self-mutations). - `out\pe-env\Scripts\python.exe -B tests/native_lds_control_flow_check.py` -> `uniform barrier and wave-level EXEC branch passed; divergent barrier and back edge rejected` (exit 0). - `out\pe-env\Scripts\python.exe -B tests/startup_tools_lint_check.py` -> `PASS: 14 files under tools/startup parse; control snippet rejected and valid snippet accepted` (exit 0). - `out\pe-env\Scripts\python.exe -B tests/run_checks_fragments_check.py` -> `run_checks_fragments_check ok` (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 96 Markdown files and 586 links.` (exit 0). - `out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py` -> `Self-test passed. Checked 2311 tracked source, script and build/CI files: no bidirectional controls.` (exit 0). - Spot mutation audit on `tools/startup/compile_lds_request.py`: 3/3 mutations killed (disable `_validate_paths(args)` -> exit 1; disable bundle `sha256` check -> exit 1, 2 failures; disable symlink guard in `_validate_writable_dir` -> exit 1, 2 failures). - `tests/native_lds_request_check.py` was not run locally because `compile_dxil.exe` is not built in this `py_fast` worktree or primary `out\build\dev`. Review-feedback verification on commit `6b9db222` (Linux; no Windows toolchain on this host): - `python3 -B tests/startup_compile_lds_request_cli_check.py -v` -> `Ran 6 tests ... OK` (exit 0, including 7 fast self-mutations, the new FIFO/dangling-symlink-parent refusals, the translator-traceback regression test and the out-of-range branch test). - `python3 -B tests/native_lds_control_flow_check.py` -> `uniform barrier and wave-level EXEC branch passed; divergent barrier and back edge rejected` (exit 0). - `/tmp/pe-env/bin/python -B tests/form_coverage_check.py` -> `form coverage checks passed` (exit 0; system python3 lacks `iced_x86`, the venv provides it). - `python3 -B tests/docs_links_check.py` -> `Self-test passed. Checked 96 Markdown files and 586 links.` (exit 0). - `python3 -B tests/bidi_controls_check.py` -> `Self-test passed. Checked 2311 tracked source, script and build/CI files: no bidirectional controls.` (exit 0). - Spot mutation audit on `tools/startup/compile_lds_request.py`: 5/5 mutations killed (restore the broad `except`; remove the branch-target guard; re-add the symlink refusal; remove the FIFO guard; bare-raise on damaged `replay.json` — each made the suite fail, and the source was restored cleanly after each). - `tests/native_lds_request_check.py` was not run locally: it needs a built `compile_dxil` binary and DXC, which are not available on this Linux host. A Windows CTest/`compile_dxil` run is still needed. ## Evidence and follow-up All `.c67` request bundles in `tests/startup_compile_lds_request_cli_check.py` are synthetically constructed in-test from `tests/startup_gfx2hlsl_compute_check.py` cases; no external binaries or game files are used. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 16:28:06 +00:00
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-27 17:39 UTC · original

Thanks, this is a useful cleanup, and the bundle output is byte-identical to main for Case F at wave sizes 32 and 64. A few things before merge:

  1. Broad except hides translator bugs. main() now catches ValueError/RuntimeError/OSError raised anywhere in translation. With CASES['F'] from tests/startup_gfx2hlsl_compute_check.py written through write_request and its dword 4 replaced by 0xbf84c07f (a backward s_cbranch_scc0), main prints a 24-line traceback ending in ValueError: invalid literal for int() with base 16: '0x-fdf0' from gfx2hlsl.translate. This branch prints one line, error: invalid literal for int() with base 16: '0x-fdf0', which looks just like a deliberate Unsupported refusal. Could the guards raise their own exception type (or the catch list name gfx.Unsupported, CalledProcessError and the guard/damaged-artifact errors explicitly), so unexpected exceptions keep their traceback?
  2. "No uncaught tracebacks" doesn't hold yet. CASES['extracted-tid'] with dword 9 set to 0xbf852005 (the s_cbranch_scc1 offset moved past the end) still exits with KeyError: 32828 from the block-index lookup in ComputeStage.body. It predates this PR, but since the PR claims the property, could body() refuse out-of-range targets with Unsupported (plus a case in the suite), or could the claim be dropped?
  3. Symlink refusal. Main accepts a symlinked output or cache directory, and this branch refuses both, but only the last path component is checked, so a symlinked parent still writes through. The tool never writes the cache itself. What threat is this meant to stop? If there isn't a concrete one, I'd drop the rule, at least for --cache.
  4. Windows coverage. On pull requests, CI's ctest --preset pr filter doesn't include native_lds_request, native_lds_control_flow or the new shader_compile_lds_request_cli_check, and the body says native_lds_request wasn't run locally. Could you add a Windows run of ctest --preset dev --no-tests=error -R '^(native_lds_request|native_lds_control_flow|shader_compile_lds_request_cli_check)$' -V to the PR?
  5. Self-mutation test. Each self-mutation deletes the line that raises a message and asserts the message is gone, which is true by construction. It also fails on edits that keep behaviour the same: switching 'request marker' to "request marker" gives AssertionError: 0 != 1 : target not unique. Mutating the tool and running the other three tests is the stronger control. They already catch most guard removals.

Smaller points:

  • The mocked "cache symlink" case actually trips the output check first.
  • The live symlink checks pass silently when symlinks aren't permitted. A visible skip would be better.
  • A damaged replay.json reports Directory not empty (a rename error) rather than naming the file.
  • _validate_writable_dir doesn't check that the directory is writable.
  • Two validator branches (dangling-link parent, non-file non-directory output) aren't pinned by any test.
  • The comma-spacing changes on untouched lines would be easier to review in a separate change.
  • Naming: shader_ vs startup_ for the test, ctest name and commit prefix.

This comment was AI-assisted.

**@⁠JohnConnorNPC** on GitHub · 2026-11-27 17:39 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3136#issuecomment-7224649239) Thanks, this is a useful cleanup, and the bundle output is byte-identical to main for Case F at wave sizes 32 and 64. A few things before merge: 1. **Broad `except` hides translator bugs.** `main()` now catches `ValueError`/`RuntimeError`/`OSError` raised anywhere in translation. With `CASES['F']` from `tests/startup_gfx2hlsl_compute_check.py` written through `write_request` and its dword 4 replaced by `0xbf84c07f` (a backward `s_cbranch_scc0`), main prints a 24-line traceback ending in `ValueError: invalid literal for int() with base 16: '0x-fdf0'` from `gfx2hlsl.translate`. This branch prints one line, `error: invalid literal for int() with base 16: '0x-fdf0'`, which looks just like a deliberate `Unsupported` refusal. Could the guards raise their own exception type (or the catch list name `gfx.Unsupported`, `CalledProcessError` and the guard/damaged-artifact errors explicitly), so unexpected exceptions keep their traceback? 2. **"No uncaught tracebacks" doesn't hold yet.** `CASES['extracted-tid']` with dword 9 set to `0xbf852005` (the `s_cbranch_scc1` offset moved past the end) still exits with `KeyError: 32828` from the block-index lookup in `ComputeStage.body`. It predates this PR, but since the PR claims the property, could `body()` refuse out-of-range targets with `Unsupported` (plus a case in the suite), or could the claim be dropped? 3. **Symlink refusal.** Main accepts a symlinked output or cache directory, and this branch refuses both, but only the last path component is checked, so a symlinked parent still writes through. The tool never writes the cache itself. What threat is this meant to stop? If there isn't a concrete one, I'd drop the rule, at least for `--cache`. 4. **Windows coverage.** On pull requests, CI's `ctest --preset pr` filter doesn't include `native_lds_request`, `native_lds_control_flow` or the new `shader_compile_lds_request_cli_check`, and the body says native_lds_request wasn't run locally. Could you add a Windows run of `ctest --preset dev --no-tests=error -R '^(native_lds_request|native_lds_control_flow|shader_compile_lds_request_cli_check)$' -V` to the PR? 5. **Self-mutation test.** Each self-mutation deletes the line that raises a message and asserts the message is gone, which is true by construction. It also fails on edits that keep behaviour the same: switching `'request marker'` to `"request marker"` gives `AssertionError: 0 != 1 : target not unique`. Mutating the tool and running the other three tests is the stronger control. They already catch most guard removals. Smaller points: - The mocked "cache symlink" case actually trips the output check first. - The live symlink checks pass silently when symlinks aren't permitted. A visible skip would be better. - A damaged `replay.json` reports `Directory not empty` (a rename error) rather than naming the file. - `_validate_writable_dir` doesn't check that the directory is writable. - Two validator branches (dangling-link parent, non-file non-directory output) aren't pinned by any test. - The comma-spacing changes on untouched lines would be easier to review in a separate change. - Naming: `shader_` vs `startup_` for the test, ctest name and commit prefix. This comment was AI-assisted.
Author
Owner

@⁠KelboLive on GitHub · 2026-11-27 18:49 UTC · original · approved these changes

Solid hardening of the CLI entrypoint and path validation. The extracted main(argv) signature makes testing straightforward, and the try-except block prevents uncaught tracebacks on bad input or runtime errors. The new offline test suite covers warm-reuse, damaged artifacts, missing companions, and hostile paths effectively. Approved.

**@⁠KelboLive** on GitHub · 2026-11-27 18:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3136#pullrequestreview-6092258414) · **approved these changes** Solid hardening of the CLI entrypoint and path validation. The extracted `main(argv)` signature makes testing straightforward, and the try-except block prevents uncaught tracebacks on bad input or runtime errors. The new offline test suite covers warm-reuse, damaged artifacts, missing companions, and hostile paths effectively. Approved.
Author
Owner

@⁠KelboLive on GitHub · 2026-11-27 23:56 UTC · original

Agree with KelboLive's APPROVED review: clean CLI hardening. The extracted main(argv=None) -> int makes testing straightforward, _validate_paths catches bad inputs upfront before any file operations, and the try-except block prevents uncaught tracebacks while preserving exact diagnostics expected by existing tests.

**@⁠KelboLive** on GitHub · 2026-11-27 23:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3136#issuecomment-7230526237) Agree with KelboLive's APPROVED review: clean CLI hardening. The extracted `main(argv=None) -> int` makes testing straightforward, `_validate_paths` catches bad inputs upfront before any file operations, and the try-except block prevents uncaught tracebacks while preserving exact diagnostics expected by existing tests.
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-28 07:33 UTC · original

Thanks for the update. The head is still bd78c395, whose only commit (16:16Z) predates my 17:39Z comment, so none of those points are addressed yet. I re-ran them on this head, and all five still reproduce. A trial merge into main (c3204a9c) is clean, and the new test passes there (Ran 4 tests ... OK).

One thing needs fixing before this can land:

  1. The broad except makes translator bugs look like refusals. except (OSError, ValueError, gfx.Unsupported, RuntimeError, subprocess.CalledProcessError) catches a translator ValueError. On Case F with dword 4 = 0xbf84c07f, main gives rc=1 with a 24-line traceback ending ValueError: invalid literal for int() with base 16: '0x-fdf0'. This head gives rc=1 with one line, error: invalid literal for int() ..., the same form as an Unsupported refusal. Catching gfx.Unsupported, CalledProcessError and a tool-specific error for the guards, and letting anything else keep its traceback, would fix it.

Non-blocking:

  • The body says the tool returns 1 "without uncaught tracebacks", but extracted-tid with dword 9 = 0xbf852005 still ends in KeyError: 32828 (13 lines, on head and on main). Refusing out-of-range branch targets in ComputeStage.body(), or dropping the claim, would settle it.
  • The symlink rule covers only half the case: an output that is a symlink is refused, but an output under a symlinked parent gives rc=0 and writes into the target. The tool never writes --cache, so the rule could go there.
  • CI's pr preset matches none of the three ctest names. A Windows run of ctest --preset dev --no-tests=error -R '^(native_lds_request|native_lds_control_flow|shader_compile_lds_request_cli_check)$' -V would cover them.
  • The 8 self-mutations pin source text: changing 'request marker' to "request marker" fails them (target not unique for drop_marker_guard) while behaviour is unchanged. Of 17 tool mutants I ran against the 3 behavioural tests, 2 survive: an output that is a FIFO, and a dangling-symlink parent.

Environment: Linux, Python, trial merge and pure-Python runs only. I did no compile_dxil/DXC, Windows ctest or GPU run.

This comment was AI-assisted.

**@⁠JohnConnorNPC** on GitHub · 2026-11-28 07:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3136#issuecomment-7236020448) Thanks for the update. The head is still `bd78c395`, whose only commit (16:16Z) predates my 17:39Z comment, so none of those points are addressed yet. I re-ran them on this head, and all five still reproduce. A trial merge into `main` (`c3204a9c`) is clean, and the new test passes there (`Ran 4 tests ... OK`). One thing needs fixing before this can land: 1. **The broad `except` makes translator bugs look like refusals.** `except (OSError, ValueError, gfx.Unsupported, RuntimeError, subprocess.CalledProcessError)` catches a translator `ValueError`. On Case F with dword 4 = `0xbf84c07f`, `main` gives `rc=1` with a 24-line traceback ending `ValueError: invalid literal for int() with base 16: '0x-fdf0'`. This head gives `rc=1` with one line, `error: invalid literal for int() ...`, the same form as an `Unsupported` refusal. Catching `gfx.Unsupported`, `CalledProcessError` and a tool-specific error for the guards, and letting anything else keep its traceback, would fix it. Non-blocking: - The body says the tool returns 1 "without uncaught tracebacks", but extracted-tid with dword 9 = `0xbf852005` still ends in `KeyError: 32828` (13 lines, on head and on main). Refusing out-of-range branch targets in `ComputeStage.body()`, or dropping the claim, would settle it. - The symlink rule covers only half the case: an output that is a symlink is refused, but an output under a symlinked parent gives `rc=0` and writes into the target. The tool never writes `--cache`, so the rule could go there. - CI's `pr` preset matches none of the three ctest names. A Windows run of `ctest --preset dev --no-tests=error -R '^(native_lds_request|native_lds_control_flow|shader_compile_lds_request_cli_check)$' -V` would cover them. - The 8 self-mutations pin source text: changing `'request marker'` to `"request marker"` fails them (`target not unique for drop_marker_guard`) while behaviour is unchanged. Of 17 tool mutants I ran against the 3 behavioural tests, 2 survive: an output that is a FIFO, and a dangling-symlink parent. Environment: Linux, Python, trial merge and pure-Python runs only. I did no compile_dxil/DXC, Windows ctest or GPU run. This comment was AI-assisted.
Author
Owner

@⁠Ammmae0x on GitHub · 2026-11-28 08:16 UTC · original

Addressed the review feedback in 6b9db222e3f4e3ede8937e72a1c235af9c8f3da6:

  • Broad except narrowed: main() now catches only (gfx.Unsupported, subprocess.CalledProcessError, CompileLdsRequestError), a new dedicated guard/artifact exception type. Regression test pins that a translator bug keeps its traceback: CASES['F'] with dword 4 = 0xbf84c07f now raises ValueError: invalid literal for int() with base 16: '0x-fdf0' with a traceback instead of a clean error: line.
  • ComputeStage.body() out-of-range branch targets are refused cleanly with gfx.Unsupported('branch target ... is outside the compute stage'); regression test uses CASES['extracted-tid'] with dword 9 = 0xbf852005, which previously exited with KeyError: 32828.
  • Symlink rules dropped: the --cache refusal is gone (the tool never writes --cache), and the half-effective last-component --output check is gone too. Both now succeed as the caller's chosen location — the bundle is written through a TemporaryDirectory and moved with an atomic rename — and the threat model is documented in _validate_writable_dir. Live symlink output/cache tests prove the bundle lands in the link target, and the second run warm-reuses it.
  • The two surviving behavioural mutants are killed by new tests: FIFO output (output path is not a directory) and dangling-symlink parent paths for output and cache (output/cache parent is not a directory).
  • Damaged replay.json now reports damaged replay artifact replay.json in <dest> instead of re-raising the rename OSError ("Directory not empty"); the positive test asserts the exact message, and a missing/damaged artifact file is reported the same way.
  • Self-mutation controls are now regex targets pinning structure, not exact source lines, so a quote-style or message change no longer silently unpins them; the symlink mutation was removed with the rule. The marker/companion checks also tolerate a mutant that crashes instead of refusing cleanly.
  • The comma-spacing-only edits on the otherwise-untouched argparse/parse lines were reverted to main's spelling.

Verification (Linux; Windows CTest/compile_dxil still needs a Windows run): tests/startup_compile_lds_request_cli_check.py -v 6/6 OK, tests/native_lds_control_flow_check.py exit 0, form_coverage_check.py, docs_links_check.py (96 files, 586 links) and bidi_controls_check.py (2311 files) all exit 0. Spot mutations: 5/5 killed (restore broad except; remove branch-target guard; re-add symlink refusal; remove FIFO guard; bare-raise on damaged replay.json), source restored cleanly after each. tests/native_lds_request_check.py was not run — it needs a built compile_dxil and DXC, unavailable on this Linux host. The _validate_writable_dir writability check was not added; flagging it as a follow-up.

AI-assisted.

**@⁠Ammmae0x** on GitHub · 2026-11-28 08:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3136#issuecomment-7236473257) Addressed the review feedback in `6b9db222e3f4e3ede8937e72a1c235af9c8f3da6`: - Broad `except` narrowed: `main()` now catches only `(gfx.Unsupported, subprocess.CalledProcessError, CompileLdsRequestError)`, a new dedicated guard/artifact exception type. Regression test pins that a translator bug keeps its traceback: `CASES['F']` with dword 4 = `0xbf84c07f` now raises `ValueError: invalid literal for int() with base 16: '0x-fdf0'` with a traceback instead of a clean `error:` line. - `ComputeStage.body()` out-of-range branch targets are refused cleanly with `gfx.Unsupported('branch target ... is outside the compute stage')`; regression test uses `CASES['extracted-tid']` with dword 9 = `0xbf852005`, which previously exited with `KeyError: 32828`. - Symlink rules dropped: the `--cache` refusal is gone (the tool never writes `--cache`), and the half-effective last-component `--output` check is gone too. Both now succeed as the caller's chosen location — the bundle is written through a `TemporaryDirectory` and moved with an atomic rename — and the threat model is documented in `_validate_writable_dir`. Live symlink output/cache tests prove the bundle lands in the link target, and the second run warm-reuses it. - The two surviving behavioural mutants are killed by new tests: FIFO output (`output path is not a directory`) and dangling-symlink parent paths for output and cache (`output/cache parent is not a directory`). - Damaged `replay.json` now reports `damaged replay artifact replay.json in <dest>` instead of re-raising the rename `OSError` ("Directory not empty"); the positive test asserts the exact message, and a missing/damaged artifact file is reported the same way. - Self-mutation controls are now regex targets pinning structure, not exact source lines, so a quote-style or message change no longer silently unpins them; the symlink mutation was removed with the rule. The marker/companion checks also tolerate a mutant that crashes instead of refusing cleanly. - The comma-spacing-only edits on the otherwise-untouched argparse/parse lines were reverted to `main`'s spelling. Verification (Linux; Windows CTest/`compile_dxil` still needs a Windows run): `tests/startup_compile_lds_request_cli_check.py -v` 6/6 OK, `tests/native_lds_control_flow_check.py` exit 0, `form_coverage_check.py`, `docs_links_check.py` (96 files, 586 links) and `bidi_controls_check.py` (2311 files) all exit 0. Spot mutations: 5/5 killed (restore broad `except`; remove branch-target guard; re-add symlink refusal; remove FIFO guard; bare-raise on damaged `replay.json`), source restored cleanly after each. `tests/native_lds_request_check.py` was not run — it needs a built `compile_dxil` and DXC, unavailable on this Linux host. The `_validate_writable_dir` writability check was not added; flagging it as a follow-up. AI-assisted.
github manually merged commit a78a5c7a03 into main 2026-11-28 08:50:29 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.