Repository navigation
fix(pr-review-cli): classify binary files by content, not the head's .gitattributes - #1110
kyle-sexton wants to merge 1 commit into
Conversation
….gitattributes The full-diff step's numstat read the checked-out head's .gitattributes, so a text lockfile the consumer marks -diff was listed as binary and a real binary marked diff was not. Read attributes from the empty tree in all three legs so content alone decides, warn when the list fails, and say so in the README. The binary list also lowers the read-evidence bar to a file's header lines, so the attribute could no longer weaken that check either. Refs: #1109 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-review reviewed No findings. I read the full diff for all 4 changed files and the PR context. This is a first review of this lane on the PR (no prior findings, not blocking-only). I ran nothing myself, so the test results and the scratch-repo output in the PR description are author-claimed and unverified. What changed
What I checked
Verifier dropped 0 of 0 candidates. |
|
Closing (hub, who filed #1109). The diagnosis behind #1109 was wrong: claude-code-plugins PR 16458's review went partial on a one-line sany.out of about 110k tokens, not on its lockfile (run 43909503487 log). publish.cjs lines 237-243 never fail a review on binary_files, which only adds words to the reason. This change fixes no observed failure, and it adds one: a large text lockfile could make a review partial in every caller that pins @main. The real fix is claude-code-plugins PR 16581. Branch kept; reopen if a lockfile ever does cause a failure. |
Refs: #1109
Summary
The full-diff step in
pr-review-cli.ymllists a changed file as binary whengit diff --numstatcounts no lines for it. That numstat read the checked-out head's.gitattributes. So a textpackage-lock.jsonthe consumer marks-diffwas listed as binary, and the status line named it as "not reviewable as text".The binary list alone does not make a review
partial.isPartialin.github/actions/publish-review/publish.cjschecks onlyread < changed,over_budgetandover_files;binary_filesonly adds text to the reason. In the melodic-software/claude-code-plugins#16458 run (log) the coverage was{"read":452,"changed":453,"binary_files":[".../package-lock.json"]}. The review's chunk 2 read the package files. The missing file wasplugins/formal-verification/skills/chart/scripts/test/corpus/PickWorker/sany.out: chunk 11 reportedfiles_read8 of 9 because that file is one line of about 110k tokens, and the reads check warnedno Read showed the whole change of 1 listed file(s): .../PickWorker/sany.out. The lockfile was only mislabelled in the message.Two things are still wrong with letting the attribute decide, and this PR fixes both:
check-review-readstreats a file on the binary list as read once the lines before its first hunk are shown (README, "for a file on the job's binary-files list only the lines before its first hunk count"). A-diffattribute on any text file therefore lowered the read-evidence bar for that file underenforcemode.diffattribute on a real binary file removed it from the list.The checkout is the pull request's head (
ref: ...head.sha), so the pull request controlled both.Fix
git --attr-source="$(git hash-object -t tree /dev/null)" diff --numstat .... Attributes come from the empty tree, so git's content check alone decides what is binary. No lockfile name list is needed. A consumer attribute cannot hide a binary file or get any text file listed as binary.::warning::and names no file. Before, it named none silently.Direction chosen: the issue offered two options, reading
-diffpaths with--textor exempting lockfiles from coverage. Neither is needed. The review's diff already uses--text(git diff --no-color --no-ext-diff --no-textconv --text ..., the step's comment: "a head .gitattributes (-diff, binary) ... must not turn a changed file into 'Binary files differ'"). Exempting lockfiles would report a file as reviewed when nobody checked that it was read. With this fix the lockfile stays in the count and needs full read evidence like any text file, so the coverage claim stays true.--attr-sourcearrived in git 2.41 (v2.41.0 release notes, "git --attr-source=<tree> cmd $argsis a new way..."). That run's runner logsgit version 2.56.1.$GIT_DIR/info/attributesand a globalcore.attributesFilestill apply. Both belong to the runner, not the pull request.Verification
.gitattributes=package-lock.json -diff,*.lock -diff,forced.png diff:git diffprintedBinary files a/package-lock.json and b/package-lock.json differfor a JSON file.1 1 forced.png,- - logo.png,- - package-lock.json.--attr-source=<empty tree>:- - forced.png,- - logo.png,1 1 package-lock.json.the full-diff step names the binary files in scope by content, not the head's .gitattributes, in every leg(.github/scripts/pr-review-cli.test.cjs) runs the step's shell in each leg against a head.gitattributesthat marks a textpkg/package-lock.jsonandnotes.txt-diffand a binaryforced.pngdiff, beside a binaryx/yarn.lock(a binary file named like a lockfile) and the existing.tar.gzarchives.binary=5.binary=4. The list isa/fixtures.tar.gz,b/fixtures.tar.gz,forced.png,x/yarn.lock. The text files are not listed.a review that read every file is complete with a binary file in scope(.github/scripts/publish-review.test.cjs) pins the rule: a full read withbinary_filespostsreviewed, notpartial.node --test --test-concurrency=4overpr-review-cli.test.cjs,publish-review.test.cjsandcheck-review-reads.test.cjs: 173 pass, 0 fail.Remaining
PickWorker/sany.out, a single line longer than one Read can show, which no review can read whole. That needs its own decision: declare it generated data in claude-code-plugins, or teach the lane about files with over-long lines.publish-review.test.cjs. The classification lives in the workflow's full-diff step, so its test is inpr-review-cli.test.cjs.publish-review.test.cjsgets the coverage-rule test.pr-review-cli.yml@main(pr-review-hosted.yml:338,pr-review-security-hosted.yml:342), so this fix reaches it at merge. A release cut withrelease-tag.yml(manualworkflow_dispatch) is a changelog marker only, and no pin moves unless a caller is moved to a SHA.Behavior change: under
REVIEW_READS_CHECK_MODE=enforce, a text lockfile now needs read evidence for its whole section, where its header lines were enough before. A large lockfile can therefore make a reviewpartial. The existing remedy is the consumer'sgenerated-datalist, read at the merge base, which leaves a file out of the review and names it "not reviewed". The same list fitssany.out.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01MWmASMXyUAaNx5GqGM3h6c