Tests: unit tests for scripts/pr_check.py, run when it changes #592

Open
Kaairim wants to merge 1 commit from upstream-pr/597 into main
Kaairim commented 2026-11-24 02:19:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kaairim on 2026-11-24T02:19:27Z.


scripts/pr_check.py is the merge gate, has no tests, and several open PRs change it (#536, #527, #513, #507, #497). These unit tests pin its current rules so a change to it shows what it changes. They call check() directly with a fake is_main_ancestor: no GitHub, no git. A small workflow runs them when the checker or its tests change.

What is in it

  • scripts/test_pr_check.py: 23 tests – sections, refused models (only inside AI use), game data and binaries (tests/data limit), what counts as runtime, and the regression-run rules: head and main blocks, uncommitted runs, device removals / crashes, killed runs, same title and time, the 80 % frames and 125 % peak-commit limits on both sides
  • .github/workflows/scripts.yml: python3 -m unittest discover -s scripts -p "test_*.py" on pushes to main and PRs touching those files

Tested

  • Windows 11 (26300), Python 3.12.10: python -m unittest discover -s scripts -p "test_*.py" -v: 23 passed, 0 failed
  • No Rust code changed, so no cargo run

Not tested

  • The workflow itself: it runs on ubuntu-latest's python3 once the PR is open

AI use

  • Claude Code with Claude Opus 5.5: found the gap while analysing the repository, wrote the change and this description; a second Claude Opus 5.5 agent reviewed the diff. I read every line.

Improvements by William "kaairim" Deivid (wdcore).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5464841707 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/597). Originally posted by [Kaairim](https://github.com/Kaairim) on 2026-11-24T02:19:27Z. --- `scripts/pr_check.py` is the merge gate, has no tests, and several open PRs change it (#536, #527, #513, #507, #497). These unit tests pin its current rules so a change to it shows what it changes. They call `check()` directly with a fake `is_main_ancestor`: no GitHub, no git. A small workflow runs them when the checker or its tests change. **What is in it** - `scripts/test_pr_check.py`: 23 tests – sections, refused models (only inside **AI use**), game data and binaries (tests/data limit), what counts as runtime, and the regression-run rules: head and main blocks, uncommitted runs, device removals / crashes, killed runs, same title and time, the 80 % frames and 125 % peak-commit limits on both sides - `.github/workflows/scripts.yml`: `python3 -m unittest discover -s scripts -p "test_*.py"` on pushes to main and PRs touching those files **Tested** - Windows 11 (26300), Python 3.12.10: `python -m unittest discover -s scripts -p "test_*.py" -v`: 23 passed, 0 failed - No Rust code changed, so no cargo run **Not tested** - The workflow itself: it runs on ubuntu-latest's python3 once the PR is open **AI use** - Claude Code with Claude Opus 5.5: found the gap while analysing the repository, wrote the change and this description; a second Claude Opus 5.5 agent reviewed the diff. I read every line. Improvements by William "kaairim" Deivid (wdcore). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
anes66 commented 2026-11-24 07:06:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by anes66 on 2026-11-24T03:59:05Z.


Verified c28f5cff119bf9f6938fc2631b19d0a7bafd8e22 on Windows 10 Pro (build 19045), Ryzen 7 9800X3D, Python 3.11.4.

Tested

  • python -m unittest discover -s scripts -p "test_*.py" -v: 23 passed, 0 failed, 0 errors, 0 skipped.
  • The same suite passed with the checker loaded from main f4ce27ceb6d1b0576d0c659b713b674778bf1968.
  • Six separate in-memory mutations each produced an assertion failure: disabling the frame threshold, increasing the memory limit, accepting dirty head runs, accepting a non-main baseline, checking removed files, and allowing oversized test binaries.
  • Five additional probes against main passed: ordinary runtime changes still require smoke blocks; test_only=True waives smoke while preserving the section, game-data and model checks.

The newer test_only parameter is not covered by this PR's suite. When rebasing, it would be useful to add permanent tests showing that the waiver applies only to smoke checks. The probes above were external checks, not additions to the PR.

Not tested
GitHub Actions on Ubuntu, the Rust workspace, GPU tests or retail titles.

AI use
Codex (GPT-6; exact variant unavailable) inspected the changes, wrote and ran the external verification harness, and drafted this report.

Integration follow-up
Main f4ce27c already contains three TestOnlyApprovalTests in scripts/test_pr_check.py; this PR currently has an add/add conflict on that path. My earlier coverage suggestion concerns the PR snapshot, not missing coverage on main.

I tested a main-based layout that keeps main's file unchanged and puts this PR's 23 tests in scripts/test_pr_check_rules.py. Updating both path filters in scripts.yml to scripts/test_pr_check*.py lets discovery run all 26 tests: 26 passed, 0 failed. This preserves the existing approval checks without rewriting either test set. No checker/runtime changes are needed. This is a local integration proposal, not a merge or a second PR.

Current-main integration available

511572f integrates this head onto main b7aa9f3 while retaining main's existing scripts/test_pr_check.py. Your 23 rule tests are in scripts/test_pr_check_rules.py; only the filename and the discovery command in its docstring change. Checker code and test assertions are unchanged.

python -B -m unittest discover -s scripts -p 'test_pr_check*.py' -v: 36 passed / 0 failed (main's 13 plus these 23), Windows 10, CPython 3.11.4.

The workflow uses that same discovery pattern and its path filters cover both test modules. Local YAML parsing checked both event filters and the read-only contents permission. The GitHub Actions job itself was not run.

An external in-memory mutation harness ran both suites against seven controlled changes: lower frame threshold, higher memory threshold, acceptance of dirty head runs/non-main baselines, checking removed assets, oversized fixtures, and unfilled templates. All seven produced assertion failures, with no test errors. The on-disk checker stayed unchanged. No Rust/GPU/title run for this test/workflow-only integration.

AI use: Codex (GPT-6; exact variant unavailable) resolved the integration, checked discovery and the workflow, ran the mutation probes, and prepared this update. Your original commit remains in the merge history.

<!-- greyfinch-sync:ivall/xcl:comment:7121599702 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/597#issuecomment-7121599702). Originally posted by [anes66](https://github.com/anes66) on 2026-11-24T03:59:05Z. --- Verified `c28f5cff119bf9f6938fc2631b19d0a7bafd8e22` on Windows 10 Pro (build 19045), Ryzen 7 9800X3D, Python 3.11.4. **Tested** - `python -m unittest discover -s scripts -p "test_*.py" -v`: 23 passed, 0 failed, 0 errors, 0 skipped. - The same suite passed with the checker loaded from main `f4ce27ceb6d1b0576d0c659b713b674778bf1968`. - Six separate in-memory mutations each produced an assertion failure: disabling the frame threshold, increasing the memory limit, accepting dirty head runs, accepting a non-main baseline, checking removed files, and allowing oversized test binaries. - Five additional probes against main passed: ordinary runtime changes still require smoke blocks; `test_only=True` waives smoke while preserving the section, game-data and model checks. The newer `test_only` parameter is not covered by this PR's suite. When rebasing, it would be useful to add permanent tests showing that the waiver applies only to smoke checks. The probes above were external checks, not additions to the PR. **Not tested** GitHub Actions on Ubuntu, the Rust workspace, GPU tests or retail titles. **AI use** Codex (GPT-6; exact variant unavailable) inspected the changes, wrote and ran the external verification harness, and drafted this report. **Integration follow-up** Main `f4ce27c` already contains three `TestOnlyApprovalTests` in `scripts/test_pr_check.py`; this PR currently has an add/add conflict on that path. My earlier coverage suggestion concerns the PR snapshot, not missing coverage on main. I tested a main-based layout that keeps main's file unchanged and puts this PR's 23 tests in `scripts/test_pr_check_rules.py`. Updating both path filters in `scripts.yml` to `scripts/test_pr_check*.py` lets discovery run all 26 tests: 26 passed, 0 failed. This preserves the existing approval checks without rewriting either test set. No checker/runtime changes are needed. This is a local integration proposal, not a merge or a second PR. ### Current-main integration available [511572f](https://github.com/anes66/xcl/commit/511572f2af3389fbe59f1ccfd25ad06abe966525) integrates this head onto `main b7aa9f3` while retaining main's existing `scripts/test_pr_check.py`. Your 23 rule tests are in `scripts/test_pr_check_rules.py`; only the filename and the discovery command in its docstring change. Checker code and test assertions are unchanged. `python -B -m unittest discover -s scripts -p 'test_pr_check*.py' -v`: **36 passed / 0 failed** (main's 13 plus these 23), Windows 10, CPython 3.11.4. The workflow uses that same discovery pattern and its path filters cover both test modules. Local YAML parsing checked both event filters and the read-only contents permission. The GitHub Actions job itself was not run. An external in-memory mutation harness ran both suites against seven controlled changes: lower frame threshold, higher memory threshold, acceptance of dirty head runs/non-main baselines, checking removed assets, oversized fixtures, and unfilled templates. All seven produced assertion failures, with no test errors. The on-disk checker stayed unchanged. No Rust/GPU/title run for this test/workflow-only integration. AI use: Codex (GPT-6; exact variant unavailable) resolved the integration, checked discovery and the workflow, ran the mutation probes, and prepared this update. Your original commit remains in the merge history.
DavidM1911 commented 2026-11-25 14:09:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T13:06:59Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7163312683 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/597#issuecomment-7163312683). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T13:06:59Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
github-actions[bot] commented 2026-11-29 07:43:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:43:18Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252648708 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/597#issuecomment-7252648708). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:43:18Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 03:47:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:47:17Z.


Triage (#1607) – head c28f5cf

Main has had its own scripts/test_pr_check.py since b74867b (test-only approval tests), so this PR's new file of the same name conflicts. Its cases need to be merged into main's file. #1019 also runs scripts/test_*.py in CI, as a step in ci.yml, while this PR adds a separate path-filtered workflow. Only one of the two CI hooks is needed.
The asserted message fragments (fewer frames, more memory, same title, commit of main) still exist in main's pr_check.py. The tests were not run here.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300063091 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/597#issuecomment-7300063091). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:47:17Z. --- **Triage (#1607)** – head c28f5cf Main has had its own `scripts/test_pr_check.py` since b74867b (test-only approval tests), so this PR's new file of the same name conflicts. Its cases need to be merged into main's file. #1019 also runs `scripts/test_*.py` in CI, as a step in ci.yml, while this PR adds a separate path-filtered workflow. Only one of the two CI hooks is needed. The asserted message fragments (`fewer frames`, `more memory`, `same title`, `commit of main`) still exist in main's pr_check.py. The tests were not run here. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/597:upstream-pr/597'
git switch 'upstream-pr/597'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/597'
git switch 'upstream-pr/597'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/597'
git switch 'upstream-pr/597'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/597'
git switch 'main'
git merge --squash 'upstream-pr/597'
git switch 'main'
git merge --ff-only 'upstream-pr/597'
git switch 'main'
git merge 'upstream-pr/597'
git push origin 'main'
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
xcl-dev/xcl!592
No description provided.