PR checks: an empty file or a pure rename is not a binary #508
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/513"
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 hmodymac8-droid on 2026-11-24T01:08:02Z.
pr-check.ymlmarks a file as binary when GitHub's files API shows no patch and 0 changed lines ((.patch == null) and (.changes == 0)). That is also what the API returns for an empty file, a pure rename and a mode-only change, sopr_check.pyrefuses such a PR with "<file>is a binary file outside tests/data/ or over 1 MB", although nothing binary was added. Moving a script or adding a.gitkeepis enough to hit it.Reproduced on a throwaway PR in my fork (since closed): a pure rename of
scripts/re/pe_exports.py, an emptyscripts/re/.gitkeepand a real PNG header indocs/picture.png. The files API returnedbinary = truefor all three:main'spr_check.pyrefuses all three filesdocs/picture.pngis refusedWhat is in it
scripts/pr_check.py: when the workflow marks a file binary,blob_is_binary()reads the blob (git/blobsAPI, orgit cat-file -pwith--local) and keeps the mark only if the content is binary by git's own test (looks_binary(): a NUL byte in the first 8000 bytes; an empty file is not binary). If the blob can't be read, the workflow's answer stands.check()andpr-check.ymlare unchanged.scripts/test_pr_check.py(from #507): aBinaryContentTestsclass withlooks_binary(), plus end-to-end--localruns. An empty file and a renamed text file pass; a new PNG and a renamed binary are still refused.Tested
python test_pr_check.py(inscripts/): OK, together with #507's tests. Againstmain'spr_check.pythe empty file and the rename are refused (andlooks_binarydoes not exist)--local) on the real files list of the probe PR above: results as listedpython scripts/pr_check.py --localon this description:description okcargo test --workspace -- --test-threads=4at2997c9a: 676 passed, 0 failed, 41 ignored, noSKIPPED(results in #42)Regression run
crates/xcl/srcchangesNot tested
pr-check.ymlitself (it usesmain'spr_check.py, so this takes effect after merge)AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by wadzwigidy on 2026-11-24T01:32:04Z.
Independent check of PR #513 at
15e3d8800a5b918066e9480072a4c2802276cfb7.Tested
py -3.14 scripts/pr_check_binary_tests.py -v: 4 passed, 0 failed. The tests accept an empty file and a text rename, and still reject a PNG and a renamed binary.git diff --checkon the PR commit: clean; worktree clean. Tests used synthetic files only. Temporary files and the checkout were kept on the VS Projects share.Not tested
pr-check.ymlafter merge, or the Rust/GPU suite.AI use
upstream-sync referenced this pull request2026-11-24 13:02:56 +00:00
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T13:53:45Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:41:38Z.
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-01T03:37:54Z.
Triage (#1607) – head
2e1eb8cNo open or merged PR makes the same change. On main,
.github/workflows/pr-check.ymlstill marks a file binary when(.patch == null) and (.changes == 0), andpr_check.pytrusts that flag. #952 also touches renames inpr_check.py, but only for the smoke requirement.No problems found in the diff. Note: in remote mode each flagged file now costs one
gh api .../git/blobscall that downloads the whole blob, including real binaries up to 100 MB.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.