PR checks: an empty file or a pure rename is not a binary #513
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!513
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@hmodymac8-droid on GitHub · 2026-11-24 01:08 UTC · original
hmodymac8-droid:scripts/pr-check-binary-by-content→main· +72 −3 · 2 files · 2 commits · openpr-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
@wadzwigidy on GitHub · 2026-11-24 01:32 UTC · original
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
@DavidM1911 on GitHub · 2026-11-25 13:53 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.