Scripts: pr_check accepts markdown headings and any case for the sections #1635

Open
Diskuss wants to merge 2 commits from upstream-pr/1645 into main
Diskuss commented 2026-11-24 18:39:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Diskuss on 2026-11-24T18:39:15Z.


scripts/pr_check.py found a required section only as the template's bold **Tested**, case-sensitively. Descriptions that use markdown headings (## Tested, ## Not Tested, ## AI Use) were refused with "the Tested section is missing or empty" though the sections were there and filled, e.g. #1633, #1634, #1635. A section heading is now **Name** as before, or a markdown heading on a line of its own, with the name in any case.

What is in it

  • scripts/pr_check.py: heading() matches **Name** or #..###### Name (the name may be in bold), case-insensitive. section_has_content() uses it for the section's start and for the next heading that ends it; the AI use text read by the banned-model check starts at the same heading and runs to the next section of the template, so a model named under ## AI use or below a sub-heading of it (### Tools) is still refused. mask_fences(): a heading inside a ``` or ~~~ code fence is no heading (a fence still counts as the text of the section it sits in). Empty sections and template placeholders still fail. +37 -10.
  • scripts/test_pr_check.py: HeadingFormTests, 8 tests: markdown headings and other cases pass, empty markdown sections fail, a markdown heading ends the section before it, ## Tested things is not a heading, a banned model under ## AI Use or under ### Tools in AI use is refused, headings inside a code fence are not sections, a fence inside a section is its text. +56. The ### Tools and fence cases are RobertAndreiGit's (comment below).
  • Not in it: a section heading directly followed by the next heading with no blank line between them still reads the next heading as the section's text, as on main (#527 handles where a section ends).

