Repository navigation
fix(pr-pipeline): cut a file larger than one chunk into pieces at its hunks - #18196
Conversation
… hunks split-diff.py cut no file, so a single file diff over MAX_DIFF_BYTES left pr-verify and pr-review-main with no verdict. It now cuts such a file at its hunk headers into pieces of at most the cap, each under the file's own header, and the manifest lists each piece as `piece <i> of <n>`. A file with one hunk over the cap with its header, and a diff over MAX_CHUNKS chunks, still exit 3 with nothing written. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35
…pieces The pr-verify chunk note, the final judge's manifest description, the pr-review-main chunk note and the step comments said every chunk holds whole files. They now say a file larger than one chunk is cut at its hunks into pieces in different chunks, listed as `piece <i> of <n>`, and that the no-verdict stop is a hunk over one chunk or a diff over MAX_CHUNKS. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35
The convention README said every chunk holds whole files and that a single file over 300000 bytes gets no verdict. It now names the pieces and the remaining single-hunk stop, with a changelog fragment. The pr-review-main chunk note no longer invites a finding for a hunk a piece does not hold. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35
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-security-review reviewed Security review: no security issues foundThis review covered only blocking findings, because this lane already reviewed an earlier head ( What I checked
Spend: a pull request with a single-file diff over 300 KB now runs one review or verifier run per chunk where it used to stop. This uses prepaid model usage only, so it is not a hold. critical-findings: 0 |
|
claude-review reviewed Code review: PR #18196: cut a file larger than one chunk into pieces at its hunksThis review is blocking only. The lane already reviewed an earlier head ( I read every hunk of all 11 changed files in the full diff. I also read the head copy of What I checked in
Closing issue: the PR context has no closing-issue section, only Verification: the test runs, the ruff check and the Spend (not a finding): a PR with one file over 300000 bytes now gets chunked pr-verify and pr-review-main runs instead of stopping. That means more lane runs, paid from prepaid API credit. The Loosened checks:
Verifier dropped 0 of 0 candidates. |
The suite symlinks plugins/source-control into its checkout and reads plugin.json through it, so a change to that file must select the suite (scripts/affected-tests.sh R8). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35
Refs: #18178
Summary
pr-verify and pr-review-main gave no verdict when one file's diff was larger than one chunk (300,000 bytes):
split-diff.pykept every file whole and exited 3. PR #18165 hit this with one 334 KB file.split-diff.pynow cuts such a file at its hunk headers (@@lines) into pieces of at most the chunk size. Each piece repeats the file's header (its lines before the first hunk), and no two pieces of one file share a chunk. The manifest lists each piece aschunk <k> piece <i> of <n> <status> <path>. A whole file is listed as before.Fix
.github/scripts/pr-review-main/split-diff.py:pieces_ofpacks a file's hunks into pieces under its header. A piece counts as one file for the optional file cap. MAX_CHUNKS stays the cost guard: a diff that needs more chunks, pieces included, still exits 3 with nothing written.A file with one hunk that is over the cap together with its header still exits 3, with "a file has a hunk larger than one chunk". The issue asks for such a hunk to be cut at line boundaries. That is not done here, for two reasons:
generate-review-chunks/split.shcalls this samesplit-diff.py. It cuts oversize files at their hunks itself, and relies on this refusal for an oversize hunk ("the split refuses it and the review stays partial"). Cutting at lines would hand itscompose.cjspieces it does not know about.@@header, so a reviewer could not place its lines.Cutting at hunks alone is enough for PR docs(upstream): re-audit cursor pstack drift and move the pin to 0b46ec3 #18165: its largest hunk is 290,134 bytes.
The prompts are updated so a judge cannot read a piece as a whole file:
chunk-note.mdand the final judge's manifest description inspec-prompt.mdAlso updated: the step comments, and pr-review-main's
too-largestop message.chunk-diff.sh's header no longer says an over-size file gets no verdict. It now names only a hunk over one chunk, or a diff over MAX_CHUNKS.docs/conventions/pr-pipeline/README.mddescribes the pieces and the stop that remains. Apr-pipelinechangelog fragment is added.Not changed: what the verifier trusts (resolve-pr, the trusted-text inputs, permissions). The existing final-judge path covers a cut file, because a cut file always makes more than one chunk.
Verification
node --test --test-concurrency=4overpr-review-main/workflow.test.mjs,pr-verify/chunk-diff.test.mjs,pr-verify/workflow.test.mjsandpr-verify/spec-prompt-text.test.mjs: 127 passed.chunks=2with no::error::, its pieces rebuilding the patch byte for bytepiece <i> of <n>scripts/run-ruff.sh checkonsplit-diff.py: clean.scripts/check-affected.sh: 19 passed, 3 skipped..base), so this PR's own run still uses the old splitter. Done-when item 1 is proven live after merge, when pr-verify re-runs on docs(upstream): re-audit cursor pstack drift and move the pin to 0b46ec3 #18165..githubsuite (per-machine limit; CI runs it), and cutting a single over-size hunk at line boundaries (see Remaining).Remaining
This PR delivers done-when items 2 and 3, and item 1 for every file whose largest hunk, with the file's header, fits in one chunk. #18165 is such a file.
Item 1 says: "A PR whose single file diff is larger than MAX_DIFF_BYTES (and within MAX_CHUNKS chunks) gets a pr-verify verdict." It is not delivered for a file whose one hunk is over MAX_DIFF_BYTES with its header. That case still gets no verdict.
Basis: the issue's Fix says "A single hunk larger than a chunk is cut at line boundaries." Cutting there needs a follow-up in ci-workflows.
.github/actions/generate-review-chunks/split.shcalls this samesplit-diff.pyand relies on its refusal of an oversize hunk ("A file with a hunk over the budget with its header is not cut, so the split refuses it and the review stays partial"). Itsbuild-review-prompt/compose.cjslabels pieces only from thesliced.txtlist thatsplit.shwrites. The orchestrator chose to keep the refusal here.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35