ci: parse every Python file under tools/startup #1578

Manually merged
github merged 3 commits from gh-pr/1578/head into gh-pr/1578/base 2026-11-26 23:18:11 +00:00
Owner

@⁠triggered02 on GitHub · 2026-11-24 14:33 UTC · original
triggered02:ci/startup-tools-lint → main · +77 −1 · 3 files · 3 commits · merged 2026-11-24 14:54 UTC

Refs #1149. Adds startup_tools_lint: a device-free check that compiles every tools/startup/*.py without importing or running it, reporting path:line: message for anything that cannot be parsed, and registers it in the pr test preset so it gates pull requests.

The check

ctest --preset pr -N   -> Test  #41: startup_tools_lint
ctest --preset pr -R '^startup_tools_lint$' -V
41: PASS: 7 files under .../tools/startup parse; control snippet rejected and valid snippet accepted

The self-test is what makes a passing run meaningful: a deliberately broken snippet must be rejected and a valid one accepted, so "0 problems" cannot come from a harness that never parsed anything.

Fail-first

With a file containing def broken(: added under tools/startup:

syntax error: tools\startup\_lint_control_broken.py:1: invalid syntax
FAIL: 1 of 8 files under tools/startup cannot be parsed     (exit 1)

Removing it returns to PASS: 7 files ... (exit 0).

Two corrections inside this PR

  • My first version read the sources as utf-8 and flagged a UTF-8 BOM as a syntax error. Python accepts a BOM in source, so that would have failed a file the interpreter runs; it now reads utf-8-sig, and a BOM-prefixed file whose body is valid passes.
  • Registering the test was not sufficient to gate PRs: the pr preset filters by test name (caught in review). startup_tools_lint is now in pr.filter.include.name, verified with ctest --preset pr -N.

What this does not establish

  • Parse errors only. It is not a style linter, does not resolve imports, and says nothing about what the tools do.
  • It does not cover the other items on #1149's checklist (labels, the pe_package_import_closure skip, the fixture corpus). Those stay open; this PR does not touch the workflow or any tool.

AI-assisted (Claude Code).

**@⁠triggered02** on GitHub · 2026-11-24 14:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1578) `triggered02:ci/startup-tools-lint` → `main` · +77 −1 · 3 files · 3 commits · merged 2026-11-24 14:54 UTC Refs #1149. Adds `startup_tools_lint`: a device-free check that compiles every `tools/startup/*.py` without importing or running it, reporting `path:line: message` for anything that cannot be parsed, and registers it in the `pr` test preset so it gates pull requests. ## The check ``` ctest --preset pr -N -> Test #41: startup_tools_lint ctest --preset pr -R '^startup_tools_lint$' -V 41: PASS: 7 files under .../tools/startup parse; control snippet rejected and valid snippet accepted ``` The self-test is what makes a passing run meaningful: a deliberately broken snippet must be rejected and a valid one accepted, so "0 problems" cannot come from a harness that never parsed anything. ## Fail-first With a file containing `def broken(:` added under `tools/startup`: ``` syntax error: tools\startup\_lint_control_broken.py:1: invalid syntax FAIL: 1 of 8 files under tools/startup cannot be parsed (exit 1) ``` Removing it returns to `PASS: 7 files ...` (exit 0). ## Two corrections inside this PR - My first version read the sources as `utf-8` and flagged a UTF-8 BOM as a syntax error. Python accepts a BOM in source, so that would have failed a file the interpreter runs; it now reads `utf-8-sig`, and a BOM-prefixed file whose body is valid passes. - Registering the test was not sufficient to gate PRs: the `pr` preset filters by test name (caught in review). `startup_tools_lint` is now in `pr.filter.include.name`, verified with `ctest --preset pr -N`. ## What this does not establish - Parse errors only. It is not a style linter, does not resolve imports, and says nothing about what the tools do. - It does not cover the other items on #1149's checklist (labels, the `pe_package_import_closure` skip, the fixture corpus). Those stay open; this PR does not touch the workflow or any tool. AI-assisted (Claude Code).
Refs #1149. Adds `startup_tools_lint`, a device-free check that compiles each `tools/startup/*.py` without
importing or running it and reports `path:line: message` for anything that cannot be parsed. It needs no GPU
and no game files, and the Windows build-and-test job already runs ctest, so registering the test puts it in
CI without a workflow change.

The self-test is what keeps a passing run meaningful: a deliberately broken snippet must be rejected and a
valid one accepted, so "0 problems" cannot come from a harness that never parsed anything.

Two details found while building it:

- A UTF-8 BOM is tolerated (`utf-8-sig`) because Python accepts one in source; treating it as a syntax error
  would have failed a file the interpreter runs.
- Fail-first: with `def broken(:` added under tools/startup the check reports
  `syntax error: tools\startup\_lint_control_broken.py:1: invalid syntax` and exits 1; removing the file
  returns to `PASS: 7 files under tools/startup parse; control snippet rejected and valid snippet accepted`.

What this does not establish: it reports parse errors only. It is not a style linter, it does not check that
imports resolve at run time, and it says nothing about the tools' behaviour.
The pr test preset filters by test name, so registering startup_tools_lint in CMake was not enough: pull
requests run only the allowlisted names and the check would have stayed outside the gate.

Verified with the preset itself:

  ctest --preset pr -N            -> Test #41: startup_tools_lint (Total Tests: 26)
  ctest --preset pr -R ...        -> Test #41 ... Passed 0.11 sec

The other failures seen when running the whole pr preset in this tree are its build targets not having been
built here; this change only adds the one name to the filter.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:18:09 +00:00
github manually merged commit ded0fa0e72 into gh-pr/1578/base 2026-11-26 23:18:11 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 14:33 UTC · original · edited 2026-11-24 14:37 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T14:37:03.005340Z 408ef09 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 14:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1578#issuecomment-7134570027) · edited 2026-11-24 14:37 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"408ef09a184796e9951c9926e99f70b9aa9ee095","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T14:37:03.005340Z">2026-11-24T14:37:03.005340Z</relative-time> | `408ef09` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
@ -171,0 +171,4 @@
# Startup tooling lint (#1149): every Python file under tools/startup must parse. The check compiles each
# source without running it and self-tests that a broken snippet is rejected, so a passing run means the
# files were actually looked at. It needs no GPU and no game files.
add_test(NAME startup_tools_lint COMMAND "${INTAKE_PYTHON}" -B
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 14:37 UTC · original

P2 Badge Add the check to the PR test preset

For pull requests, .github/workflows/windows.yml runs ctest --preset pr (lines 174–177), but CMakePresets.json's pr.filter.include.name allowlist (lines 42–45) omits startup_tools_lint; CMake documents this field as “a regex for test names” equivalent to --tests-regex. The check therefore runs in full non-PR suites but does not gate pull requests, so a syntax regression can merge before this check catches it. Add the test to the PR filter or invoke it separately.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 14:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1578#discussion_r4681592036) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Add the check to the PR test preset** For pull requests, `.github/workflows/windows.yml` runs `ctest --preset pr` (lines 174–177), but `CMakePresets.json`'s `pr.filter.include.name` allowlist (lines 42–45) omits `startup_tools_lint`; CMake documents this field as “a regex for test names” equivalent to `--tests-regex`. The check therefore runs in full non-PR suites but does not gate pull requests, so a syntax regression can merge before this check catches it. Add the test to the PR filter or invoke it separately. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠triggered02 on GitHub · 2026-11-24 14:37 UTC · original

Correct, and my PR description was wrong on that point: registering the test in CMakeLists.txt does not put it in front of pull requests. ctest --preset pr filters by test name, and the allowlist did not include it. Fixed in f56b2c44 by adding startup_tools_lint to pr.filter.include.name.

Verified with the preset itself rather than by reasoning about the regex:

ctest --preset pr -N   -> Test  #41: startup_tools_lint
                          Total Tests: 26
ctest --preset pr -R '^startup_tools_lint$'  -> Passed 0.11 sec

(The rest of the pr preset fails in my tree because I only configured it and did not build its targets — that is unrelated to this check and I did not touch any of them.)

I have corrected the PR description too: it now says the test is selected by the pr preset instead of claiming CI picks it up automatically.

**@⁠triggered02** on GitHub · 2026-11-24 14:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1578#issuecomment-7134691326) Correct, and my PR description was wrong on that point: registering the test in `CMakeLists.txt` does not put it in front of pull requests. `ctest --preset pr` filters by test name, and the allowlist did not include it. Fixed in `f56b2c44` by adding `startup_tools_lint` to `pr.filter.include.name`. Verified with the preset itself rather than by reasoning about the regex: ``` ctest --preset pr -N -> Test #41: startup_tools_lint Total Tests: 26 ctest --preset pr -R '^startup_tools_lint$' -> Passed 0.11 sec ``` (The rest of the `pr` preset fails in my tree because I only configured it and did not build its targets — that is unrelated to this check and I did not touch any of them.) I have corrected the PR description too: it now says the test is selected by the `pr` preset instead of claiming CI picks it up automatically.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 14:49 UTC · original

Updated the parser check at ded0fa0e to compile source bytes so it follows Python BOM and encoding-cookie rules. The self-test now scans actual files, accepts UTF-8 BOM and Latin-1 declarations, and requires a syntax diagnostic on line 2 of the malformed file. Verified the Windows startup_tools_lint test with ctest --preset pr on the updated branch.

**@⁠R0Y00** on GitHub · 2026-11-24 14:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1578#issuecomment-7134997236) Updated the parser check at ded0fa0e to compile source bytes so it follows Python BOM and encoding-cookie rules. The self-test now scans actual files, accepts UTF-8 BOM and Latin-1 declarations, and requires a syntax diagnostic on line 2 of the malformed file. Verified the Windows startup_tools_lint test with ctest --preset pr on the updated branch.
@ -171,0 +171,4 @@
# Startup tooling lint (#1149): every Python file under tools/startup must parse. The check compiles each
# source without running it and self-tests that a broken snippet is rejected, so a passing run means the
# files were actually looked at. It needs no GPU and no game files.
add_test(NAME startup_tools_lint COMMAND "${INTAKE_PYTHON}" -B
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 14:52 UTC · original

The PR preset already includes startup_tools_lint on this head. I verified the exact preset filter and ran ctest --preset pr --no-tests=error -R "^startup_tools_lint$" on the updated sources. The selected test passed 1/1 on Windows.

**@⁠R0Y00** on GitHub · 2026-11-24 14:52 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1578#discussion_r4681817561) The PR preset already includes startup_tools_lint on this head. I verified the exact preset filter and ran ctest --preset pr --no-tests=error -R "^startup_tools_lint$" on the updated sources. The selected test passed 1/1 on Windows.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 14:37 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 408ef09a18

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 14:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1578#pullrequestreview-6041226746) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `408ef09a18` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.