Skip to content

P1: Keep later files reviewable when the Git patch exceeds the preview limit #1209

Closed

Description

@currentbits

User problem: a large first file can consume the entire Git preview budget, leaving later source files listed but impossible to review in the app.

Verified at 9fc8645: used a disposable Git repo with a 10,000-line package-lock.json rewrite plus one-line edits to src.ts and zzz-important.ts. Called the real electron/worktrees.js diff service and src/reviewItinerary.ts parsePatch.

  • Full git diff: 1,078,272 bytes, three parsed files.
  • Service response: all three files in the file list, truncated=true, exactly 100,000 patch characters.
  • Parsing the service response: only package-lock.json survives; src.ts and zzz-important.ts have no patch entry.
    All outcomes were asserted, and the fixture repo was removed. This is a real-Git/service reproduction with synthetic files; no live user data or desktop frame-rate claim.

Cause: diffOnce obtains one combined git diff HEAD patch, then slices it at PATCH_TRUNCATE=100000. File metadata is gathered separately. parsePatch can only parse surviving file headers; ChangesPanel shows No textual diff for this file when the selected path has no patch entry. A global Diff truncated note does not provide access to the missing hunks.

Smallest scope: retrieve a bounded patch for the selected file, or otherwise budget previews per file. Preserve the existing comparison base/index/worktree semantics. An oversized lockfile must not consume another file's preview budget. Keep generated and binary files explicitly identifiable and reviewable through appropriate fallback, not silently skipped. Keep IPC and rendered line counts bounded; do not solve this by removing the 100k cap or transferring the entire 32 MiB command buffer.

Acceptance:

  • In the three-file fixture, selecting either source file shows its actual hunks regardless of the lockfile size.
  • The oversized file has a truthful named truncation state and an explicit way to inspect more or open externally.
  • Metadata-only/binary files, unavailable patches and truncated text have distinct explanations.
  • A large generated change does not require a comparably large IPC payload or unbounded DOM mount to review a tiny source edit.
  • Thread changes and changed comparison revisions cannot apply a stale per-file response to the active view.
  • Staging, revert and comment anchors preserve their file/revision identity.

Dedup: distinct from #1192 image diffs, #148 per-turn comparisons, #278 interdiff, #432 comment anchors and #402 PR-size creation caps. No matching global-patch-truncation issue found. The source-only observation that DiffLine maps all selected hunk lines is covered by the bounded-preview acceptance here; no separate renderer-performance defect is claimed.

Activity

  1. added and removed on Oct 9, 2026
  2. currentbits commented on Oct 9, 2026

    @currentbits
    OwnerAuthor

    Fixed in 0.24.0: per-file lazy patches with a per-file cap and "Show anyway" (worktrees-changes.js:38-41,189-196), so one huge file no longer hides later files. Closing in the 2026-10-09 board cleanup (#1532).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions