From 4056361fac7402a32575a595992813a5b7d7914d Mon Sep 17 00:00:00 2001 From: microwave805 Date: Wed, 25 Nov 2026 00:25:25 +0200 Subject: [PATCH] PR checks: validate every clean PR xcl-smoke block, not only the last check() inspected only pr = clean[-1], discarding all earlier clean xcl-smoke blocks for the PR's head commit. Pasting a clean smoke run after a crashing, killed, or regressed run caused pr_check.py to report description ok. Iterate over every block in clean so field checks, device removals, crashes, killed exits, and matching main-baseline frame/commit comparisons apply to every PR smoke block (while still requiring at least one matching main baseline). A new regression test with a failing earlier block and clean later block failed before the fix and passes afterward. Assisted-by: Antigravity (Gemini 4 Neon) --- scripts/pr_check.py | 42 ++++++++++++++++++++++------------------ scripts/test_pr_check.py | 24 +++++++++++++++++++++++ 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/scripts/pr_check.py b/scripts/pr_check.py index cb0ef3ef9e..e6cbd4bba9 100644 --- a/scripts/pr_check.py +++ b/scripts/pr_check.py @@ -140,26 +140,30 @@ def check(body, head, files, is_main_ancestor, *, test_only=False): problems.append("**Regression run** needs an `xcl-smoke` block made on a commit of main (not the PR's), " "with the same title and time as the PR's") if clean: - pr = clean[-1] - problems += field_problems(pr, "the PR's") - for key in ("device removals", "crashes"): - if (number(pr.get(key)) or 0) > 0: - problems.append(f"the PR's regression run shows {key}: {pr.get(key)}") - if pr.get("exit", "").startswith("killed"): - problems.append("the PR's regression run did not end by itself (killed)") - 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: + matched_main = [] + for pr in clean: + problems += field_problems(pr, "the PR's") + for key in ("device removals", "crashes"): + if (number(pr.get(key)) or 0) > 0: + problems.append(f"the PR's regression run shows {key}: {pr.get(key)}") + if pr.get("exit", "").startswith("killed"): + problems.append("the PR's regression run did not end by itself (killed)") + if main: + m = next((b for b in main if b.get("title") == pr.get("title") and b.get("seconds") == pr.get("seconds")), None) + if m is not None: + if m not in matched_main: + matched_main.append(m) + problems += field_problems(m, "the main") + pf, mf = number(pr.get("frames shown")), number(m.get("frames shown")) + if mf and (pf is None or pf < FRAMES_KEPT * mf): + problems.append(f"the PR's run shows fewer frames than main's ({pf} against {mf})") + pc, mc = number(pr.get("peak commit")), number(m.get("peak commit")) + if pc and mc and pc > COMMIT_GROWTH * mc: + problems.append(f"the PR's run commits much more memory than main's ({pc} MB against {mc} MB)") + if main and not matched_main: + for b in main: problems += field_problems(b, "the main") - if m is None: - problems.append("the main and PR regression runs are not of the same title for the same time") - else: - pf, mf = number(pr.get("frames shown")), number(m.get("frames shown")) - if mf and (pf is None or pf < FRAMES_KEPT * mf): - problems.append(f"the PR's run shows fewer frames than main's ({pf} against {mf})") - pc, mc = number(pr.get("peak commit")), number(m.get("peak commit")) - if pc and mc and pc > COMMIT_GROWTH * mc: - problems.append(f"the PR's run commits much more memory than main's ({pc} MB against {mc} MB)") + problems.append("the main and PR regression runs are not of the same title for the same time") return problems diff --git a/scripts/test_pr_check.py b/scripts/test_pr_check.py index 8cc45d5d06..78fd1fcc4b 100644 --- a/scripts/test_pr_check.py +++ b/scripts/test_pr_check.py @@ -136,5 +136,29 @@ def test_bare_bullets_and_html_comments_only_fail(self): self.assertEqual(3, len(problems)) +class MultiSmokeBlockTests(unittest.TestCase): + def test_earlier_pr_smoke_block_failures_are_not_hidden_by_a_later_clean_block(self): + files = [changed("crates/xcl/src/hle/d3d12x/vram.rs")] + main_a = "```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: A\nseconds: 60\nframes shown: 500\npeak commit: 1000 MB\ndevice removals: 0\ncrashes: 0\n```\n" + bad_pr_a = "```\nxcl-smoke v1\ncommit: 1234567890\ntitle: A\nseconds: 60\nexit: killed (no exit)\nframes shown: 10\npeak commit: 9999 MB\ndevice removals: 2\ncrashes: 1\n```\n" + main_b = "```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: B\nseconds: 60\nframes shown: 100\npeak commit: 1000 MB\ndevice removals: 0\ncrashes: 0\n```\n" + good_pr_b = "```\nxcl-smoke v1\ncommit: 1234567890\ntitle: B\nseconds: 60\nexit: 0x0\nframes shown: 100\npeak commit: 1000 MB\ndevice removals: 0\ncrashes: 0\n```\n" + problems = check(BODY + main_a + bad_pr_a + main_b + good_pr_b, HEAD, files, lambda sha: sha == "1111111aaaa") + for expected in ("device removals: 2", "crashes: 1", "killed", "fewer frames", "more memory"): + self.assertTrue(any(expected in p for p in problems), (expected, problems)) + + def test_multiple_clean_pr_blocks_all_pass(self): + files = [changed("crates/xcl/src/hle/d3d12x/vram.rs")] + run = "seconds: 60\nexit: 0x0\nframes shown: 100\npeak commit: 1000 MB\ndevice removals: 0\ncrashes: 0\n" + body = ( + f"{BODY}" + f"```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: A\n{run}```\n" + f"```\nxcl-smoke v1\ncommit: 1234567890\ntitle: A\n{run}```\n" + f"```\nxcl-smoke v1\ncommit: 1111111aaaa\ntitle: B\n{run}```\n" + f"```\nxcl-smoke v1\ncommit: 1234567890\ntitle: B\n{run}```\n" + ) + self.assertEqual([], check(body, HEAD, files, lambda sha: sha == "1111111aaaa")) + + if __name__ == "__main__": unittest.main()