From c08ce4e33445a64e3edbb8433ae9bc1a2d2ce862 Mon Sep 17 00:00:00 2001 From: DarkPanda69 Date: Tue, 24 Nov 2026 21:05:01 +0100 Subject: [PATCH] PR checks: accept main's smoke run that crashed before its end (#1506) Since 1d83fd1 (#1133) field_problems also checks main's smoke block, and smoke.ps1 writes "none logged (the run did not reach its end)" as `frames shown` when the run crashes. A PR that fixes a crash shows that crash on main (CONTRIBUTING.md allows it), so it was refused for a non-numeric `frames shown`. That text is now accepted for main's block only; the PR's own block keeps the check. Co-Authored-By: Claude Opus 5.5 --- scripts/pr_check.py | 13 +++++++++---- scripts/test_pr_check.py | 13 +++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/scripts/pr_check.py b/scripts/pr_check.py index cb0ef3ef9e..997383bad1 100644 --- a/scripts/pr_check.py +++ b/scripts/pr_check.py @@ -37,6 +37,8 @@ # counts are checked where they are used), and those of them that are numbers SMOKE_FIELDS = ("title", "seconds", "frames shown") SMOKE_NUMBERS = ("seconds", "frames shown") +# what smoke.ps1 writes as `frames shown` when the run did not reach its end (a crash) +FRAMES_UNENDED = "none logged" def smoke_blocks(body): @@ -58,13 +60,16 @@ def number(s): return int(m.group(1)) if m else None -def field_problems(block, run): +def field_problems(block, run, *, may_crash=False): """What `block` (the smoke block of `run`) lacks for the comparison: a missing line or a - number that is not one.""" + number that is not one. `may_crash`: main's run, which may not have reached its end + (CONTRIBUTING.md: a PR that fixes a crash shows it there), so smoke.ps1's text for that + is accepted as its `frames shown`.""" name = f"{run} regression run (`xcl-smoke` block of commit {(block.get('commit') or '?').split()[0]})" out = [f"{name} has no `{k}` line" for k in SMOKE_FIELDS if not block.get(k)] out += [f"{name} has a non-numeric `{k}`: {block[k]}" for k in SMOKE_NUMBERS - if block.get(k) and number(block[k]) is None] + if block.get(k) and number(block[k]) is None + and not (may_crash and k == "frames shown" and block[k].startswith(FRAMES_UNENDED))] return out @@ -150,7 +155,7 @@ def check(body, head, files, is_main_ancestor, *, test_only=False): if main: m = next((b for b in main if b.get("title") == pr.get("title") and b.get("seconds") == pr.get("seconds")), None) for b in [m] if m else main: - problems += field_problems(b, "the main") + problems += field_problems(b, "the main", may_crash=True) if m is None: problems.append("the main and PR regression runs are not of the same title for the same time") else: diff --git a/scripts/test_pr_check.py b/scripts/test_pr_check.py index 8cc45d5d06..cde0b37c14 100644 --- a/scripts/test_pr_check.py +++ b/scripts/test_pr_check.py @@ -102,6 +102,19 @@ def test_non_numeric_frames_shown_fails(self): self.assertIn("the PR's regression run (`xcl-smoke` block of commit 1234567890) " "has a non-numeric `frames shown`: many", problems) + def test_main_run_that_crashed_before_its_end_passes(self): + # smoke.ps1's text when the run did not reach its end; a crash-fix PR shows it on main + unended = "frames shown: none logged (the run did not reach its end)\n" + main_run = "title: G\nseconds: 60\ndevice removals: 0\ncrashes: 1\nexit: 0xc0000005\n" + unended + pr_run = "title: G\nseconds: 60\nframes shown: 100\ndevice removals: 0\ncrashes: 0\n" + self.assertEqual([], self.smoke_problems(main_run, pr_run)) + + def test_pr_run_that_did_not_reach_its_end_still_fails(self): + run = "title: G\nseconds: 60\ndevice removals: 0\ncrashes: 0\n" + unended = "frames shown: none logged (the run did not reach its end)\n" + problems = self.smoke_problems(run + "frames shown: 100\n", run + unended) + self.assertTrue(any(p.startswith("the PR's") and "non-numeric `frames shown`" in p for p in problems), problems) + class TemplatePlaceholderTests(unittest.TestCase): def test_untouched_pr_template_fails_all_required_sections(self):