Skip to content

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

Draft
Kaairim wants to merge 1 commit into
xcl-dev:mainfrom
Kaairim:pr-check-tests
Draft

Kaairim wants to merge 1 commit into
xcl-dev:mainfrom
Kaairim:pr-check-tests

Conversation

@Kaairim

@Kaairim Kaairim commented Nov 24, 2026

Copy link
Copy Markdown

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

The merge gate had no tests while several open PRs change it. The tests
cover the sections, refused models, game data and binaries, what counts
as runtime, and the regression-run rules on both sides of each limit
(80 % frames, 125 % peak commit). They call check() directly: no GitHub
or git. scripts.yml runs them on pushes and PRs that touch the checker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anes66

anes66 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants