pe: validate intake_exe CLI build, candidate, metadata, and report paths upfront #2678

Merged
Ammmae0x merged 2 commits from upstream-pr/2686 into main 2026-11-26 03:24:47 +00:00
Ammmae0x commented 2026-11-26 02:03:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-26T02:03:27Z.


Change

Validate tools/intake_exe.py CLI paths upfront in main() before calling collect(), and add a pure-Python CLI test suite (tests/intake_exe_cli_check.py) registered in CMakeLists.txt as pe_intake_exe_cli_check (TIMEOUT 60).

  • Validate upfront that --build exists and is a directory before resolving paths.
  • Validate upfront that --reports is not a symlink or regular file, and has no non-directory parent, before collect() runs.
  • Validate upfront that an existing/symlink explicit candidate is a regular file (preserving missing-candidate error-report exit code 2 in tests/intake_exe_check.py), and that --baseline and --integrity exist as regular files (not directories or missing), exiting cleanly with code 1 and zero raw tracebacks or stray .tmp files.

Verification

  • Commit: e5297bb8 (based on upstream/main b2564017)
  • out\pe-env\Scripts\python.exe -B tests\intake_exe_cli_check.py -> Ran 6 tests in 2.613s / OK (exit 0)
  • out\pe-env\Scripts\python.exe -B tests\intake_exe_check.py -> Ran 5 tests in 2.949s / 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 19 Markdown files and 515 links. (exit 0)
  • out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py -> Self-test passed. Checked 1906 tracked source, script and build/CI files: no bidirectional controls. (exit 0)
  • Spot-mutation gate: 3/3 mutations killed (args.build.is_dir(), args.reports.is_symlink(), args.baseline.is_file()).
  • Negative controls: missing/file --build, directory candidate, missing/directory --baseline and --integrity, --reports as regular file / file parent / symlink / inside --build (verifying collect() is never called), --require-routing unsupported import exit 1, simulated os.replace failure leaving zero .tmp files, and Python 3.14-safe argparse checks.

Evidence and follow-up

All packages and PE32+ executables in tests/intake_exe_cli_check.py are synthetically constructed using the helpers in tests/intake_exe_check.py under the repository MIT license; no external binaries or game files are used. Existing tests/intake_exe_check.py behavior and report schemas remain unchanged.

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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6617867720 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2686). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-26T02:03:27Z. --- ## Change Validate `tools/intake_exe.py` CLI paths upfront in `main()` before calling `collect()`, and add a pure-Python CLI test suite (`tests/intake_exe_cli_check.py`) registered in `CMakeLists.txt` as `pe_intake_exe_cli_check` (`TIMEOUT 60`). - Validate upfront that `--build` exists and is a directory before resolving paths. - Validate upfront that `--reports` is not a symlink or regular file, and has no non-directory parent, before `collect()` runs. - Validate upfront that an existing/symlink explicit `candidate` is a regular file (preserving missing-candidate error-report exit code `2` in `tests/intake_exe_check.py`), and that `--baseline` and `--integrity` exist as regular files (not directories or missing), exiting cleanly with code `1` and zero raw tracebacks or stray `.tmp` files. ## Verification - Commit: `e5297bb8` (based on `upstream/main` `b2564017`) - `out\pe-env\Scripts\python.exe -B tests\intake_exe_cli_check.py` -> `Ran 6 tests in 2.613s / OK` (exit 0) - `out\pe-env\Scripts\python.exe -B tests\intake_exe_check.py` -> `Ran 5 tests in 2.949s / 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 19 Markdown files and 515 links.` (exit 0) - `out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py` -> `Self-test passed. Checked 1906 tracked source, script and build/CI files: no bidirectional controls.` (exit 0) - Spot-mutation gate: 3/3 mutations killed (`args.build.is_dir()`, `args.reports.is_symlink()`, `args.baseline.is_file()`). - Negative controls: missing/file `--build`, directory candidate, missing/directory `--baseline` and `--integrity`, `--reports` as regular file / file parent / symlink / inside `--build` (verifying `collect()` is never called), `--require-routing` unsupported import exit `1`, simulated `os.replace` failure leaving zero `.tmp` files, and Python 3.14-safe argparse checks. ## Evidence and follow-up All packages and PE32+ executables in `tests/intake_exe_cli_check.py` are synthetically constructed using the helpers in `tests/intake_exe_check.py` under the repository MIT license; no external binaries or game files are used. Existing `tests/intake_exe_check.py` behavior and report schemas remain unchanged. ## 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.
upstream-sync closed this pull request 2026-11-26 04:04:20 +00:00
tedin7 commented 2026-11-26 04:04:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:07:56Z.

