From 61bb1e8d2cc4e86b2403cc5165e7e0cc69645fba Mon Sep 17 00:00:00 2001 From: Jarry Shaw Date: Thu, 5 Nov 2026 01:52:29 -0500 Subject: [PATCH] fix(util): match the PR template's changelog box in issue_pr_kinds.body #2483 reworded the template's changelog box, so the `Added a` pattern matched nothing and the refresh pull request's box never got its N/A suffix. Find the box by its link instead; a new test feeds the real template through body() and fails without the fix. --- tests/project/test_issue_pr_kinds_2561.py | 8 ++++++++ util/issue_pr_kinds.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/project/test_issue_pr_kinds_2561.py b/tests/project/test_issue_pr_kinds_2561.py index 8fedaf3f8a..37a0414b72 100644 --- a/tests/project/test_issue_pr_kinds_2561.py +++ b/tests/project/test_issue_pr_kinds_2561.py @@ -249,6 +249,14 @@ def test_the_body_fills_in_the_template(self) -> None: self.assertNotIn('Explanation of your *pull request*', text) self.assertIn('[Searched]', text) + def test_the_body_marks_the_templates_changelog_box_not_applicable(self) -> None: + boxes = [line for line in issue_pr_kinds.TEMPLATE.read_text(encoding='utf-8').splitlines() + if line.startswith('- [ ] ') and 'changelog' in line] + self.assertEqual(len(boxes), 1, boxes) + text = issue_pr_kinds.body(TEXT, 'https://run') + self.assertIn(f'{boxes[0]} — N/A — centralised in #657\n', text) + self.assertEqual(text.count('N/A — centralised in #657'), 1) + if __name__ == '__main__': unittest.main() diff --git a/util/issue_pr_kinds.py b/util/issue_pr_kinds.py index 8d8c542567..9a8416b78d 100644 --- a/util/issue_pr_kinds.py +++ b/util/issue_pr_kinds.py @@ -120,7 +120,8 @@ def body(kinds_text: 'str', run_url: 'str') -> 'str': text = re.sub(r'(?m)^- \[ \] `test`', '- [x] `test`', text) text = re.sub(r'(?m)^(- \[ \] `make test` passes.*)$', r"\1 -- not run here; this pull request's checks run it", text) - text = re.sub(r'(?m)^(- \[ \] Added a \[changelog entry\].*)$', r'\1 — N/A — centralised in #657', text) + # The changelog box, found by its link rather than by the wording around it. + text = re.sub(r'(?m)^(- \[ \] .*\[changelog entry\].*)$', r'\1 — N/A — centralised in #657', text) description = (f'Regenerated `{PATH}` from the tracker with `python util/issue_pr_kinds.py`, up to #{newest}, ' 'so `tests/project/test_docs_issue_pr_roles_1103_unit.py` checks every role citing a number ' f'up to it. Opened by the Issue and PR Kinds workflow ({run_url}); a later run force-pushes '