Skip to content

PR checks: a section with nothing under it is refused as empty - #527

Open
Rareuncommon wants to merge 1 commit into
xcl-dev:mainfrom
Rareuncommon:scripts/pr-check-empty-sections
Open

Rareuncommon wants to merge 1 commit into
xcl-dev:mainfrom
Rareuncommon:scripts/pr-check-empty-sections

Conversation

@Rareuncommon

@Rareuncommon Rareuncommon commented Nov 24, 2026 •

Copy link
Copy Markdown

Rebuilt on main 930e8b4 after #965 / #1037, which took over the empty-section and template-placeholder part of this PR. What is left is where a section starts and ends: a section name in bold at the end of a sentence was taken for its heading, the heading search could start inside an HTML comment, and an unclosed <!-- was read as text.

What is in it

  • scripts/pr_check.py: section_texts() – comments are removed first (an unclosed one takes the rest of the description), and a heading, at the start or the end of a section, has to be a line of its own. section_has_content() keeps main's placeholder rule over that text. +16 −13.
  • scripts/test_pr_check.py: SectionHeadingTests, seven tests on hand-written descriptions. +57. The separate scripts/pr_check.tests.py of the earlier commits is gone; the tests are in main's file.
  • One commit (5bdaffa) replaces dc6fa59 and the two before it. The review points of @shdann and @Kalmarv (1 and 2) are in it.

Tested

Regression run

  • not a runtime change (scripts only)

Not tested

  • The Rust workspace was not built or tested by me: no Windows machine. The full-suite runs in the comments (@arcwiser, @upipibi: 676 passed, 0 failed, 41 ignored) were made on the earlier heads 23a208d and dc6fa59, not on 5bdaffa; this PR changes no Rust.
  • The PR checks workflow on GitHub's runner.

AI use

  • Claude Code with Claude Fable 5.2: found the defect, wrote the fix, the tests and this description. Reviewed by the author.

@shdann shdann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At scripts/pr_check.py:46, the heading search can start inside an HTML comment. I ran the checker from 23a208d with a description that put the entire Tested heading and its only result inside an HTML comment. The checker returned no problems. It also accepted prose ending in Tested on the same line. Remove HTML comments before matching headings and require the heading at the start of a line. Add a test with the whole required section hidden in a comment. Reproduced with OpenAI Codex (GPT-6.2 Sol).

@arcwiser

Copy link
Copy Markdown

Tested exact head 23a208d2f5f68e6c532f0e188de4f57d084ac4dd on Windows.

  • python scripts/pr_check.tests.py: 8 passed, 0 failed.
  • .\scripts\test.ps1: workspace build passed; 676 passed, 0 failed, 41 ignored.
  • GPU tests reported 2 skips (both no wave64): gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware. These skips are not counted as coverage.
  • The XCL_SAMPLE_* variables were unset, so optional game-data tests did not run.

Machine: Windows 11 Home build 26200; AMD Ryzen 5 7500F; NVIDIA GeForce RTX 4070 SUPER 12 GB, driver 610.88; Rust 1.100.0 MSVC; DXC 1.9.2602.17 from Windows SDK 10.0.28000.0; debug profile.

AI use: OpenAI Codex with GPT-5 selected the verification scope, ran the commands, and drafted this report; I am posting only the measured results above.

Rareuncommon added a commit to Rareuncommon/xcl that referenced this pull request Nov 24, 2026
…there

Review of xcl-dev#527 (shdann): the heading search could start inside an HTML comment, so a description with the
whole Tested section commented out passed, and a section name in bold at the end of a sentence was taken for
its heading.

Comments are removed from the description before the headings are looked for, and a heading has to be a line
of its own (leading and trailing spaces allowed). Two tests cover both; they fail on the commit before.

Assisted-by: Claude Code (Claude Fable 5.2)
@arcwiser

Copy link
Copy Markdown

Retested after the review fix at exact head 92c9282a3fa85a48fffd80da858240e56a447729; this supersedes my earlier report for 23a208d.

  • python scripts/pr_check.tests.py: 10 passed, 0 failed.
  • .\scripts\test.ps1: workspace build passed; 676 passed, 0 failed, 41 ignored.
  • GPU tests reported 2 skips (both no wave64): gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware. These skips are not counted as coverage.
  • XCL_SAMPLE_* variables were unset, so optional game-data tests did not run.

Machine: Windows 11 Home build 26200; AMD Ryzen 5 7500F; NVIDIA GeForce RTX 4070 SUPER 12 GB, driver 610.88; Rust 1.100.0 MSVC; DXC 1.9.2602.17 from Windows SDK 10.0.28000.0; debug profile.

