Scripts: reject empty required sections in pr_check.py and expand unit tests #969

Closed
certified-retart wants to merge 1 commit from upstream-pr/975 into main
certified-retart commented 2026-11-24 09:47:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by certified-retart on 2026-11-24T09:47:23Z.


Fixes an empty-section bypass in scripts/pr_check.py where a blank **Tested** or **Not tested** heading followed by another template heading (such as **Regression run** or **Not tested**) matched \s*\n\s*\S against the next heading and passed as non-empty, and expands scripts/test_pr_check.py to cover all check branches of pr_check.py.

What is in it

  • scripts/pr_check.py: extract each required section's body up to the next template heading (What is in it, Tested, Regression run, Not tested, AI use) or end of text before checking .strip(), so empty sections followed by another template heading are rejected while bold subheadings (e.g. **Machine:**) inside a section remain accepted.
  • scripts/test_pr_check.py: add 7 unit tests (PrCheckRulesTests) covering empty/adjacent required sections, bold subheadings, banned open-weight models vs frontier models, game files / binary / tests/data/ 1 MiB limit / removed-file skips, valid xcl-smoke v1 pairs at exact thresholds (0.8× frames, 1.25× peak commit), uncommitted/non-main smoke blocks, device removals / crashes / killed / title-or-seconds mismatches, and frame-drop / commit-growth rejections.

Tested

  • Host: Windows 10 Pro build 19045, Python 3.14.6.
  • python -m unittest discover -s scripts -v: 10 passed, 0 failed (before the pr_check.py fix, test_missing_or_empty_sections_are_reported failed with 2 != 0).
  • Checked the updated section check against the 25 most recent merged PR descriptions on ivall/xcl: 0 diffs vs the previous regex.
  • Rust workspace not rebuilt/run here (scripts-only change; no Rust files modified).

Regression run
Not needed: this PR changes only scripts/pr_check.py and scripts/test_pr_check.py and does not touch crates/xcl/src/.

