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

Closed
throny wants to merge 1 commit from upstream-pr/3542 into main
throny commented 2026-11-30 19:04:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-30T19:04:35Z.


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

<!-- greyfinch-sync:ivall/xcl:issue:5571865353 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3542). Originally posted by [throny](https://github.com/throny) on 2026-11-30T19:04:35Z. --- `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](https://claude.com/claude-code)
throny commented 2026-11-30 19:08:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-30T19:08:48Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7288914122 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3542#issuecomment-7288914122). Originally posted by [throny](https://github.com/throny) on 2026-11-30T19:08:48Z. --- 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 commented 2026-12-01 02:54:54 +00:00 (Migrated from github.com)

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


Review (head c18e612d, 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 #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.

<!-- greyfinch-sync:ivall/xcl:comment:7299125359 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3542#issuecomment-7299125359). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T02:54:54Z. --- Review (head c18e612d, 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 #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 commented 2026-12-01 04:13:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T04:13:22Z.


@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).

<!-- greyfinch-sync:ivall/xcl:comment:7300505649 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3542#issuecomment-7300505649). Originally posted by [throny](https://github.com/throny) on 2026-12-01T04:13:22Z. --- @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 commented 2026-12-01 06:47:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T06:47:08Z.


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).

<!-- greyfinch-sync:ivall/xcl:comment:7303270571 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3542#issuecomment-7303270571). Originally posted by [throny](https://github.com/throny) on 2026-12-01T06:47:08Z. --- 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).

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