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

Open
github-bot wants to merge 1 commit from github-bot/gh-2219 into main AGit
Owner

@⁠fromthemoonx on GitHub · 2026-11-25 10:09 UTC · original
fromthemoonx:scripts/pr-check-require-smoke-safety-lines → main · +62 −10 · 2 files · 1 commits · open

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 #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

**@⁠fromthemoonx** on GitHub · 2026-11-25 10:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/2219) `fromthemoonx:scripts/pr-check-require-smoke-safety-lines` → `main` · +62 −10 · 2 files · 1 commits · open `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 #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](https://claude.com/claude-code)
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 (#1506).

Fixes #2213

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:23:36 +00:00
Author
Owner

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

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** on GitHub · 2026-11-25 10:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/2219#issuecomment-7159836945) 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.
Author
Owner

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

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.

**@⁠itsonewi** on GitHub · 2026-11-25 10:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/2219#issuecomment-7160406502) 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.
Author
Owner

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

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 (#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.

**@⁠fromthemoonx** on GitHub · 2026-11-25 11:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/2219#issuecomment-7160633140) 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 (#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._
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 16:12 UTC · original

I retested the revised head 8d99ad3ac9b4ffff5965b767514583848f42a951 through the full local checker entry point. python -B -m unittest discover -s scripts -p test_pr_check.py passed all 19 tests. I then ran 16 independent pairs of synthetic reports through python -I scripts/pr_check.py --local --body <fixture.md> --head <PR SHA> --files <runtime-change.tsv>, using the local origin/main SHA for the baseline. All 16 returned the expected exit code and diagnostic.

  • For a baseline of 100 frames and 4,000 MB, 80 frames and 5,000 MB together passed. Changing only frames to 79 or only memory to 5,001 MB failed for the corresponding reason.
  • A crashed main run with zero frames and no peak measurement could still be paired with a healthy PR. On the PR side, a crash exit, a killed run, a device removal, zero frames, zero peak, or a zero-duration pair failed.
  • The checker rejected a peak of 1.5 GB, a crash count of 0x0, and each of the four individually missing fields (device removals, crashes, exit, peak commit).

Windows 11 26100.9711, i7-13700, RTX 4060, Python 3.14.3. This exercised the description checker with synthetic input. No retail run, GPU workload or Rust build. OpenAI Codex (GPT-6) ran the checks and prepared this report.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 16:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/2219#issuecomment-7167692121) I retested the revised head `8d99ad3ac9b4ffff5965b767514583848f42a951` through the full local checker entry point. `python -B -m unittest discover -s scripts -p test_pr_check.py` passed all 19 tests. I then ran 16 independent pairs of synthetic reports through `python -I scripts/pr_check.py --local --body <fixture.md> --head <PR SHA> --files <runtime-change.tsv>`, using the local origin/main SHA for the baseline. All 16 returned the expected exit code and diagnostic. - For a baseline of 100 frames and 4,000 MB, 80 frames and 5,000 MB together passed. Changing only frames to 79 or only memory to 5,001 MB failed for the corresponding reason. - A crashed main run with zero frames and no peak measurement could still be paired with a healthy PR. On the PR side, a crash exit, a killed run, a device removal, zero frames, zero peak, or a zero-duration pair failed. - The checker rejected a peak of `1.5 GB`, a crash count of `0x0`, and each of the four individually missing fields (device removals, crashes, exit, peak commit). Windows 11 26100.9711, i7-13700, RTX 4060, Python 3.14.3. This exercised the description checker with synthetic input. No retail run, GPU workload or Rust build. OpenAI Codex (GPT-6) ran the checks and prepared this report.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2219/head:github-bot/gh-2219'
git switch 'github-bot/gh-2219'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2219'
git switch 'github-bot/gh-2219'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2219'
git switch 'github-bot/gh-2219'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2219'
git switch 'main'
git merge --squash 'github-bot/gh-2219'
git switch 'main'
git merge --ff-only 'github-bot/gh-2219'
git switch 'main'
git merge 'github-bot/gh-2219'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.