Skip to content

Scripts: count merge checks that start with a byte-order mark - #3542

Closed
throny wants to merge 1 commit into
xcl-dev:mainfrom
throny:triage-bom
Closed

throny wants to merge 1 commit into
xcl-dev:mainfrom
throny:triage-bom

Conversation

@throny

@throny throny commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

scripts/triage_pr.py ignored a #3041 merge-check comment whose body started with a byte-order mark (U+FEFF) or its cp437 mojibake, because the first line was compared with exactly merge-check. On #1230 two accounts had posted "safe to merge" checks, one of them with a BOM, and the PR kept needs-2nd-check and needs:amd-test.

What is in it

  • scripts/triage_pr.py: parse_merge_checks() strips leading BOM characters, the mojibake sequence and surrounding whitespace from the body before comparing the first line (new BOM_PREFIX_RE); one docstring line adjusted.
  • scripts/test_triage_pr.py: TestMergeCheckParsing.test_check_starting_with_byte_order_mark_counts (a check starting with BOM + mojibake and one starting with BOM only both count as safe).

Tested

  • Windows 11 (build 26300), Python 3.13.17
  • python -I -m unittest discover -s scripts -p test_triage_pr.py: 11 tests, OK
  • Same command with the triage_pr.py change stashed: 11 tests, 1 failure (0 != 2), so the test fails without the fix

Regression run

  • Not a runtime change (scripts/ only), no smoke run needed.

Not tested

  • The auto-triage workflow run itself on GitHub.

AI use

  • Claude Code (Claude Sonnet 5.5) wrote the fix and the test; reviewed by Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

parse_merge_checks() compared the first line with exactly "merge-check", so a
xcl-dev#3041 check whose body began with U+FEFF (or its cp437 mojibake) was ignored.
On xcl-dev#1230 two accounts had posted "safe to merge" checks, one of them with a
BOM, and the PR kept needs-2nd-check and needs:amd-test.

Strip leading BOM characters and their mojibake, with surrounding whitespace,
before the comparison. The test fails without the change (0 != 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added area:docs-ci Documentation, scripts, workflows, repo governance area:tests Unit, integration, e2e tests, or testtitle labels Nov 30, 2026
@throny
throny marked this pull request as draft November 30, 2026 19:08
@throny

throny commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

Draft for now: every merge check this would start counting (14 open PRs: #316, #638, #655, #699, #703, #738, #739, #974, #982, #1555, #1571, #1776, #1823, #2293, plus the merged #1230) comes from one account whose checks name DeepSeek as the model, which CONTRIBUTING.md does not accept for contributions. Counting them would label those 14 ready-to-merge on one valid check. Whether such checks count is the maintainer's call; until then the bot ignoring them is the safer outcome.

AI use: Claude Code (Claude Opus 5.5) checked the affected PRs and wrote this.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review (head c18e612, diff read, not a merge-check; draft, so not built or run):

  • A BOM-prefixed check still doesn't relabel the PR when it is posted. .github/workflows/auto-triage.yml:23 (and testing-feed.yml:41) only run on a comment when startsWith(github.event.comment.body, 'merge-check'), which a body starting with U+FEFF fails. So needs-2nd-check / needs:amd-test stay until the next push or edit of the PR. queue.json is fine, since its scheduled rebuild reads every comment. Either relax the workflow filters too (e.g. contains(..., 'merge-check') with the script as the real check), or list it under Not tested.
  • Minor: only the cp437 reading of the BOM (∩╗┐) is stripped, not the cp1252 one (). The Recompiler: align S_LOAD address components before addition #1230 comments only use the cp437 one, so this is a possible gap, not a bug.

Fine: the stripping only touches the start of the body, head: / verdict: parsing is unchanged, and the new test fails without the fix (0 instead of 2 counted checks). It matches how #3041 already counts these comments.

AI review: Claude Code (Claude Opus 5.5), posted for @Foniass without a human check of each point.

@throny

throny commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

@Foniass thanks, both points are right: the workflow filters (auto-triage.yml, testing-feed.yml) only fire on a body that starts with merge-check, so a BOM-prefixed check would still need another event to relabel, and the cp1252 form () is not stripped. I'll add both if this goes ahead. It is a draft for the reason in my comment above: the checks it would start counting today are all from one account that names DeepSeek as its model, which CONTRIBUTING.md does not accept, so whether such checks count is the maintainer's call first.

AI use: Claude Code (Claude Opus 5.5).

@throny

throny commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: the only checks this would start counting are ones written with a model CONTRIBUTING.md does not accept, so the bot ignoring them is the better outcome for now. @Foniass's two points (workflow filters, cp1252 form) are noted here if it is needed later.

AI use: Claude Code (Claude Opus 5.5).

@throny throny closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs-ci Documentation, scripts, workflows, repo governance area:tests Unit, integration, e2e tests, or testtitle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants