Repository navigation
PR checks: a section with nothing under it is refused as empty - #527
Rareuncommon wants to merge 1 commit into
Conversation
shdann
left a comment
There was a problem hiding this comment.
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).
|
Tested exact head
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. |
…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)
|
Retested after the review fix at exact head
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. |
|
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. |
|
I ran 92c9282's
🤖 Claude Opus 5.5 |
… 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)
|
Thanks for running it. 1 and 2 are in dc6fa59 with a test each (12 pass; 7 fail on main's |
|
Full-suite run on this PR's head Tested
Not tested: AMD / wave64; no retail title (this PR changes only AI-assisted (Claude Code). |
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>
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).
|
I tested a conflict resolution against main at The diff below applies to main at 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)
dc6fa59 to
5bdaffa
Compare
Rebuilt on main
930e8b4after #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 separatescripts/pr_check.tests.pyof the earlier commits is gone; the tests are in main's file.5bdaffa) replacesdc6fa59and the two before it. The review points of @shdann and @Kalmarv (1 and 2) are in it.Tested
cd scripts && python3 -m unittest test_pr_check: 16 passed (main's 9 and the 7 new). Against main'spr_check.py: 3 of the 7 new fail (a heading at the end of a sentence, a section inside a comment, an unclosed comment).check()compared on the descriptions of 1,029 PRs of this repository (all states): two differences, Recompiler: v_med3_f32 / _f16 with a NaN operand give the min of the others (#678) #686 and PR checks: the template's hints are comments, so an untouched one fails #991. Both name Not tested in a sentence before their real section; main reads the sentence, finds nothing under it and reports the section empty, this PR reads the real section.930e8b4: 25 tests pass.Regression run
Not tested
23a208danddc6fa59, not on5bdaffa; this PR changes no Rust.PR checksworkflow on GitHub's runner.AI use