Skip to content

PR checks: the PR's smoke block must show how its run ended (#2213) - #2219

Draft
fromthemoonx wants to merge 1 commit into
xcl-dev:mainfrom
fromthemoonx:scripts/pr-check-require-smoke-safety-lines
Draft

fromthemoonx wants to merge 1 commit into
xcl-dev:mainfrom
fromthemoonx:scripts/pr-check-require-smoke-safety-lines

Conversation

@fromthemoonx

@fromthemoonx fromthemoonx commented Nov 25, 2026 •

Copy link
Copy Markdown

scripts/pr_check.py required only title, seconds and frames shown in an xcl-smoke block. The PR's device removals, crashes, exit and peak commit lines were read with dict.get(), and a missing or non-numeric value counted as clean. So a block that lost its crashes: 1 line passed, and so did peak commit: n/a MB and exit: 0xc0000005. The PR's own block now has to show all four lines with real values. Main's block is unchanged, because its run may have crashed (#1506).

Fixes #2213

What is in it

  • scripts/pr_check.py: the PR's block needs device removals, crashes, exit and peak commit (PR_SMOKE_FIELDS), in the form smoke.ps1 prints them (PR_SMOKE_FORMS): the counters as plain integers, peak commit as <n> MB. number() reads only leading digits, so 1.5 GB was 1 and 3,000 MB was 3. An exit other than 0x0 is a problem: killed (no exit) keeps its message, anything else gets "ended with exit …". seconds: 0 fails in either block, and frames shown: 0 and peak commit: 0 MB fail in the PR's: the comparisons treat 0 as no value and skip themselves. The memory comparison still skips a main block whose peak commit is not a number.
  • scripts/test_pr_check.py: a CLEAN_RUN fixture with the lines smoke.ps1 prints, used by the existing two-blocks test. New tests: a clean PR block passes; each of the four lines missing fails; malformed values fail (crashes: none / 0x0, device removals: n/a / 0.0, peak commit: n/a MB / 1.5 GB / 3,000 MB); zero seconds, frames shown and peak commit fail; exit: 0xc0000005 and exit: killed (no exit) fail; and a main block without these lines still passes.

Open PRs whose test_pr_check.py fixtures leave these lines out of the PR's block (#1750, #2039) will need them added when they are rebased onto this.

Tested

  • Windows 11 Pro 26300, Python 3.12, RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Rust 1.100.0 MSVC, debug.
  • python -m unittest discover -s scripts -p test_pr_check.py: 19 tests, OK. With scripts/pr_check.py from main and the new tests: 13 subtests fail (the missing lines, the malformed values, the zeros and the crash exit). The other scripts/test_*.py files pass.
  • scripts/pr_check.py on D3D12.X: binds go on without big compute programs that write only images #2176's description (a real pair of smoke.ps1 blocks) with a runtime file: description ok, the same as main's checker.
  • cargo build --workspace + cargo test --workspace --no-fail-fast -- --test-threads=4 on 8d99ad3 (base 568e7db; it merges into main f087b99 without conflicts): 1154 passed, 0 failed, 46 ignored. 24 SKIPPED: no wave64, the per-lane refusals, no heap windows.

Regression run

  • Not needed: the change is in scripts/ only, with no runtime files.

Not tested

  • The PR checks workflow on GitHub with this script, until it runs on this PR.
  • macOS / Linux.

AI use

  • Claude Code (Claude Opus 5.5) wrote the change, the tests and this description, and ran the tests above.

🤖 Generated with Claude Code

@itsonewi

Copy link
Copy Markdown

Reviewed the diff; the four lines are now required and the main block stays lenient, which matches #2213. One hole is left in the new peak commit check because it still goes through number():

  • number() is re.match(r"\s*(\d+)", ...), so peak commit: 1.5 GB is read as 1 and 3,000 MB as 3. Both pass the 125% comparison against a 3000 MB main.
  • peak commit: 0 MB is read as 0, and if pc and mc treats 0 as absent, so the comparison is skipped entirely.
  • device removals: 0.0 and crashes: 0x0 are also accepted as 0; harmless, but the same "leading digits only" parser.

Since the point of #2213 is that a hand-edited block must not pass, I would make peak commit strict: ^\s*(\d+)\s*MB\s*$, require it to be > 0 for the PR's block, and change the comparison guard to pc is not None and mc is not None. Tests for 1.5 GB, 3,000 MB and 0 MB would cover it. The docstring of field_problems still says "for the comparison"; it now also carries the safety lines, so a one-line update would help.

Everything else looks right to me: the missing-line messages, killed vs other exits, the main-block leniency, and the new tests.

@itsonewi

Copy link
Copy Markdown

One more bypass in the same area, now that the four lines are mandatory: the comparison guards treat 0 as "no value". field_problems accepts seconds: 0 and frames shown: 0 (both numeric), and then if mf and ... / if pc and mc ... skip both comparisons. A pair of blocks with seconds: 0, frames shown: 0, peak commit: 0 MB, device removals: 0, crashes: 0, exit: 0x0 passes today.

Requiring seconds > 0 and frames shown > 0 in both blocks (and peak commit > 0 in the PR's, as above) closes it; smoke.ps1 defaults to 60 s, so a real run is unaffected.

…2213)

scripts/pr_check.py required only `title`, `seconds` and `frames shown` in
an `xcl-smoke` block. The PR's `device removals`, `crashes`, `exit` and
`peak commit` lines were read with dict.get(), and a missing or non-numeric
value counted as clean. A block that lost its `crashes: 1` line, or that kept
smoke.ps1's own `peak commit: n/a MB`, passed. So did `exit: 0xc0000005`,
because only an exit starting with "killed" was a problem.

The PR's own block now needs all four lines, in the form smoke.ps1 prints
them: the two counters as plain integers and `peak commit` as `<n> MB`.
number() reads only leading digits, so `1.5 GB` was 1 and `3,000 MB` was 3.
An exit other than 0x0 is a problem (`killed (no exit)` keeps its message).
`seconds` must not be 0 in either block, and `frames shown` and `peak commit`
must not be 0 in the PR's: the comparisons treat 0 as "no value" and skipped
themselves. Main's block is otherwise unchanged, because its run may have
crashed (xcl-dev#1506).

Fixes xcl-dev#2213

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fromthemoonx
fromthemoonx force-pushed the scripts/pr-check-require-smoke-safety-lines branch from d706c76 to 8d99ad3 Compare November 25, 2026 11:06
@fromthemoonx

Copy link
Copy Markdown
Author

Thanks @itsonewi, both points were right. On d706c76, blocks with peak commit: 1.5 GB, 3,000 MB or 0 MB, crashes: 0x0, and the all-zero pair all passed. Fixed in 8d99ad3, squashed into the one commit:

  • The PR's device removals and crashes must be plain integers, and its peak commit must be <n> MB (PR_SMOKE_FORMS, re.fullmatch), so 1.5 GB, 3,000 MB, 0x0 and 0.0 are reported as malformed.
  • seconds: 0 fails in either block. frames shown: 0 and peak commit: 0 MB fail in the PR's block. Main's frames shown and peak commit can still be 0 or missing, since its run may have crashed (PR checks: a PR that fixes a crash is refused when main's run crashed before its end #1506). I kept the if pc and mc guard, because a PR's 0 is now its own problem and a main's 0 means there is nothing to compare against.
  • The field_problems docstring now says what it checks.

New tests cover each case. 19 tests pass, and 13 subtests fail against main's pr_check.py.

Claude Code (Claude Opus 5.5) made the change and wrote this reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants