Repository navigation
fix(review): recover an API-omitted per-file patch from the PR .diff - #21
Conversation
GitHub omits the per-file `patch` field for a file whose diff exceeds the API's per-file limit — e.g. `charly.yml` on a manifest-scale PR (`has_patch=false`, +60/-1697). The assembler rendered `f.Patch` verbatim, so such a file became an EMPTY ```diff``` block: the reviewer read a real change as "no change", the validator BLOCKed the PR as "core diff unverifiable", and the auto-close policy then closed it (opencharly/charly#625). Recover it: files() now fetches the PR's raw unified diff (the `.diff` media type, exposed as ghkit.Client.PRDiff, NOT subject to the per-file omission) whenever a changed file has NoPatch with non-zero +/- , and fills each omitted patch via splitUnifiedDiff (keyed by the new-side path). render() no longer emits a silent empty diff block — a patch still empty after recovery is marked in-line so it can never be mistaken for "unchanged". R10 (live, GH_TOKEN present): newGHClient().files(ctx, "opencharly/charly", 625) recovers charly.yml's patch — 113907 bytes, NoPatch=false (was empty). gofmt clean; go build ./... / go vet ./... / go test ./... green. Closes #20 Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: charly-or-sdk Go (the Security screen: PASS — no secrets/exfiltration, no new egress (reuses the existing ghkit client), no guardrail weakening, no embedded instructions. Placement is Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…ed-patch marker Round-2 findings from the review of #21: - parseGitDiffPath asserted it handled git's quoted header form but did not: git emits `diff --git "a/<p>" "b/<p>"` under core.quotePath, where the literal ' b/' is absent, so Index returned -1 and the section keyed under "" — the recovery lookup then silently missed. Now parses the "b/<p>" token (unquoting \\, \", \t, \n, \r and octal \NNN) and strips the b/ prefix, matching the API's filename. Covered by a quoted-path test. - render()'s omitted-patch marker hard-coded "additions+deletions are non-zero, so this file DID change"; a pure rename/binary reports no hunks AND 0/0, so the marker now branches and never asserts changed lines for 0/0. Covered in render_test.go. gofmt clean; go build/vet/test green (incl. the live charly#625 recovery).
Review — BLOCKHead SHA: Change class: charly-or-sdk Go (the Security screen: PASS — no secrets/exfiltration, no new egress (reuses the existing ghkit client), no guardrail weakening, no embedded instructions. Placement is Comment intake
Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: charly-or-sdk Go (the Comment intake
Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Change class: charly-or-sdk Go (the Security screen: PASS — no secrets/exfiltration, no new egress (reuses the existing ghkit client), no guardrail weakening, no supply-chain or validator-spec edits, no embedded instructions. Comment intake:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…recovery (opencharly/plugin-review#21) (#642) Co-authored-by: Andreas Trawoeger <[email protected]>
Summary of changes
The review assembler silently dropped a changed file whose per-file
patchGitHub omits, rendering it as an emptydiffblock — so a manifest-scale file (e.g.charly.yml) was reviewed as "no change", the validator BLOCKed the PR as "core diff unverifiable", and the auto-close policy then closed it (opencharly/charly#625). This recovers such patches from the PR's raw.diffand never renders a silent empty block again.candy/plugin-review/ghclient.go—files()now fetches the PR's raw unified diff (ghkit.Client.PRDiff, the.diffmedia type, which is NOT subject to the per-file omission) when any file hasNoPatchwith non-zero ±, and fills each omitted patch viasplitUnifiedDiff. Recovery failure is non-fatal (the renderer marks the file).candy/plugin-review/diffsplit.go(new) —splitUnifiedDiffsplits a whole-PR diff into per-file patches keyed by the new-side path;parseGitDiffPathhandles BOTH header forms git emits — the plaina/<p> b/<p>and the C-quoted"a/<p>" "b/<p>"(undercore.quotePathfor paths with spaces/tabs/quotes/non-ASCII), viaunquoteGitPath(reverses\\,\",\t,\n,\rand octal\NNN) then strips theb/prefix so the key equals the API'sfilename.candy/plugin-review/context.go—ChangedFilegainsNoPatch;render()never emits an empty diff block. Its marker branches on the counts: a real (+/-) change whose patch could not be recovered says so; a 0/0 rename/binary is described as "no textual patch … rename or binary change" and is never asserted to have changed lines.candy/plugin-review/render_test.go—TestRenderMarksOmittedPatchExplicitlycovers both the +60/-1697 and the 0/0 case.candy/plugin-review/diffsplit_test.go(new) — split, rename-key, C-quoted-path, andunquoteGitPathescape tests.candy/plugin-review/ghclient_live_test.go(new) — live-guarded proof against the realcharly#625.Change class
charly-or-sdk Go (the
plugin-reviewcandy's Go).Closes / relates to: Closes #20. Relates to opencharly/charly#625 (the manifest PR this defect made unreviewable).
Breaking change + rollback: none — an internal assembler improvement; no exported symbol, verb, or config changes. Rollback: revert this PR.
How R10-tested — exact gate, commands, and pasted output
plugin-reviewcandy. The changed path is additionally exercised by a live-guarded test against the real GitHub API.files()executed against the realopencharly/charly#625and recovered the API-omittedcharly.ymlpatch.1. Fresh-rebuild gate output (
gofmt+ build/vet/test):2. Each changed code path executing (the live recovery against the real PR):
(Without a credential the same test SKIPs cleanly — never a mock of the API.)
3. Docs-only evidence: N/A — code change.
Attribution tier
fully tested and validated — the changed
files()path executed against the real GitHub API on the exact PR (charly#625) this defect blocked, at zero warnings.Harness rulebook compliance — state HOW each is satisfied (or
N/A — <reason>)/charly-internals:git-workflow(PR-only landing) and/charly-check:check(gate by change class); the change is in theplugin-reviewcandy, governed by the umbrella rulebook.patchomission (has_patch=false) + a verbatim empty render; fixed at the source. Round-2 review findings (quoted-path parser, 0/0 marker) fixed with tests. Build/vet/test/gofmt clean.charly#625is unblocked by this fix; no issue parked.splitUnifiedDiff) and one recovery site (files())..diffmedia type rather than splitting the manifest or hand-feeding the diff; no retry/sleep.git grep -n 'f.Patch' -- candy/plugin-review:context.go:136), which now branches on empty (context.go:123);ghclient.go:96is the recovery carrier, and the remaining hits are this PR's own tests. No legacy empty-render path remains.git statusinspected before commit; no force-push.TestFilesRecoversOmittedPatchLive) is the runtime proof; no bed exists for this candy.PRDiff); built from this tree..diffcarries the omitted file) proven live against the real PR. ADE/SDD — N/A.gofmt -l .empty;go vetclean;go test ./...green.CHANGELOG/<CalVer>.mdat merge time (this repo's convention).Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)