{"record":{"id":"e12577854397a0b3","repo":"Hmbown/CodeWhale","slug":"incomplete-pr-diff-received-files-file-patches-additions","errorCode":null,"errorMessage":"Incomplete PR diff: received {files} file patches, {additions} additions and {deletions} deletions; expected {}, {} and {}. No partial review is accepted.","messagePattern":"Incomplete PR diff: received (.+?) file patches, (.+?) additions and (.+?) deletions; expected (.+?), (.+?) and (.+?)\\. No partial review is accepted\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/review_pr.rs","lineNumber":238,"sourceCode":"        {\n            has_patch = true;\n        } else if line.starts_with(\"Binary files \") {\n            if !has_full_index {\n                bail!(\n                    \"PR diff contains binary metadata without exact full object IDs; complete local Git objects are required\"\n                );\n            }\n            has_patch = true;\n        }\n    }\n    if remaining != (0, 0)\n        || !has_patch\n        || files == 0\n        || files != view.changed_files\n        || additions != view.additions\n        || deletions != view.deletions\n    {\n        bail!(\n            \"Incomplete PR diff: received {files} file patches, {additions} additions and {deletions} deletions; expected {}, {} and {}. No partial review is accepted.\",\n            view.changed_files,\n            view.additions,\n            view.deletions\n        );\n    }\n    Ok(())\n}\n\nfn diff_with(\n    number: u32,\n    repo: Option<&str>,\n    view: &GhPullRequest,\n    run: &mut impl FnMut(Program, &[String]) -> Result<String>,\n) -> Result<String> {\n    // GitHub's diff representation refuses PRs with more than 300 files.\n    // Preserve remote-only small-PR usage, but never rely on that limit for\n    // completeness: also check the metadata's changed-file count.","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/review_pr.rs#L220-L256","documentation":"The final integrity check of complete_file_set: the parsed diff must contain at least one patch, exactly view.changed_files file patches, and line counts that exactly equal the PR metadata's additions and deletions. Any mismatch means the tool received a partial or stale diff, and no partial review is ever accepted.","triggerScenarios":"diff_with collected git patches whose file/addition/deletion tallies disagree with the GhPullRequest metadata (changed_files, additions, deletions) captured by fetch_view — e.g. the diff was truncated, the PR moved between the two fetches, or counts were misparsed.","commonSituations":"PR force-pushed between view and diff fetch (counts mismatch); output truncation dropping the last files of a large diff; line-ending or whitespace flags changing countable added/removed lines vs GitHub's accounting; merge-base drift so the local diff covers different commits than GitHub reports.","solutions":["Re-run the review end to end so view metadata and git diff come from the same pinned base/head SHAs","Verify head/base SHAs still match: `gh pr view <n> --json baseRefOid,headRefOid,changedFiles,additions,deletions` vs the local `git diff --numstat` totals","Ensure the local merge-base equals GitHub's base (full clone, up-to-date origin fetch) so the diff covers the same commits"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// compare local diff tallies with PR metadata first\nlet numstat = git_numstat(base, head)?;\nlet (files, add, del) = (numstat.len(), add_total, del_total);\nassert_eq!(files, view.changed_files, \"file count mismatch\");\nassert_eq!(add, view.additions, \"additions mismatch\");\nassert_eq!(del, view.deletions, \"deletions mismatch\");","typeGuard":null,"tryCatchPattern":"match diff_with(&view) {\n    Err(e) if e.to_string().contains(\"No partial review is accepted\") => eprintln!(\"snapshot and diff out of sync; rerun review so both use the same pinned SHAs\"),\n    other => other?,\n}","preventionTips":["Fetch view metadata and diff in the same run so SHAs cannot drift","Keep the local clone up to date with origin before reviewing","Never apply whitespace/eol-normalizing flags that change countable line stats"],"tags":["git","diff","data-integrity","consistency-check"],"backgroundTag":"internal-invariant-violation","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}