AI use: OpenAI Codex with GPT-5 selected the verification scope, ran the commands, and drafted this report; I am posting only the measured results above.

@Rareuncommon

Copy link
Copy Markdown
Author

Thanks, both reproduce. Fixed in 92c9282: comments are removed before the headings are looked for, and a heading has to be a line of its own. Two tests cover the two cases (they fail on the commit before). Across the 374 PR descriptions in this repo the check gives the same answer before and after. AI use: Claude Code (Claude Fable 5.2) wrote the fix and this reply.

@Kalmarv

Kalmarv commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

I ran 92c9282's check() and main's (508a0c7) on 33 PR descriptions: 13 open ones and the 20 most recently merged. They give the same result on all 33. On the untouched template it now refuses the bare - under Not tested, which main lets through. Your 10 tests pass, and 6 of them fail against main's pr_check.py. It also merges cleanly with #497, and both test files pass on the merge.

  1. A line under a section that starts with a heading name ends the section, even mid-sentence. start requires the heading on a line of its own; end does not. With this under Tested:

    **Tested**
    **AI use** below covers the test too; 3 passed
    

    the check reports "the Tested section is missing or empty". Giving end the same shape as start fixes it. With the line below, your 10 tests still pass and none of the 33 descriptions change:

    end = r"(?=\n[ \t]*\*\*(?:" + "|".join(HEADINGS) + r")\*\*[ \t]*(?:\n|\Z)|\Z)"
  2. An unclosed <!-- hides the rest of the description on GitHub, but the check still reads it. A Tested section holding only <!-- results to come, with the rest of the description after it, passes (main also passes it). re.sub(r"<!--.*?(?:-->|\Z)", "", body, flags=re.S) refuses it, with no change to the tests or the 33 descriptions.

  3. The banned-model check (line 74) still looks for the first **AI use** anywhere in the raw body. The two cases 92c9282 fixes for filled() therefore still reach it. Each of these passes with - Qwen3-Coder under AI use (the same on main):

    • <!-- see **AI use** at the end --> at the top of the description;
    • "the AI use section is short" written under What is in it.

    In the other direction, <!-- not qwen or llama --> under AI use is refused. Also, a bold line inside the section ends the scan: **also** Qwen3 for the tests passes. Question: is this for this PR or a follow-up? Checking the same comment-stripped section text that filled() reads would cover all four cases.

  4. Question: no workflow runs scripts/pr_check.tests.py, because pr-check.yml checks out only pr_check.py. PR checks: a runtime file whose name only contains "tests" still needs a regression run #497 adds its tests as scripts/pr_check_tests.py, so if both merge there will be two test files with different names. Should they be one file?

🤖 Claude Opus 5.5

Rareuncommon added a commit to Rareuncommon/xcl that referenced this pull request Nov 24, 2026
… hides the rest

Review of xcl-dev#527 (Kalmarv), points 1 and 2:

- The end of a section had no line-of-its-own rule, so a sentence under a section that began with a heading
  name in bold ended it: a filled Tested section was reported empty.
- An unclosed <!-- hides the rest of the description on GitHub but was still read as text. It now takes the
  rest of the description with it.

Two tests cover both; they fail on the commit before.

Assisted-by: Claude Code (Claude Fable 5.2)
@Rareuncommon

Copy link
Copy Markdown
Author

Thanks for running it. 1 and 2 are in dc6fa59 with a test each (12 pass; 7 fail on main's pr_check.py). On 478 descriptions it differs from main on two, #625 and #648, both a bare - under Not tested. 3: agreed, and I'd rather do it as a follow-up so this PR stays one change; I'll open it once this lands, reading the same comment-stripped section text. 4: happy to fold these tests into scripts/pr_check_tests.py if #497 lands first; maintainer's call on the name. AI use: Claude Code (Claude Fable 5.2) wrote the fix and this reply.

@upipibi

upipibi commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Full-suite run on this PR's head dc6fa59, for the counts CONTRIBUTING.md item 2 asks for (the description has the pr_check tests only):

Tested

  • NVIDIA GeForce RTX 3070 (driver 616.56, wave32), Ryzen 9 5950X, Windows 11 Pro 26100, rustc 1.100.0 MSVC, debug
  • cargo build --workspace then cargo test --workspace --no-fail-fast -- --test-threads=4: 676 passed, 0 failed, 41 ignored (16 test binaries, the e2e title included)
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64)

