Skip to content

fix(review): prevent partial diffs from crashing code review - #2361

Merged
backnotprop merged 1 commit into
backnotprop:mainfrom
utpalsinghdev:fix/2264-partial-diff-safe
Oct 31, 2026
Merged

backnotprop merged 1 commit into
backnotprop:mainfrom
utpalsinghdev:fix/2264-partial-diff-safe

Conversation

@utpalsinghdev

Copy link
Copy Markdown
Contributor

Summary

Code review can crash with FileDiff: loadDiffFiles is required to load full files for a partial diff when full file context is enabled.

Plannotator loads full contents through /api/file-content and updates the diff itself. While that request is pending, or when contents are unavailable or rejected by the existing consistency check, the diff remains partial.

Patch @pierre/diffs 1.5.2 to leave that partial diff readable when no loadDiffFiles callback is configured. Configured loaders keep their existing behavior, and editing still requires complete contents.

Closes #2264.

Verification

  • Isolated diff-renderer DOM test group: 47 tests passed.
  • bun run typecheck: passed.
  • bun run check:release-version: passed.
  • bun test scripts/dom-test-allowlist.test.ts scripts/ci-test-lanes.test.ts: 8 tests passed.
  • bun run --cwd apps/review build: passed.
  • Checked both review views in Brave on macOS with missing, stale, and matching file contents. Confirmed full context and manual expansion work when matching contents are available.
  • bun run --cwd packages/ui smoke:package fails with published core exports.0 must be a string. Reproduced with unchanged base source: the registry returns an array of exports, while the smoke script expects an object.
  • Full test suite was not run.

Docs

Documented the compatibility patch and its upgrade requirements in docs/agent-guides/project-and-development.md.

@paxsonsa

Copy link
Copy Markdown

I have not checked but did you attempt to update to 1.6.2 before doing the patch?

@utpalsinghdev

Copy link
Copy Markdown
Contributor Author

@paxsonsa I hadn’t tried 1.6.2 before opening this PR, but I’ve now reproduced the same error with it in Brave. With full file context enabled and full contents unavailable, the page loads but the diff doesn’t render. It still throws FileDiff: loadDiffFiles is required to load full files for a partial diff.

This was a small, one-file reproduction, so upgrading to 1.6.2 alone doesn’t fix that case.

@backnotprop backnotprop added the ci:full Run the heavy CI tier on this PR (added by the merge script) label Oct 31, 2026
@backnotprop
backnotprop merged commit d87f4bc into backnotprop:main Oct 31, 2026
84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Run the heavy CI tier on this PR (added by the merge script)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Code review fails with "FileDiff: loadDiffFiles is required" when expandUnchanged is on (@pierre/diffs 1.5.2)

3 participants