Not tested

  • The live GitHub Actions pull_request_target workflow itself (which runs main's copy of scripts/pr_check.py until merged) or pr_check.py's --repo GitHub API CLI paths.
  • Retail titles or GPU tests.

AI use

  • Antigravity (gemini-4-neon) wrote the fix, unit tests, and this description, and ran the Python test suite and merged-PR corpus check above.
<!-- greyfinch-sync:ivall/xcl:issue:6579025206 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/975). Originally posted by [certified-retart](https://github.com/certified-retart) on 2026-11-24T09:47:23Z. --- Fixes an empty-section bypass in `scripts/pr_check.py` where a blank `**Tested**` or `**Not tested**` heading followed by another template heading (such as `**Regression run**` or `**Not tested**`) matched `\s*\n\s*\S` against the next heading and passed as non-empty, and expands `scripts/test_pr_check.py` to cover all check branches of `pr_check.py`. **What is in it** - `scripts/pr_check.py`: extract each required section's body up to the next template heading (`What is in it`, `Tested`, `Regression run`, `Not tested`, `AI use`) or end of text before checking `.strip()`, so empty sections followed by another template heading are rejected while bold subheadings (e.g. `**Machine:**`) inside a section remain accepted. - `scripts/test_pr_check.py`: add 7 unit tests (`PrCheckRulesTests`) covering empty/adjacent required sections, bold subheadings, banned open-weight models vs frontier models, game files / binary / `tests/data/` 1 MiB limit / removed-file skips, valid `xcl-smoke v1` pairs at exact thresholds (`0.8×` frames, `1.25×` peak commit), uncommitted/non-main smoke blocks, `device removals` / `crashes` / `killed` / title-or-seconds mismatches, and frame-drop / commit-growth rejections. **Tested** - Host: Windows 10 Pro build 19045, Python `3.14.6`. - `python -m unittest discover -s scripts -v`: 10 passed, 0 failed (before the `pr_check.py` fix, `test_missing_or_empty_sections_are_reported` failed with `2 != 0`). - Checked the updated section check against the 25 most recent merged PR descriptions on `ivall/xcl`: 0 diffs vs the previous regex. - Rust workspace not rebuilt/run here (scripts-only change; no Rust files modified). **Regression run** Not needed: this PR changes only `scripts/pr_check.py` and `scripts/test_pr_check.py` and does not touch `crates/xcl/src/`. **Not tested** - The live GitHub Actions `pull_request_target` workflow itself (which runs `main`'s copy of `scripts/pr_check.py` until merged) or `pr_check.py`'s `--repo` GitHub API CLI paths. - Retail titles or GPU tests. **AI use** - Antigravity (`gemini-4-neon`) wrote the fix, unit tests, and this description, and ran the Python test suite and merged-PR corpus check above.
pane33 commented 2026-11-24 11:05:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pane33 on 2026-11-24T10:43:59Z.

Review: APPROVED


Tested locally on Fedora and confirmed the fix for empty sections, though note that the branch currently predates 6522c24 (smoke_blocks() updates) and will need a rebase against main.

Tested

Verified PR head 3fb8a36206be754b3dc7c648df91bdb984260b03 on Fedora Linux 45 Workstation with Python 3.15.2:

  • PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts -p test_pr_check.py -v — 10 passed, 0 failed, 0 skipped.
  • Reproduced the before/after behavior against pr_check.check() comparing main (6efdabcdaac93ce5cc123a85e85deba5d49cb294) and 3fb8a36206be754b3dc7c648df91bdb984260b03: a whitespace-only **Tested** section followed by **Not tested** returned [] on main and ['the **Tested** section is missing or empty'] on the PR head, while a valid section containing **Machine:** and **Result:** subheadings continued to return [] on both.

Not tested

Windows build and Rust test suite, GPU/smoke runs, the live GitHub Actions workflow, and the rebased merge result with current main.

AI use

Used OpenAI Codex CLI (GPT-6.2-Sol) to run the local verification commands and help structure this report.

<!-- greyfinch-sync:ivall/xcl:review:6037775431 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/975#pullrequestreview-6037775431). Originally posted by [pane33](https://github.com/pane33) on 2026-11-24T10:43:59Z. **Review:** APPROVED --- Tested locally on Fedora and confirmed the fix for empty sections, though note that the branch currently predates `6522c24` (`smoke_blocks()` updates) and will need a rebase against `main`. **Tested** Verified PR head `3fb8a36206be754b3dc7c648df91bdb984260b03` on Fedora Linux 45 Workstation with Python 3.15.2: - `PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts -p test_pr_check.py -v` — 10 passed, 0 failed, 0 skipped. - Reproduced the before/after behavior against `pr_check.check()` comparing `main` (`6efdabcdaac93ce5cc123a85e85deba5d49cb294`) and `3fb8a36206be754b3dc7c648df91bdb984260b03`: a whitespace-only `**Tested**` section followed by `**Not tested**` returned `[]` on `main` and `['the **Tested** section is missing or empty']` on the PR head, while a valid section containing `**Machine:**` and `**Result:**` subheadings continued to return `[]` on both. **Not tested** Windows build and Rust test suite, GPU/smoke runs, the live GitHub Actions workflow, and the rebased merge result with current `main`. **AI use** Used OpenAI Codex CLI (GPT-6.2-Sol) to run the local verification commands and help structure this report.
DavidM1911 commented 2026-11-24 13:03:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T12:22:56Z.


Independent check — this looks superseded by merged #1037 (the #965 fix, now on main 384f7f7).

  • main's pr_check.py already has section_has_content(), which requires at least one non-placeholder, non-comment line per section — that covers this PR's goal of rejecting empty required sections.
  • The branch also conflicts with current main in scripts/test_pr_check.py (the file was added by #1037 after this branch was cut).

Worth a rebase check by the author, but likely closeable.

AI use: review by Devin (Cognition, SWE-2); no code changes.

<!-- greyfinch-sync:ivall/xcl:comment:7131359335 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/975#issuecomment-7131359335). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T12:22:56Z. --- Independent check — this looks **superseded by merged #1037** (the #965 fix, now on `main` `384f7f7`). - `main`'s `pr_check.py` already has `section_has_content()`, which requires at least one non-placeholder, non-comment line per section — that covers this PR's goal of rejecting empty required sections. - The branch also **conflicts** with current `main` in `scripts/test_pr_check.py` (the file was added by #1037 after this branch was cut). Worth a rebase check by the author, but likely closeable. AI use: review by Devin (Cognition, SWE-2); no code changes.
upstream-sync closed this pull request 2026-11-24 17:05:15 +00:00
certified-retart commented 2026-11-24 17:06:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by certified-retart on 2026-11-24T17:01:27Z.


Closing as superseded by #965 (which landed \section_has_content\ / \TemplatePlaceholderTests\ in \scripts/pr_check.py\ and \scripts/test_pr_check.py) and #1133 (\SmokeBlockTests).

<!-- greyfinch-sync:ivall/xcl:comment:7138567804 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/975#issuecomment-7138567804). Originally posted by [certified-retart](https://github.com/certified-retart) on 2026-11-24T17:01:27Z. --- Closing as superseded by #965 (which landed \section_has_content\ / \TemplatePlaceholderTests\ in \scripts/pr_check.py\ and \scripts/test_pr_check.py\) and #1133 (\SmokeBlockTests\).

Pull request closed

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!969
No description provided.