ci: harden script path validation and subprocess error handling in run_checks_parallel with CLI suite #2590

Merged
Ammmae0x merged 1 commit from upstream-pr/2598 into main 2026-11-25 22:43:34 +00:00
Ammmae0x commented 2026-11-25 22:32:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-25T22:32:47Z.


Summary

  • Validate every CLI script path upfront in tools/run_checks_parallel.py:main(argv=None) -> int via _validate_script_path(), rejecting empty/whitespace, missing, directory, and non-regular paths cleanly with exit status 1 and zero raw tracebacks before launching run_checks().
  • Guard run_one(check) against empty commands (ValueError) and catch (OSError, subprocess.SubprocessError) with stdin=subprocess.DEVNULL so spawn/executable failures never crash ThreadPoolExecutor, returning deterministic failure output and status 1 while sibling checks continue in order.
  • Guard (ValueError, OSError, subprocess.SubprocessError) cleanly in main() while preserving -j 0 worker clamping (max(1, jobs)), ordered ::group:: / ::endgroup:: output, SKIP_EXIT_CODE = 77 reporting, and run_checks(checks, jobs=None) signature.
  • Add standalone pure-Python CLI/error/mutation suite tests/run_checks_parallel_cli_check.py and register ci_run_checks_parallel_cli_check in CMakeLists.txt.

Verification

  • python -B tests/run_checks_parallel_cli_check.py -v -> Ran 7 tests in 1.546s (OK, exit 0)
  • python -B tests/run_checks_parallel_check.py -> run_checks_parallel_check: ok (exit 0)
  • Adversarial temp-copy mutation check (15 mutations across empty/exists/is_dir/is_file path validation, empty-command guard, run_one OSError/SubprocessError handlers & return code, main ValueError/OSError/SubprocessError handlers & exit code, upfront validation loop, -j clamping, and argv forwarding) -> 15/15 KILLED
  • python -B tests/form_coverage_check.py -> form coverage checks passed (exit 0)
  • python -B tests/docs_links_check.py -> Self-test passed. Checked 19 Markdown files and 498 links. (exit 0)
  • python -B tests/bidi_controls_check.py -> Self-test passed. Checked 1829 tracked source, script and build/CI files: no bidirectional controls. (exit 0)

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6615113510 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2598). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-25T22:32:47Z. --- ## Summary - Validate every CLI script path upfront in `tools/run_checks_parallel.py:main(argv=None) -> int` via `_validate_script_path()`, rejecting empty/whitespace, missing, directory, and non-regular paths cleanly with exit status 1 and zero raw tracebacks before launching `run_checks()`. - Guard `run_one(check)` against empty commands (`ValueError`) and catch `(OSError, subprocess.SubprocessError)` with `stdin=subprocess.DEVNULL` so spawn/executable failures never crash `ThreadPoolExecutor`, returning deterministic failure output and status 1 while sibling checks continue in order. - Guard `(ValueError, OSError, subprocess.SubprocessError)` cleanly in `main()` while preserving `-j 0` worker clamping (`max(1, jobs)`), ordered `::group::` / `::endgroup::` output, `SKIP_EXIT_CODE = 77` reporting, and `run_checks(checks, jobs=None)` signature. - Add standalone pure-Python CLI/error/mutation suite `tests/run_checks_parallel_cli_check.py` and register `ci_run_checks_parallel_cli_check` in `CMakeLists.txt`. ## Verification - `python -B tests/run_checks_parallel_cli_check.py -v` -> `Ran 7 tests in 1.546s` (`OK`, exit 0) - `python -B tests/run_checks_parallel_check.py` -> `run_checks_parallel_check: ok` (exit 0) - Adversarial temp-copy mutation check (15 mutations across empty/exists/is_dir/is_file path validation, empty-command guard, `run_one` `OSError`/`SubprocessError` handlers & return code, `main` `ValueError`/`OSError`/`SubprocessError` handlers & exit code, upfront validation loop, `-j` clamping, and `argv` forwarding) -> `15/15 KILLED` - `python -B tests/form_coverage_check.py` -> `form coverage checks passed` (exit 0) - `python -B tests/docs_links_check.py` -> `Self-test passed. Checked 19 Markdown files and 498 links.` (exit 0) - `python -B tests/bidi_controls_check.py` -> `Self-test passed. Checked 1829 tracked source, script and build/CI files: no bidirectional controls.` (exit 0) AI-assisted.
upstream-sync closed this pull request 2026-11-25 23:02:00 +00:00
tedin7 commented 2026-11-25 23:02:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T22:41:05Z.