Tested

  • Windows 11, Python 3.12.0, and WSL Python 3: cd scripts && python -B -m unittest test_pr_check: 21 passed (main's 13 and the 8 new). Main's pr_check.py passes its own 13; with the new tests it gives 8 failures, the previous head 2068275 gives 5 (the ### Tools and fence cases; subtests counted separately).
  • check() of main and of this branch on the descriptions of the last 1,000 PRs of this repository (all states, a README-only file list, fetched 2026-11-25): 52 get fewer problems, none gets a problem main does not report. The previous head 2068275 gives the same result on all 1,000.
  • This description passes py scripts/pr_check.py --body <this> --head <head> --files <files.tsv> --local on this branch.

Regression run

  • n/a: scripts-only, no runtime change.

Not tested

  • The Rust workspace was not built or tested: this PR changes no Rust.
  • The PR checks workflow on GitHub's runner (it runs main's copy of the checker, so this PR's own check uses the old rules).

AI use

  • Claude Code (Claude Opus 5.5): code, tests and description; reviewed by Diskuss.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5478156786 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1645). Originally posted by [Diskuss](https://github.com/Diskuss) on 2026-11-24T18:39:15Z. --- `scripts/pr_check.py` found a required section only as the template's bold `**Tested**`, case-sensitively. Descriptions that use markdown headings (`## Tested`, `## Not Tested`, `## AI Use`) were refused with "the **Tested** section is missing or empty" though the sections were there and filled, e.g. #1633, #1634, #1635. A section heading is now `**Name**` as before, or a markdown heading on a line of its own, with the name in any case. **What is in it** - `scripts/pr_check.py`: `heading()` matches `**Name**` or `#`..`######` `Name` (the name may be in bold), case-insensitive. `section_has_content()` uses it for the section's start and for the next heading that ends it; the **AI use** text read by the banned-model check starts at the same heading and runs to the next section of the template, so a model named under `## AI use` or below a sub-heading of it (`### Tools`) is still refused. `mask_fences()`: a heading inside a ``` or ~~~ code fence is no heading (a fence still counts as the text of the section it sits in). Empty sections and template placeholders still fail. +37 -10. - `scripts/test_pr_check.py`: `HeadingFormTests`, 8 tests: markdown headings and other cases pass, empty markdown sections fail, a markdown heading ends the section before it, `## Tested things` is not a heading, a banned model under `## AI Use` or under `### Tools` in **AI use** is refused, headings inside a code fence are not sections, a fence inside a section is its text. +56. The `### Tools` and fence cases are RobertAndreiGit's (comment below). - Not in it: a section heading directly followed by the next heading with no blank line between them still reads the next heading as the section's text, as on main (#527 handles where a section ends). **Tested** - Windows 11, Python 3.12.0, and WSL Python 3: `cd scripts && python -B -m unittest test_pr_check`: 21 passed (main's 13 and the 8 new). Main's `pr_check.py` passes its own 13; with the new tests it gives 8 failures, the previous head 2068275 gives 5 (the `### Tools` and fence cases; subtests counted separately). - `check()` of main and of this branch on the descriptions of the last 1,000 PRs of this repository (all states, a README-only file list, fetched 2026-11-25): 52 get fewer problems, none gets a problem main does not report. The previous head 2068275 gives the same result on all 1,000. - This description passes `py scripts/pr_check.py --body <this> --head <head> --files <files.tsv> --local` on this branch. **Regression run** - n/a: scripts-only, no runtime change. **Not tested** - The Rust workspace was not built or tested: this PR changes no Rust. - The `PR checks` workflow on GitHub's runner (it runs main's copy of the checker, so this PR's own check uses the old rules). **AI use** - Claude Code (Claude Opus 5.5): code, tests and description; reviewed by Diskuss. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
RobertAndreiGit commented 2026-11-24 21:08:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RobertAndreiGit on 2026-11-24T19:11:21Z.


Tested on Apple Silicon (arm64 macOS), Python 3.14.7. cd scripts && python3 -B -m unittest test_pr_check: 13/13 passed on base c160d86ef2efe3a07e4dfb473e4fa72eafb413c0; 18/18 passed on head 2068275e7affa79096d78eacd1c1fa47dbb1b7c6. No skips on either.

In direct check() comparisons, filled mixed-case ATX headings worked on head. Two other inputs changed from rejected on base to accepted on head:

Input Base Head
Otherwise filled template ending with **AI use**, ### Tools, then Qwen on separate lines Flagged the model name No problem reported
A fenced Markdown example containing all three filled ATX sections, with no sections outside the fence Reported three missing sections No problem reported

Not tested: Windows runtime, GPU, or the hosted workflow. These results are for the Python checker only.

AI use: OpenCode (GPT-6.2 Astra) ran the comparisons and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7141729156 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1645#issuecomment-7141729156). Originally posted by [RobertAndreiGit](https://github.com/RobertAndreiGit) on 2026-11-24T19:11:21Z. --- **Tested** on Apple Silicon (arm64 macOS), Python 3.14.7. `cd scripts && python3 -B -m unittest test_pr_check`: 13/13 passed on base `c160d86ef2efe3a07e4dfb473e4fa72eafb413c0`; 18/18 passed on head `2068275e7affa79096d78eacd1c1fa47dbb1b7c6`. No skips on either. In direct `check()` comparisons, filled mixed-case ATX headings worked on head. Two other inputs changed from rejected on base to accepted on head: | Input | Base | Head | | --- | --- | --- | | Otherwise filled template ending with `**AI use**`, `### Tools`, then `Qwen` on separate lines | Flagged the model name | No problem reported | | A fenced Markdown example containing all three filled ATX sections, with no sections outside the fence | Reported three missing sections | No problem reported | **Not tested:** Windows runtime, GPU, or the hosted workflow. These results are for the Python checker only. **AI use:** OpenCode (GPT-6.2 Astra) ran the comparisons and wrote this report.
DavidM1911 commented 2026-11-24 21:09:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:06:52Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7144494103 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1645#issuecomment-7144494103). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T21:06:52Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Diskuss commented 2026-11-25 08:08:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Diskuss on 2026-11-25T07:57:24Z.


Thanks @RobertAndreiGit, both were real regressions. Fixed in e0682e1: the AI use text now runs to the next template section (a ### Tools sub-heading no longer hides a model), and headings inside ``` / ~~~ fences are ignored (a fence still counts as section text). Both of your inputs are regression tests now; python -B -m unittest test_pr_check: 21 passed (main's 13 + 8). On the last 1,000 PR descriptions the branch reports no problem main does not.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7156440946 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1645#issuecomment-7156440946). Originally posted by [Diskuss](https://github.com/Diskuss) on 2026-11-25T07:57:24Z. --- Thanks @RobertAndreiGit, both were real regressions. Fixed in e0682e1: the **AI use** text now runs to the next template section (a `### Tools` sub-heading no longer hides a model), and headings inside ``` / ~~~ fences are ignored (a fence still counts as section text). Both of your inputs are regression tests now; `python -B -m unittest test_pr_check`: 21 passed (main's 13 + 8). On the last 1,000 PR descriptions the branch reports no problem main does not. AI use: Claude Code (Claude Opus 5.5).
RavenCurseBurg commented 2026-11-26 02:08:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-26T01:38:48Z.


Tested the --body file entry point at e0682e179b8f42a200bee31b374550eb09728355 and a candidate fix. A complete PR description beginning with ## Tested was reported as missing that section when written by Windows PowerShell 5.1.26100.9711 with Set-Content -Encoding UTF8. PowerShell 7.6.9 wrote the same text without the BOM and the head accepted it.

I checked the first bytes, CRLF line endings and non-ASCII content, then ran python -B scripts/pr_check.py --local --body body.md --head <sha> --files files.tsv against both writers’ files. The candidate accepted all four complete descriptions (Markdown and bold first headings from each writer) and rejected both controls with an empty final Tested section. The candidate also keeps the content check bounded by the next section heading.

python -B -m unittest discover -s scripts -p "test_pr_check.py" on the candidate: 22 passed, 0 failed or skipped. Windows build 26100, i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) prepared the patch, wrote the fixtures and ran the tests. GitHub Actions and the full Rust/GPU suite were not run.

Follow-up on the indentation feedback. I tested three heading forms at eight line prefixes. Candidate d4b2e2a3da5f recognized each form at zero through three leading spaces and kept indented code, quotes and inline examples out of the section list. The commit includes the earlier UTF-8 body and adjacent-section changes on the same PR head (e0682e179b8f). python -B -m unittest discover -s scripts -p "test_*.py" passed all 26 tests, including the UTF-8 and UTF-8-with-BOM CLI fixtures. Windows build 26100, Core i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) wrote and ran the synthetic tests. Codex prepared the updated patch. No GitHub Actions or Rust/GPU suite run.

<!-- greyfinch-sync:ivall/xcl:comment:7179981911 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1645#issuecomment-7179981911). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-26T01:38:48Z. --- Tested the `--body` file entry point at `e0682e179b8f42a200bee31b374550eb09728355` and [a candidate fix](https://github.com/RavenCurseBurg/xcl/commit/0a47a2d1e77d727a4e65dc9cb6f863cee4fa75b9). A complete PR description beginning with `## Tested` was reported as missing that section when written by Windows PowerShell 5.1.26100.9711 with `Set-Content -Encoding UTF8`. PowerShell 7.6.9 wrote the same text without the BOM and the head accepted it. I checked the first bytes, CRLF line endings and non-ASCII content, then ran `python -B scripts/pr_check.py --local --body body.md --head <sha> --files files.tsv` against both writers’ files. The candidate accepted all four complete descriptions (Markdown and bold first headings from each writer) and rejected both controls with an empty final Tested section. The candidate also keeps the content check bounded by the next section heading. `python -B -m unittest discover -s scripts -p "test_pr_check.py"` on the candidate: 22 passed, 0 failed or skipped. Windows build 26100, i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) prepared the patch, wrote the fixtures and ran the tests. GitHub Actions and the full Rust/GPU suite were not run. Follow-up on [the indentation feedback](https://github.com/xcl-dev/xcl/pull/1645#pullrequestreview-6071523168). I tested three heading forms at eight line prefixes. Candidate [d4b2e2a3da5f](https://github.com/RavenCurseBurg/xcl/commit/d4b2e2a3da5faa9807d6a743412e34c89bbf246c) recognized each form at zero through three leading spaces and kept indented code, quotes and inline examples out of the section list. The commit includes the earlier UTF-8 body and adjacent-section changes on the same PR head (`e0682e179b8f`). `python -B -m unittest discover -s scripts -p "test_*.py"` passed all 26 tests, including the UTF-8 and UTF-8-with-BOM CLI fixtures. Windows build 26100, Core i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) wrote and ran the synthetic tests. Codex prepared the updated patch. No GitHub Actions or Rust/GPU suite run.
DavidM1911 commented 2026-11-26 06:06:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T05:58:10Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7183969469 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1645#issuecomment-7183969469). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T05:58:10Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
luckyteagirl commented 2026-11-26 09:26:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:26:24Z.

Review: COMMENTED


On e0682e1, mask_fences recognizes an opening fence only with 0–3 absolute leading spaces, while heading() accepts any indentation. A normal fenced example nested under a top-level list item has four spaces before its fence and contents. With a body containing only - Example only: and a four-space-indented ```markdown block that contains ## Tested, ## Not tested, and ## AI use with sample text, the fence is never masked and those example headings satisfy all three required sections. The base/current-main checker reports all three missing for the same body. This reopens the quoted-template acceptance case the follow-up commit intended to close.

Could the checker recognize fences relative to their containing list item, or require the actual template headings at top level? A nested-fence fixture with all three headings would cover it while retaining the current top-level fence tests. This is an exact-head source and in-memory Python differential; I did not run the hosted PR-check workflow.

<!-- greyfinch-sync:ivall/xcl:review:6071523168 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1645#pullrequestreview-6071523168). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T09:26:24Z. **Review:** COMMENTED --- On `e0682e1`, `mask_fences` recognizes an opening fence only with 0–3 **absolute** leading spaces, while `heading()` accepts any indentation. A normal fenced example nested under a top-level list item has four spaces before its fence and contents. With a body containing only `- Example only:` and a four-space-indented `` ```markdown `` block that contains `## Tested`, `## Not tested`, and `## AI use` with sample text, the fence is never masked and those example headings satisfy all three required sections. The base/current-main checker reports all three missing for the same body. This reopens the quoted-template acceptance case the follow-up commit intended to close. Could the checker recognize fences relative to their containing list item, or require the actual template headings at top level? A nested-fence fixture with all three headings would cover it while retaining the current top-level fence tests. This is an exact-head source and in-memory Python differential; I did not run the hosted PR-check workflow.
github-actions[bot] commented 2026-12-01 02:33:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:33:43Z.


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:7298748936 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1645#issuecomment-7298748936). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:33:43Z. --- 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 06:22:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:22:54Z.


Triage (#1607) – head e0682e1

No open or merged PR makes pr_check accept markdown headings or any case for the section names. #835 and #2715 also rewrite section_has_content and the AI use search in scripts/pr_check.py (comment handling, fenced code), so whichever lands second will need a rebase, but neither accepts ## Tested style headings.
No problems found in the diff; the new tests cover fences, sub-headings under AI use and headings inside sentences.
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:7302806331 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1645#issuecomment-7302806331). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:22:54Z. --- **Triage (#1607)** – head e0682e1 No open or merged PR makes pr_check accept markdown headings or any case for the section names. #835 and #2715 also rewrite `section_has_content` and the **AI use** search in `scripts/pr_check.py` (comment handling, fenced code), so whichever lands second will need a rebase, but neither accepts `## Tested` style headings. No problems found in the diff; the new tests cover fences, sub-headings under AI use and headings inside sentences. 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/1645:upstream-pr/1645'
git switch 'upstream-pr/1645'

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/1645'
git switch 'upstream-pr/1645'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1645'
git switch 'upstream-pr/1645'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1645'
git switch 'main'
git merge --squash 'upstream-pr/1645'
git switch 'main'
git merge --ff-only 'upstream-pr/1645'
git switch 'main'
git merge 'upstream-pr/1645'
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!1635
No description provided.