PR checks: require hex commit hashes in xcl-smoke blocks #1132
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1141"
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?
Imported from ivall/xcl. Originally posted by microwave805 on 2026-11-24T12:28:06Z.
scripts/pr_check.pyaccepted any 7+ character token on anxcl-smokeblock'scommit:line and passed it verbatim togh api repos/<repo>/compare/<sha>...main(running underpull_request_target) andgit merge-base --is-ancestor.As a result, symbolic refs and rev expressions such as
refs/heads/mainandmain~00returnedidenticalfrom GitHub's compare API (andorigin/main/HEAD~000exited0locally), passing the main-baseline check without naming any commit hash. Untrusted path segments (../../pulls, query strings) and leading-dash git flags (--version) were also interpolated directly into those calls.Note on overlap with #834: #834 checks the first word's length (≥ 7) to reject short prefixes like
1 some other, but still allows non-hex refs, paths, and options through tois_main_ancestor(). Validating 7–40 hex digits handles both.What is in it
scripts/pr_check.py: addCOMMIT_SHA([0-9a-f]{7,40}, case-insensitive) andcommit_sha()to extract and lowercase valid hex SHAs before matchingheador callingis_main_ancestor(), plus the same check insideis_main_ancestor()as defense-in-depth.scripts/test_pr_check.py: cover non-hex refs, path traversal, query strings, leading-dash flags, out-of-range lengths, short/non-hex PR head commits, and valid 7–40 character lowercase/uppercase hex SHAs.Tested
stable-x86_64-pc-windows-msvc, debug), Python 3.11.3eebd284(rebased ontomainb7aa9f3):python -I -m unittest discover -s scripts -p "test_*.py" -v: 19 passed, 0 failed.\scripts\test.ps1(cargo build --workspace && cargo test --workspace -- --test-threads=4): 770 passed, 0 failed, 41 ignoredgpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)b00fd33(base47efa2e): before the fix all 3 new tests failed with 12 subtest failures;python -I scripts/pr_check.py --localrejectedorigin/main,refs/heads/main,HEAD~000, and--version(exit 1) and accepted47efa2e(description ok); checkedcommit_sha()against 25 recently merged PRs onxcl-dev/xcl(16 PRs, 32xcl-smokeblocks, 0 false positives)Regression run
scripts/pr_check.pyandscripts/test_pr_check.py(no runtime or build-input files).Not tested
pull_request_targetexecution (usesmain's copy ofscripts/pr_check.pyuntil merged)AI use
scripts/pr_check.py, wrote the fix, unit tests, rebase conflict resolution, and this PR description, and ran the verification commands above.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T12:52:18Z.
Independent verification on current
main384f7f7(branch already contains it — clean).Machine: Windows 11, Ryzen 9 7900X; Python 3.
python scripts/test_pr_check.py: 12 tests OK.commit_sha()now requires a 7–40 hexcommit:token, and both the PR-head match (head_sha.startswith(sha)) and the baseline selection go through it — a smoke block with a non-hex or missing commit no longer counts as a valid run. Theuncommittedcheck still applies to the matched block.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:15:56Z.
Tested exact head
b00fd33, script tests only, since this PR has no test report yet.Tested
python -m pytest scripts/test_pr_check.pyat the head: 12 passed, 25 subtests passed.930e8b4): 12 subtests fail acrosstest_non_hex_main_commits_are_refused_before_ancestor_checkandtest_short_or_non_hex_head_commits_are_refused(e.g.main~00,HEAD~000,../../pulls). So the new test catches the problem the PR fixes.Not tested
AI use
Imported from ivall/xcl. Originally posted by GonZiin on 2026-11-24T17:50:57Z.
Review: COMMENTED
I checked whether #834 still needs a separate merge. All four of its
SmokeBlockCommitTestspass with this PR's checker, including acceptance of valid abbreviations and rejection of dirty and short-head blocks. This PR also validates the baseline's commit token. I would consolidate the work here and retain any additional test cases from #834 in the same branch.Tested
python3 -B -m unittest discover -s scripts -p 'test_*.py'ran 13 tests on #834 atf0bc702589cd694ca37db95c7f7268cedc095aecand 19 tests on #1141 ateebd2849f4e8305198cc92e66518e76a33d7cda2. Both passed.git merge-tree --write-treecombined #1141 withmainat9e3831e1f570d3646e53ab753b19ec07eb8f1485without conflicts. I copied only #834's four regression tests into the temporary merged tree. The same Python command reported 23 passed, 0 failed, 0 ignored.Not tested
The Windows workspace and live GitHub Actions execution of the checker.
AI use
Codex (
gpt-6.2-sol) compared the diffs, ran the tests and drafted this review.upstream-sync referenced this pull request2026-11-24 19:06:45 +00:00
Imported from ivall/xcl. Originally posted by microwave805 on 2026-11-24T19:01:57Z.
@GonZiin Thanks for cross-checking #834 against
eebd284and verifying the merge! I also ran.\scripts\test.ps1directly oneebd284(770 passed, 0 failed, 41 ignored; 2SKIPPEDforno wave64) and updated Tested. Happy to pull #834's remaining two test cases (uncommitted head / unrelated commit) into this branch too if maintainers prefer consolidating here.(Comment drafted with Antigravity (Gemini 4 Neon).)
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:40:57Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:42:23Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:54:20Z.
Triage (#1607) – head
eebd284#834 fixes part of the same
pr_check.pybug. Both take a smoke block's commit from the first word of itscommit:line, so1 some otherno longer counts as the head's run. This PR also requires that first word to be a 7-40 digit hex SHA, so refs such asorigin/mainormain~0never reachis_main_ancestor, and it compares case-insensitively. That covers everything #834 does. Main still has the old length check.No problems found in the diff.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.