Review: COMMENTED


Review of head 1a5db4b7 against origin/main (3 commits behind, no overlap with the changed files).

What I checked: tools/run_checks_parallel.py (upfront script path validation, spawn-error handling in run_one, main() error exit), the new tests/run_checks_parallel_cli_check.py, and the CMake registration.

  • Behavior matches the PR text: bad paths (empty, missing, directory, non-regular) exit 1 with a one-line message before any check starts; spawn failures turn into a failing result for that check, and the other checks still run in order. -j 0 clamping, the ::group:: output and SKIP_EXIT_CODE = 77 are unchanged.
  • Existing callers (windows.yml uses run_checks and the CLI with real script paths) are not affected.
  • No other open or merged PR covers this slice.

Commands run locally:

  • python3 -B tests/run_checks_parallel_cli_check.py -> 7 tests OK
  • python3 -B tests/run_checks_parallel_check.py -> ok
  • python3 tests/docs_links_check.py -> ok; python3 tests/bidi_controls_check.py -> ok; git diff --check origin/main...HEAD -> clean
  • Mutation: catching ZeroDivisionError instead of (OSError, SubprocessError) in run_one -> the suite fails (6 errors).
  • Mutation: removing stdin=subprocess.DEVNULL -> the suite still passes. Not a blocker: nothing in the tests guards that line. A test that runs a child which reads stdin would cover it.

No blocking findings.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6065979257 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2598#pullrequestreview-6065979257). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T22:41:05Z. **Review:** COMMENTED --- Review of head 1a5db4b7 against origin/main (3 commits behind, no overlap with the changed files). What I checked: `tools/run_checks_parallel.py` (upfront script path validation, spawn-error handling in `run_one`, `main()` error exit), the new `tests/run_checks_parallel_cli_check.py`, and the CMake registration. - Behavior matches the PR text: bad paths (empty, missing, directory, non-regular) exit 1 with a one-line message before any check starts; spawn failures turn into a failing result for that check, and the other checks still run in order. `-j 0` clamping, the `::group::` output and `SKIP_EXIT_CODE = 77` are unchanged. - Existing callers (`windows.yml` uses `run_checks` and the CLI with real script paths) are not affected. - No other open or merged PR covers this slice. Commands run locally: - `python3 -B tests/run_checks_parallel_cli_check.py` -> 7 tests OK - `python3 -B tests/run_checks_parallel_check.py` -> ok - `python3 tests/docs_links_check.py` -> ok; `python3 tests/bidi_controls_check.py` -> ok; `git diff --check origin/main...HEAD` -> clean - Mutation: catching `ZeroDivisionError` instead of `(OSError, SubprocessError)` in `run_one` -> the suite fails (6 errors). - Mutation: removing `stdin=subprocess.DEVNULL` -> the suite still passes. Not a blocker: nothing in the tests guards that line. A test that runs a child which reads stdin would cover it. No blocking findings. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 23:02:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T22:43:24Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 1a5db4b7d388667484bd460b2d305d2699ed5170:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev -- -j 2): 50.40s (configure 4.28s)
    • Test (ctest --preset dev -R '^ci_run_checks_parallel_cli_check$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (1.52s: ci_run_checks_parallel_cli_check 1.41s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release -- -j 2): 57.17s (configure 1.85s)
    • Test (ctest --preset release -R '^ci_run_checks_parallel_cli_check$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (1.39s: ci_run_checks_parallel_cli_check 1.29s)
  • Windows Python checks: tests/run_checks_parallel_check.py ok (1.7s)
  • sccache: 196/212 hits; wall 129.4s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7176710931 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2598#issuecomment-7176710931). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T22:43:24Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `1a5db4b7d388667484bd460b2d305d2699ed5170`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev -- -j 2`): `50.40s` (configure `4.28s`) - Test (`ctest --preset dev -R '^ci_run_checks_parallel_cli_check$' --parallel 2 --no-tests=error --output-on-failure`): **1/1 passed** (`1.52s`: `ci_run_checks_parallel_cli_check` `1.41s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release -- -j 2`): `57.17s` (configure `1.85s`) - Test (`ctest --preset release -R '^ci_run_checks_parallel_cli_check$' --parallel 2 --no-tests=error --output-on-failure`): **1/1 passed** (`1.39s`: `ci_run_checks_parallel_cli_check` `1.29s`) - **Windows Python checks**: `tests/run_checks_parallel_check.py` ok (`1.7s`) - `sccache`: 196/212 hits; wall `129.4s` AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2590
No description provided.