Scripts: pr_check takes the newest clean main smoke block as the baseline (#2226) #2230
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2230
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2230"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Creaa on GitHub · 2026-11-25 10:46 UTC · original
Creaa:scripts/pr-check-main-baseline→main· +77 −8 · 2 files · 1 commits · openThe smoke check of
pr_check.pylet the author pick themainbaseline: a main block with local changes counted as main (the PR's block already had to be clean), and with several matching main blocks the first pasted one was used, so an older, more favourable run could be put first. Fixes parts 2 and 3 of #2226; part 1 (how old a baseline may be) is reported, not judged.What is in it
scripts/pr_check.py:commit:line says(uncommitted changes)is not a baseline; when only such a block is there, the check asks for a rerun on a clean checkout of main;check(..., main_behind=...): with the distance of each main commit from main known, the baseline is the block of the newest main commit with the PR's title and time, wherever it is pasted; without it, or when any candidate's distance is unknown (a failed API call), the first block as before (main_baseline);main()gives that distance (git rev-list --count <sha>..origin/mainwith--local,compare/<sha>...mainahead_byon GitHub) and prints one line per main block,main regression run <sha>: N commit(s) behind main, without failing on it.scripts/test_pr_check.py:test_a_main_run_with_uncommitted_changes_is_not_a_baseline,test_the_newest_main_block_is_the_baseline_whatever_its_place(both orders of an old and a current main block; withoutmain_behind, or with an unknown distance, the first block is used; a failing comparison names the baseline's distance).Tested
python -m unittest discover -s scripts -p "test_pr_check.py": 15 tests, OK. Withpr_check.pyfrommainthe two new tests fail (one failure, one error), the other 13 pass.python scripts/pr_check.py --localon a body with two main blocks (cbc296aand currentmain) and a PR block: prints54 commit(s) behind mainand0 commit(s) behind main, thendescription ok.Regression run
scripts/changes, not the runtime.Not tested
main_behind(compare/...mainahead_by) against the real API in the workflow; the local path was run.AI use
🤖 Generated with Claude Code
@itsonewi on GitHub · 2026-11-25 10:51 UTC · original
The fix covers parts 2 and 3, and the tests read well. Two small things:
main regression run <sha>: N commit(s) behind mainline is printed before the failure, but a reader who jumps to the failure will not connect the two. Something likethe main block is 54 commits behind main; rerun it before comparing.main_baseline, a candidate whosemain_behindisNonesorts as1 << 30. If the newest block's compare call fails transiently but an older one succeeds, the older block wins - the opposite of the intent. Treat "any unknown distance" as "do not reorder" (fall back tocandidates[0]), or fail the check with a message. The current behavior is only safe if the API never fails.Neither blocks the merge for me. Part 1 (how old a baseline may be) is still open in #2226; the printed line is a good interim.
@Creaa on GitHub · 2026-11-25 10:58 UTC · original
Thanks, both fixed in
4e4c508(squashed into the PR's commit):; the main block is N commit(s) behind main: rerun it before comparing.main_baselinenow keeps the first pasted block when the distance of any candidate is unknown. The test covers it (newest block's distanceNone, older one 40): it fails on the previous commit and passes now.python -m unittest discover -s scripts -p "test_pr_check.py": 15 tests, OK. #2235 is rebased onto this.AI use: Claude Code (Claude Opus 5.5) made the change and drafted this reply.
@raylitebull on GitHub · 2026-11-25 11:00 UTC · original
Code review on
3369021(scripts/pr_check.py,scripts/test_pr_check.py):mainxcl-smokeblocks tagged(uncommitted changes)and selectingmin(candidates, key=behind)viamain_baselinecleanly closes the stale/dirty baseline loophole from#2226while preserving fallback behavior whenmain_behindisNone, with 15/15 unit tests covering both orders.45598235181).compare/<sha>...mainahead_bybranch (!o.local) will be exercised live by the PR workflow once CI completes.@itsonewi on GitHub · 2026-11-25 11:03 UTC · original
Re-read the new head (
4e4c508): both points are addressed - an unknown distance now falls back to the first block instead of letting an older one win, and a failing comparison names how far the baseline is behind. The added assertions cover both orders, the unknown-distance case and the old-baseline message.LGTM from me. The new head needs a fresh CI approval; the approved run (
45598235181) was for3369021.@raylitebull on GitHub · 2026-11-25 11:03 UTC · original
Updated review on
4e4c508:candidates[0]whenNone in behindprevents transient API failures from letting an older baseline win, and appendingthe main block is N commit(s) behind maindirectly to the failing comparison messages makes stale baselines immediately actionable.45600100113).@throny on GitHub · 2026-11-26 00:58 UTC · original
Two contributors checked independently and found that #2406 solves the same problem (for #2226) in a different way: #1607, group D117. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@RavenCurseBurg on GitHub · 2026-11-25 14:05 UTC · original · edited 2026-11-26 01:13 UTC
For D117, I also ran this same head and #2406 against identical fixtures using real local Git history. With a clean, one-commit-old baseline matching the PR’s frame count, #2230 passes and #2406 requires the recorded PR base. With an older high-frame block and a current clean block, both checkers select the current result in either order. Ten scenarios per checker, including dirty and duplicate blocks, are in the comparison report on #1056. OpenAI Codex (GPT-6) ran the comparison on Windows 11 with Python 3.14.3.
Earlier verification
Checked
a156f8bbb737f79f9f63e594c9b39cb215c4a670against a snapshot of the public GitHub Compare API. For06c9f5505f63...mainthe API returnedidentical / 0; for its first parentafc5ee86ae3a...mainit returnedahead / 2. I replayed those two responses at thegh apisubprocess boundary ofpr_check.py --repo xcl-dev/xcl --body <body> --files <files> --head <sha>, checking the compare path and both requested fields. The local machine has noghbinary, so this covers the non-local checker code and the API response fields, with no Actions run.With synthetic frames of 1,000 on the parent, 100 on the tip, and 110 on the PR, both block orders selected the tip and passed. The parent alone failed and printed the two-commit distance. A dirty tip alone failed with the clean-checkout diagnostic. All four cases printed the expected baseline distances.
python -B -m unittest discover -s scripts -p test_pr_check.pyalso passed all 15 tests.Windows 11 26100.9711, i7-13700, RTX 4060, Python 3.14.3. No Rust build, GPU workload, or retail runs. OpenAI Codex (GPT-6) retrieved the API data, ran these script fixtures and wrote the report.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.