PR checks: a smoke block can omit the crash, device-removal, exit and peak-commit lines and still pass #2213

Open
opened 2026-11-26 05:23:27 +00:00 by github-bot · 2 comments
Owner

@⁠itsonewi on GitHub · 2026-11-25 10:01 UTC · original

scripts/pr_check.py only requires three lines in an xcl-smoke block: title, seconds and frames shown (SMOKE_FIELDS, line 38). The four lines that carry the safety part of the regression run - device removals, crashes, exit and peak commit - are read with dict.get() and a missing value is treated as clean:

  • device removals / crashes - (number(pr.get(key)) or 0) > 0 (lines 145-147). A missing line gives None or 0 = 0, and a non-numeric value (none, n/a, ?) also gives None or 0 = 0. Only a number greater than zero is a problem.
  • exit - pr.get("exit", "").startswith("killed") (line 148). A missing line gives "", and any other value passes: 0xc0000005, error, even killed later (only the prefix counts).
  • peak commit - pc, mc = number(...), number(...) (line 160). If either side is missing or n/a, the 125% check is skipped entirely (line 161).

CONTRIBUTING.md, item 3, requires the PR's run to "show no device removal and no crash ... and at most 125 % of its peak commit" (lines 24-26). The gate cannot enforce any of that when the line is absent.

This is the same class of bug as #1133 (merged), which added title, seconds and frames shown after blocks with only a commit line passed. It stopped at those three; the counters and the exit code were left as "checked where they are used", but where they are used they are optional.

Why it matters

scripts/smoke.ps1 always prints all of these lines (lines 94-99), so a block that lacks one was edited by hand, truncated by a copy/paste, or produced by a modified script. Deleting one line turns a failing run into a passing one:

  • crashes: 1 -> delete the line -> pass
  • device removals: 1 -> delete the line -> pass
  • exit: killed (no exit) -> delete the line -> pass
  • peak commit: 9000 MB on main's 3000 MB -> delete the line (or leave smoke.ps1's own peak commit: n/a MB) -> pass
  • exit: 0xc0000005 -> already passes, even with every line present

The last one matters on its own: a title can log frames, then die with 0xc0000005; smoke.ps1 reports exit: 0xc0000005, crashes: 0 (its regex did not match a log line), and pr_check.py accepts it. A non-zero exit that is not killed is never treated as a crash.

Repro (by inspection, not run here)

With a runtime file in files.tsv and a complete main block, this PR block passes with zero problems:

xcl-smoke v1
commit: <head sha>
title: <same title as main>
seconds: 60
frames shown: 900 (PresentX 900)

field_problems() sees all three required lines; device removals, crashes and exit are missing, so lines 145-148 see 0/0/""; peak commit is missing on the PR side, so lines 160-162 skip the memory check. The expected result is three or four problems, one per missing line.

I did not run it: this audit was done through the GitHub API at 568e7db without cloning the repository. The code path is small enough to follow directly.

Suggested fix

  • Add device removals, crashes, exit and peak commit to the PR block's required lines (a separate tuple, since peak commit is <n> MB and exit is not a count).
  • Parse the counters strictly: a value that is not a decimal number is a problem, not zero. Same for peak commit (n/a means the run never logged memory - that should be reported, not skipped).
  • Require exit: 0x0 for the PR's block; keep killed (no exit) as its own message, and treat any other non-zero exit as a failure or at least print it in the check output.
  • Add fixtures to scripts/test_pr_check.py: a block with each line removed, a block with crashes: none, and a block with exit: 0xc0000005.

Related

  • #1133 (merged): the same bug for title / seconds / frames shown.
  • #1884 (open): validates every xcl-smoke block instead of only the last; it moves this code but does not make the fields required (its diff keeps for key in ("device removals", "crashes") and pr.get("exit", "")).
  • #1506 / #1750 (open): the main block may itself have crashed before its end - a different case, about main's side.
  • #717 (open): the block cannot tell a black screen from a working title.

Scope

Found by reading the repository through the GitHub API at 568e7db; nothing was cloned, built or run.

**@⁠itsonewi** on GitHub · 2026-11-25 10:01 UTC · [original](https://github.com/xcl-dev/xcl/issues/2213) `scripts/pr_check.py` only requires three lines in an `xcl-smoke` block: `title`, `seconds` and `frames shown` (`SMOKE_FIELDS`, line 38). The four lines that carry the safety part of the regression run - `device removals`, `crashes`, `exit` and `peak commit` - are read with `dict.get()` and a missing value is treated as clean: - **`device removals` / `crashes`** - `(number(pr.get(key)) or 0) > 0` (lines 145-147). A missing line gives `None or 0` = 0, and a non-numeric value (`none`, `n/a`, `?`) also gives `None or 0` = 0. Only a number greater than zero is a problem. - **`exit`** - `pr.get("exit", "").startswith("killed")` (line 148). A missing line gives `""`, and any other value passes: `0xc0000005`, `error`, even `killed later` (only the prefix counts). - **`peak commit`** - `pc, mc = number(...), number(...)` (line 160). If either side is missing or `n/a`, the 125% check is skipped entirely (line 161). `CONTRIBUTING.md`, item 3, requires the PR's run to "show no device removal and no crash ... and at most 125 % of its peak commit" (lines 24-26). The gate cannot enforce any of that when the line is absent. This is the same class of bug as #1133 (merged), which added `title`, `seconds` and `frames shown` after blocks with only a `commit` line passed. It stopped at those three; the counters and the exit code were left as "checked where they are used", but where they are used they are optional. **Why it matters** `scripts/smoke.ps1` always prints all of these lines (lines 94-99), so a block that lacks one was edited by hand, truncated by a copy/paste, or produced by a modified script. Deleting one line turns a failing run into a passing one: - `crashes: 1` -> delete the line -> pass - `device removals: 1` -> delete the line -> pass - `exit: killed (no exit)` -> delete the line -> pass - `peak commit: 9000 MB` on main's 3000 MB -> delete the line (or leave smoke.ps1's own `peak commit: n/a MB`) -> pass - `exit: 0xc0000005` -> already passes, even with every line present The last one matters on its own: a title can log frames, then die with `0xc0000005`; `smoke.ps1` reports `exit: 0xc0000005`, `crashes: 0` (its regex did not match a log line), and `pr_check.py` accepts it. A non-zero exit that is not `killed` is never treated as a crash. **Repro (by inspection, not run here)** With a runtime file in `files.tsv` and a complete main block, this PR block passes with zero problems: ``` xcl-smoke v1 commit: <head sha> title: <same title as main> seconds: 60 frames shown: 900 (PresentX 900) ``` `field_problems()` sees all three required lines; `device removals`, `crashes` and `exit` are missing, so lines 145-148 see 0/0/`""`; `peak commit` is missing on the PR side, so lines 160-162 skip the memory check. The expected result is three or four problems, one per missing line. I did not run it: this audit was done through the GitHub API at `568e7db` without cloning the repository. The code path is small enough to follow directly. **Suggested fix** - Add `device removals`, `crashes`, `exit` and `peak commit` to the PR block's required lines (a separate tuple, since `peak commit` is `<n> MB` and `exit` is not a count). - Parse the counters strictly: a value that is not a decimal number is a problem, not zero. Same for `peak commit` (`n/a` means the run never logged memory - that should be reported, not skipped). - Require `exit: 0x0` for the PR's block; keep `killed (no exit)` as its own message, and treat any other non-zero exit as a failure or at least print it in the check output. - Add fixtures to `scripts/test_pr_check.py`: a block with each line removed, a block with `crashes: none`, and a block with `exit: 0xc0000005`. **Related** - #1133 (merged): the same bug for `title` / `seconds` / `frames shown`. - #1884 (open): validates every `xcl-smoke` block instead of only the last; it moves this code but does not make the fields required (its diff keeps `for key in ("device removals", "crashes")` and `pr.get("exit", "")`). - #1506 / #1750 (open): the main block may itself have crashed before its end - a different case, about main's side. - #717 (open): the block cannot tell a black screen from a working title. **Scope** Found by reading the repository through the GitHub API at `568e7db`; nothing was cloned, built or run.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:23:27 +00:00
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-25 10:05 UTC · original

I'll take this. Plan, scripts/pr_check.py only:

  • The PR's block must have device removals, crashes, exit and peak commit lines.
  • device removals, crashes and peak commit must be numbers there. none or n/a is a problem, not 0 or a skipped check.
  • Any exit other than 0x0 is a problem: killed (no exit) keeps its own message, and 0xc0000005 gets "ended with exit 0xc0000005".
  • Main's block stays as it is, since its run may crash (#1506). When main's peak commit is not a number, the memory comparison is still skipped.

Tests in scripts/test_pr_check.py: one for each missing line, crashes: none, peak commit: n/a MB and exit: 0xc0000005. Each fails on 568e7db. I'll also update the existing fixtures that leave these lines out. #1229, #1750 and #2039 have fixtures without them, so whichever merges second needs a small fixture update.

AI use: Claude Code (Claude Opus 5.5) is writing the change and the tests.

**@⁠fromthemoonx** on GitHub · 2026-11-25 10:05 UTC · [original](https://github.com/xcl-dev/xcl/issues/2213#issuecomment-7159210665) I'll take this. Plan, `scripts/pr_check.py` only: - The PR's block must have `device removals`, `crashes`, `exit` and `peak commit` lines. - `device removals`, `crashes` and `peak commit` must be numbers there. `none` or `n/a` is a problem, not 0 or a skipped check. - Any `exit` other than `0x0` is a problem: `killed (no exit)` keeps its own message, and `0xc0000005` gets "ended with exit 0xc0000005". - Main's block stays as it is, since its run may crash (#1506). When main's `peak commit` is not a number, the memory comparison is still skipped. Tests in `scripts/test_pr_check.py`: one for each missing line, `crashes: none`, `peak commit: n/a MB` and `exit: 0xc0000005`. Each fails on `568e7db`. I'll also update the existing fixtures that leave these lines out. #1229, #1750 and #2039 have fixtures without them, so whichever merges second needs a small fixture update. AI use: Claude Code (Claude Opus 5.5) is writing the change and the tests.
Author
Owner

@⁠itsonewi on GitHub · 2026-11-25 11:19 UTC · original

Plan is right. Three details:

  • Keep the leniency for main, but make the skip visible: when main has no numeric peak commit, print memory check skipped: main has no peak commit in the check output. A silently skipped memory check reads the same as a passing one in the log, which is the same class of bug as the missing line.
  • exit: accept 0x0 and 0, and treat everything else as a problem. smoke.ps1 prints hex, so a block written by hand with 0 should not fail.
  • The fixture conflict with #1229, #1750 and #2039 is smaller if the required-line tuples are module-level constants and the fixtures are built through one helper: then the conflict is one line per PR instead of one line per fixture.
**@⁠itsonewi** on GitHub · 2026-11-25 11:19 UTC · [original](https://github.com/xcl-dev/xcl/issues/2213#issuecomment-7160897794) Plan is right. Three details: - Keep the leniency for main, but make the skip visible: when main has no numeric `peak commit`, print `memory check skipped: main has no peak commit` in the check output. A silently skipped memory check reads the same as a passing one in the log, which is the same class of bug as the missing line. - `exit`: accept `0x0` and `0`, and treat everything else as a problem. `smoke.ps1` prints hex, so a block written by hand with `0` should not fail. - The fixture conflict with #1229, #1750 and #2039 is smaller if the required-line tuples are module-level constants and the fixtures are built through one helper: then the conflict is one line per PR instead of one line per fixture.
This discussion has been locked. Commenting is limited to contributors.
No description provided.