Not tested: AMD / wave64; no retail title (this PR changes only scripts/, so no regression run is needed).

AI-assisted (Claude Code).

@upipibi upipibi mentioned this pull request Nov 24, 2026
aarushkha added a commit to aarushkha/xcl that referenced this pull request Nov 24, 2026
The hint lines under **Tested** and **AI use** in the PR template were
plain text, so a description left as the template passed both section
checks. With xcl-dev#527 a comment is not something written under a heading:
the hints move into comments, each section keeps an empty list item to
fill in, and the template test now expects all three sections refused.

Fixes xcl-dev#965

Co-authored-by: Conrage <65290519+Conrage@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DavidM1911 added a commit to DavidM1911/xcl that referenced this pull request Nov 24, 2026
An unedited pull_request_template.md passed the Tested and AI use checks because the hint lines counted as content (xcl-dev#965). Section checks now ignore HTML comments, blank lines, lone '-' bullets and the template's placeholder hints; test_pr_check.py covers the untouched and filled template. A lone '-' under Not tested is now refused too (the part of xcl-dev#527 this overlaps).
@jmal423

jmal423 commented Nov 24, 2026

Copy link
Copy Markdown

I tested a conflict resolution against main at 47efa2e with this PR at dc6fa59. The untouched template is a useful regression case after #1037: the PR head alone treats the hints under Tested and AI use as filled. Main rejects those hints, but accepts a Tested heading inside an HTML comment. The combined checker passed all 9 tests from main and all 12 section tests from this PR.

The diff below applies to main at 47efa2e. It keeps the PR's heading and comment handling and checks each candidate line against main's template placeholders. Only the Python checker was tested on the combined version. AI use: Codex prepared and tested this resolution.

Suggested resolution for scripts/pr_check.py
--- a/scripts/pr_check.py
+++ b/scripts/pr_check.py
@@ -67,22 +67,20 @@
 
 
 def section_has_content(body, section):
-    """True when `**section**` exists and has at least one non-placeholder line."""
-    next_heading = "|".join(re.escape(h) for h in HEADINGS)
-    m = re.search(
-        r"\*\*" + re.escape(section) + r"\*\*[ \t]*\n(.*?)(?=\n\*\*(?:" + next_heading + r")\*\*|\Z)",
-        body,
-        re.S,
-    )
-    if not m:
-        return False
-    text = re.sub(r"<!--.*?-->", "", m.group(1), flags=re.S)
-    for raw in text.splitlines():
-        line = re.sub(r"^\s*[-*•]+\s*", "", raw).strip()
-        if line and line not in TEMPLATE_PLACEHOLDERS:
-            return True
+    """Whether `body` has a `**section**` heading, on a line of its own, with something written
+    under it before the next heading, which is a line of its own too. Comments are taken out
+    first, so a heading or a result inside one is not there; list markers with nothing after
+    them are not something."""
+    # an unclosed comment hides the rest of the description on GitHub, so it takes it here too
+    body = re.sub(r"<!--.*?(?:-->|\Z)", "", body, flags=re.S)
+    end = r"(?=\n[ \t]*\*\*(?:" + "|".join(HEADINGS) + r")\*\*[ \t]*(?:\n|\Z)|\Z)"
+    start = r"(?:^|\n)[ \t]*\*\*" + section + r"\*\*[ \t]*(?=\n)"
+    for m in re.finditer(start + r"(.*?)" + end, body, re.S):
+        for raw in m.group(1).splitlines():
+            line = re.sub(r"^\s*[-*+•]+\s*", "", raw).strip()
+            if line and line not in TEMPLATE_PLACEHOLDERS:
+                return True
     return False
-
 
 def check(body, head, files, is_main_ancestor, *, test_only=False):
     """The problems (empty: mergeable as far as this check goes). `files`: (path, status, binary,

… removed first

Rebuilt on main after xcl-dev#965 / xcl-dev#1037, which took over the empty-section and template-placeholder part of this
change. What is left:

- A section name in bold at the end of a sentence was taken for the section's heading. When the sentence
  came before the real section, the real one was never read: a filled description was reported empty.
- The heading search could start inside an HTML comment, so a section commented out as a whole passed.
- An unclosed <!-- hides the rest of the description on GitHub but was still read as text.

section_texts() returns what is under each heading (comments removed, heading lines of their own at both
ends); section_has_content() keeps main's placeholder rule over it.

scripts/test_pr_check.py: SectionHeadingTests, seven tests; three fail on main's check.

Assisted-by: Claude Code (Claude Fable 5.2)
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.

7 participants