Review: COMMENTED


Review of head 6764c85e (after update with main).

Looks sound. main() now validates --build, --reports, candidate, --baseline and --integrity before collect() and exits 1 with a clean message. Missing-candidate exit code 2 is preserved. The new pe_intake_exe_cli_check test is registered in CMake next to pe_intake_checks. No other open PR covers this slice (#2358 is merged and covers the unit/atomic-cleanup side).

Commands run (Linux, pefile in a venv):

  • tests/intake_exe_cli_check.py -> Ran 6 tests, OK
  • tests/intake_exe_check.py -> 4 of 5 pass; test_inside_rejects_traversal_root_and_absolute_paths (drive-letter path) fails on Linux, and fails identically on origin/main, so it is a platform difference and not from this PR
  • tests/docs_links_check.py OK, tests/bidi_controls_check.py OK, git diff --check origin/main...HEAD clean
  • Mutation 1 (disable the --build is_dir check): new suite fails (1 failure)
  • Mutation 2 (disable the --baseline is_file check): new suite fails (1 failure)

Windows WARP run follows separately.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6068018418 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2686#pullrequestreview-6068018418). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:07:56Z. **Review:** COMMENTED --- Review of head 6764c85e (after update with main). Looks sound. `main()` now validates `--build`, `--reports`, candidate, `--baseline` and `--integrity` before `collect()` and exits 1 with a clean message. Missing-candidate exit code 2 is preserved. The new `pe_intake_exe_cli_check` test is registered in CMake next to `pe_intake_checks`. No other open PR covers this slice (#2358 is merged and covers the unit/atomic-cleanup side). Commands run (Linux, pefile in a venv): - `tests/intake_exe_cli_check.py` -> Ran 6 tests, OK - `tests/intake_exe_check.py` -> 4 of 5 pass; `test_inside_rejects_traversal_root_and_absolute_paths` (drive-letter path) fails on Linux, and fails identically on origin/main, so it is a platform difference and not from this PR - `tests/docs_links_check.py` OK, `tests/bidi_controls_check.py` OK, `git diff --check origin/main...HEAD` clean - Mutation 1 (disable the `--build is_dir` check): new suite fails (1 failure) - Mutation 2 (disable the `--baseline is_file` check): new suite fails (1 failure) Windows WARP run follows separately. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 04:04:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:24:07Z.


Win2025 WARP receipt for head 6764c85e after updating with main.

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

  • Debug (--preset dev):
    • Build (cmake --build --preset dev -- -j 2): 427.67s (configure 4.12s)
    • Test (ctest --preset dev -R 'pe_intake' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (9.08s: pe_intake_checks 4.67s, pe_intake_exe_cli_check 8.72s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release -- -j 2): 495.06s (configure 5.14s)
    • Test (ctest --preset release -R 'pe_intake' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (5.76s: pe_intake_checks 4.06s, pe_intake_exe_cli_check 5.55s)
  • Windows Python checks: tests/intake/import_forms_check.py ok (0.5s), tests/intake/routing_check.py ok (0.8s)
  • sccache: 2196/2510 hits; wall 954.9s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181686605 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2686#issuecomment-7181686605). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:24:07Z. --- Win2025 WARP receipt for head 6764c85e after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `6764c85ed9cd77c2cd23f713a44732a5f8a26c22`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev -- -j 2`): `427.67s` (configure `4.12s`) - Test (`ctest --preset dev -R 'pe_intake' --parallel 2 --no-tests=error --output-on-failure`): **2/2 passed** (`9.08s`: `pe_intake_checks` `4.67s`, `pe_intake_exe_cli_check` `8.72s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release -- -j 2`): `495.06s` (configure `5.14s`) - Test (`ctest --preset release -R 'pe_intake' --parallel 2 --no-tests=error --output-on-failure`): **2/2 passed** (`5.76s`: `pe_intake_checks` `4.06s`, `pe_intake_exe_cli_check` `5.55s`) - **Windows Python checks**: `tests/intake/import_forms_check.py` ok (`0.5s`), `tests/intake/routing_check.py` ok (`0.8s`) - `sccache`: 2196/2510 hits; wall `954.9s` 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!2678
No description provided.