PR checks: the main smoke baseline can be an old or dirty commit, not current main #2226

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

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

pr_check.py accepts any xcl-smoke block whose commit: is an ancestor of main as the baseline (is_main_ancestor, lines 190-194; the main list at line 138). It does not require that commit to be current, that the run was clean, or that only one block matches. That leaves the baseline under the author's control in three ways:

  1. An old main commit. compare/{sha}...main returns ahead for any ancestor, so a block from a week-old main passes. If main's memory or frame rate has changed since then, the PR is compared with the old numbers, not the ones it will merge into.
  2. A dirty main run. base (line 134) does not filter "uncommitted" from the commit line, although clean does for the PR's block (line 133). smoke.ps1 writes commit: <sha> (uncommitted changes) when crates/, Cargo.toml or Cargo.lock are modified (lines 34 and 90), and is_main_ancestor only reads the first token. A run with local changes therefore counts as main.
  3. Several main blocks. m = next((b for b in main if ...), None) (line 151) takes the first block with the same title and time. A PR can paste a favorable main block first and the current one second; the check only looks at the first.

The 80% frames and 125% peak-commit checks are the only regression gate for runtime PRs. With the baseline under the author's control, a PR can pass them without being compared to current main.

Repro (by inspection)

  • Take an old main commit A and the current tip B. A block commit: A passes is_main_ancestor (compare/A...main is ahead).
  • A block commit: B (uncommitted changes) passes: b["commit"].split()[0] is B, and base never checks for "uncommitted".
  • With two main blocks for the same title/time, the first one is used; put the better one first.

I did not run the checker: this audit is read-only through the GitHub API at 568e7db.

Suggested fix

  • Require the main block's commit to be the current main tip at check time, or at least the PR's base commit. The pull_request_target event has the base SHA; pass it to the script and compare. Fetching repos/{repo}/commits/main is one API call.
  • Reject a main block whose commit line contains uncommitted, same as the PR's block.
  • If more than one main block matches the title and time, reject the ambiguity or use the newest, not the first.
  • Add tests to scripts/test_pr_check.py: an old ancestor, a dirty main block, and two matching main blocks.

Related

  • #1506 / #1750: main's block may have crashed before its end; that is the intended leniency, but it is a different case.
  • #2213 / #2219: the PR block must now include the crash/exit/peak lines; this issue is about the baseline it is compared with.
  • #2225: the 125% comparison is already noisy with a current baseline; an old one makes it worse.
  • #1141: validates the commit token as hex; it does not check which commit it is.

Scope

Read through the GitHub API at 568e7db; nothing was cloned, built or run.

**@⁠itsonewi** on GitHub · 2026-11-25 10:38 UTC · [original](https://github.com/xcl-dev/xcl/issues/2226) `pr_check.py` accepts any `xcl-smoke` block whose `commit:` is an ancestor of main as the baseline (`is_main_ancestor`, lines 190-194; the `main` list at line 138). It does not require that commit to be current, that the run was clean, or that only one block matches. That leaves the baseline under the author's control in three ways: 1. **An old main commit.** `compare/{sha}...main` returns `ahead` for any ancestor, so a block from a week-old main passes. If main's memory or frame rate has changed since then, the PR is compared with the old numbers, not the ones it will merge into. 2. **A dirty main run.** `base` (line 134) does not filter `"uncommitted"` from the commit line, although `clean` does for the PR's block (line 133). `smoke.ps1` writes `commit: <sha> (uncommitted changes)` when `crates/`, `Cargo.toml` or `Cargo.lock` are modified (lines 34 and 90), and `is_main_ancestor` only reads the first token. A run with local changes therefore counts as main. 3. **Several main blocks.** `m = next((b for b in main if ...), None)` (line 151) takes the first block with the same title and time. A PR can paste a favorable main block first and the current one second; the check only looks at the first. The 80% frames and 125% peak-commit checks are the only regression gate for runtime PRs. With the baseline under the author's control, a PR can pass them without being compared to current main. **Repro (by inspection)** - Take an old main commit `A` and the current tip `B`. A block `commit: A` passes `is_main_ancestor` (`compare/A...main` is `ahead`). - A block `commit: B (uncommitted changes)` passes: `b["commit"].split()[0]` is `B`, and `base` never checks for `"uncommitted"`. - With two main blocks for the same title/time, the first one is used; put the better one first. I did not run the checker: this audit is read-only through the GitHub API at `568e7db`. **Suggested fix** - Require the main block's commit to be the current `main` tip at check time, or at least the PR's base commit. The `pull_request_target` event has the base SHA; pass it to the script and compare. Fetching `repos/{repo}/commits/main` is one API call. - Reject a main block whose commit line contains `uncommitted`, same as the PR's block. - If more than one main block matches the title and time, reject the ambiguity or use the newest, not the first. - Add tests to `scripts/test_pr_check.py`: an old ancestor, a dirty main block, and two matching main blocks. **Related** - #1506 / #1750: main's block may have crashed before its end; that is the intended leniency, but it is a different case. - #2213 / #2219: the PR block must now include the crash/exit/peak lines; this issue is about the baseline it is compared with. - #2225: the 125% comparison is already noisy with a current baseline; an old one makes it worse. - #1141: validates the commit token as hex; it does not check which commit it is. **Scope** Read 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:48 +00:00
Author
Owner

@⁠Creaa on GitHub · 2026-11-25 10:44 UTC · original

Taking this one: part 2 as a fix with tests (a main block whose commit: line says (uncommitted changes) is not a baseline, the same rule the PR's block already has), and part 3 (when several main blocks match, the check uses the newest main commit among them, not the first pasted). For part 1 the PR will report how far behind current main the baseline is rather than pick a cut-off; the cut-off is the maintainer's call. scripts/ only.

AI use: Claude Code (Claude Opus 5.5) drafted this.

**@⁠Creaa** on GitHub · 2026-11-25 10:44 UTC · [original](https://github.com/xcl-dev/xcl/issues/2226#issuecomment-7160106276) Taking this one: part 2 as a fix with tests (a `main` block whose `commit:` line says `(uncommitted changes)` is not a baseline, the same rule the PR's block already has), and part 3 (when several `main` blocks match, the check uses the newest main commit among them, not the first pasted). For part 1 the PR will report how far behind current `main` the baseline is rather than pick a cut-off; the cut-off is the maintainer's call. `scripts/` only. AI use: Claude Code (Claude Opus 5.5) drafted this.
Author
Owner

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

Agreed on 2 and 3, and reporting the distance instead of choosing a cut-off is the right call.

  • On 3, paste order is not a signal: the blocks carry no timestamp, so "newest" has to come from the API (GET /repos/{repo}/commits/{sha} -> committer.date), not from the order in the description. If two blocks name commits with the same date (a squashed batch), reject as ambiguous instead of picking one.
  • On 1, one refinement worth doing in the same PR: print whether the commits the baseline is behind touch crates/xcl/src, Cargo.* or scripts/. A baseline 40 commits behind on README-only changes is a valid comparison, and "40 commits behind" alone would send authors to re-run for nothing. compare/{base}...main returns the file list.
  • Have the message name the SHA it used as the baseline, so a reader can see which block won without opening the script.
**@⁠itsonewi** on GitHub · 2026-11-25 11:19 UTC · [original](https://github.com/xcl-dev/xcl/issues/2226#issuecomment-7160893965) Agreed on 2 and 3, and reporting the distance instead of choosing a cut-off is the right call. - On 3, paste order is not a signal: the blocks carry no timestamp, so "newest" has to come from the API (`GET /repos/{repo}/commits/{sha}` -> `committer.date`), not from the order in the description. If two blocks name commits with the same date (a squashed batch), reject as ambiguous instead of picking one. - On 1, one refinement worth doing in the same PR: print whether the commits the baseline is behind touch `crates/xcl/src`, `Cargo.*` or `scripts/`. A baseline 40 commits behind on README-only changes is a valid comparison, and "40 commits behind" alone would send authors to re-run for nothing. `compare/{base}...main` returns the file list. - Have the message name the SHA it used as the baseline, so a reader can see which block won without opening the script.
This discussion has been locked. Commenting is limited to contributors.
No description provided.