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

Merged
triggered02 merged 3 commits from upstream-pr/1578 into main 2026-11-24 14:54:46 +00:00
triggered02 commented 2026-11-24 14:33:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T14:33:12Z.


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).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6584161057 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1578). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T14:33:12Z. --- 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).
upstream-sync closed this pull request 2026-11-24 15:02:08 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 15:02:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T14:37:00Z.

Review: COMMENTED


💡 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".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6041226746 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1578#pullrequestreview-6041226746). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T14:37:00Z. **Review:** COMMENTED --- <!-- 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>
R0Y00 commented 2026-11-24 15:02:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:52:20Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6041529347 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1578#pullrequestreview-6041529347). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T14:52:20Z. **Review:** COMMENTED --- _No description provided._
chatgpt-codex-connector[bot commented 2026-11-24 15:02:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T14:33:26Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134570027 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1578#issuecomment-7134570027). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T14:33:26Z. --- <!-- 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>
triggered02 commented 2026-11-24 15:02:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T14:37:54Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134691326 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1578#issuecomment-7134691326). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T14:37:54Z. --- 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.
R0Y00 commented 2026-11-24 15:02:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:49:06Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134997236 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1578#issuecomment-7134997236). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T14:49:06Z. --- 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.
chatgpt-codex-connector[bot commented 2026-11-24 15:02:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T14:37:00Z.

Code review location: CMakeLists.txt; line 174

@@ -168,6 +168,12 @@ if(EXISTS "${INTAKE_PYTHON}")
         "${CMAKE_SOURCE_DIR}/tests/startup_heartbeat_check.py"
         "$<TARGET_FILE:xmem_shim>" "$<TARGET_FILE:startup_stub_xcrdapi>")
     set_tests_properties(startup_heartbeat_commit PROPERTIES TIMEOUT 60)
+    # 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

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 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4681592036 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1578#discussion_r4681592036). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T14:37:00Z. **Code review location:** `CMakeLists.txt`; line 174 ~~~~diff @@ -168,6 +168,12 @@ if(EXISTS "${INTAKE_PYTHON}") "${CMAKE_SOURCE_DIR}/tests/startup_heartbeat_check.py" "$<TARGET_FILE:xmem_shim>" "$<TARGET_FILE:startup_stub_xcrdapi>") set_tests_properties(startup_heartbeat_commit PROPERTIES TIMEOUT 60) + # 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 ~~~~ --- **<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 -->
R0Y00 commented 2026-11-24 15:02:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:52:20Z.

Code review location: CMakeLists.txt; line 174

@@ -168,6 +168,12 @@ if(EXISTS "${INTAKE_PYTHON}")
         "${CMAKE_SOURCE_DIR}/tests/startup_heartbeat_check.py"
         "$<TARGET_FILE:xmem_shim>" "$<TARGET_FILE:startup_stub_xcrdapi>")
     set_tests_properties(startup_heartbeat_commit PROPERTIES TIMEOUT 60)
+    # 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

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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4681817561 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1578#discussion_r4681817561). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T14:52:20Z. **Code review location:** `CMakeLists.txt`; line 174 ~~~~diff @@ -168,6 +168,12 @@ if(EXISTS "${INTAKE_PYTHON}") "${CMAKE_SOURCE_DIR}/tests/startup_heartbeat_check.py" "$<TARGET_FILE:xmem_shim>" "$<TARGET_FILE:startup_stub_xcrdapi>") set_tests_properties(startup_heartbeat_commit PROPERTIES TIMEOUT 60) + # 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 ~~~~ --- 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.
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!1571
No description provided.