Skip to content

Show before/after image previews in the Git pane - #1615

Merged
currentbits merged 8 commits into
mainfrom
coder/p2-show-before-and-after-image-changes-i-4d1a02
Oct 13, 2026
Merged

currentbits merged 8 commits into
mainfrom
coder/p2-show-before-and-after-image-changes-i-4d1a02

Conversation

@currentbits

Copy link
Copy Markdown
Owner

What

When the selected file in the Git pane is a raster image (PNG/APNG, JPEG, GIF, WebP, BMP), the pane now shows the before and after images side by side instead of the text diff. You can view them at Fit, 100% or 200%. Closes #1192.

  • New IPC git:imageDiff (electron/worktrees-changes.js): reads both sides from the same refs diff() compares for each scope:

    • uncommitted: HEAD vs the working tree
    • branch: merge base vs the working tree
    • turn: checkpoint vs checkpoint

    It is read-only and uses only git cat-file and plain file reads. Each side comes back with a label (for example HEAD 1a2b3c4 or Working tree), its byte size, its dimensions and a data: URL.

  • Header-only sizing (imageInfo): format and dimensions are parsed from the file header without decoding the image. SVG is left out on purpose because it is text and keeps its text diff.

  • Limits: each side is capped at 8 MB transferred and 25M pixels. The blob size is checked with cat-file -s before the bytes are read, so an oversized blob is never loaded. Working-tree reads reject symlinks and any path that resolves outside the worktree, and the size is checked again after reading in case the agent was still writing the file. Remote projects get an error instead.

  • Renames: diff() now keeps oldPath for -> entries in porcelain status, so the before side of a rename is read from the old path.

  • gitExecThrowAsync gains a buffer option that returns raw stdout bytes for blob reads.

  • UI: the new ImageDiff.tsx component is wired into ChangesPanel through onFetchImageDiff. It re-fetches on each diff reload (Refresh, commits) and ignores stale responses. An added or deleted image shows "Not in …" on the missing side. Oversized or unsupported files show a note instead of a preview.

  • The new type, channel and API are added to shared/ipc.ts, the IPC channel list, preload, web scopes, useCoder/useCoderWorkspace, and the dev/fake coder shims.

Why

Before this change, a changed image showed up as a useless binary diff, so you couldn't review image edits from an agent inside the Git pane.

Tests

  • electron/test/worktrees-image-diff.test.js: header parsing, scope refs, renames, limits and the symlink/escape guards.
  • test/imageDiff.test.tsx: renderer behaviour of the image view.

🤖 Generated with Claude Code

Willem and others added 6 commits October 12, 2026 12:06
… Automations: natural-language authoring (describe it in chat
… P2: Replay-fixture provider harness: recorded CLI output thr
Selecting a changed PNG/JPEG/GIF/WebP/BMP in the Git pane shows the old
and new image side by side, read from the exact refs the selected scope
diffs (HEAD, merge base or turn checkpoint vs working tree/checkpoint).
Each side carries its revision label, dimensions and file size, over a
checkerboard with Fit/100%/200% zoom; a missing side says added/deleted.

The host reads via cat-file and plain file reads (never the index),
sizes images from headers, and caps transfers at 8 MB and 25 MP with a
note fallback. Symlinks and paths outside the tree are refused. Staged
renames carry oldPath. SVG is deferred and keeps its text diff.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T20:20:12.770925Z f4aa62b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4aa62b1c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 223 to +225
if (filePath.includes(" -> ")) {
filePath = filePath.split(" -> ").pop() || filePath;
const [from, ...rest] = filePath.split(" -> ");
oldPath = from.replace(/^"|"$/g, "");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Parse the quoted rename delimiter before extracting oldPath

When a staged rename's original filename contains the literal -> sequence, porcelain can return a line such as R "old -> icon.png" -> logo.png; splitting on every occurrence records oldPath as old rather than old -> icon.png. Selecting the renamed image then asks cat-file for a nonexistent before-side path and incorrectly displays it as missing, so the parser needs to identify the rename separator outside the quoted filename.

Useful? React with 👍 / 👎.

Willem and others added 2 commits October 12, 2026 22:28
automation_create now echoes the #1604 trigger fields (team, status,
org, project, environment) and stored threads carry prLinks: []. Both
tests fail identically on main; they predate #1192.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A cold dynamic import() could outlast the three-tick flush on loaded CI
runners (ubuntu and windows, runs 38304474453), so the iframe assertion
saw nothing. Importing the module up front lets React.lazy resolve from
the module cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@currentbits
currentbits merged commit ecd8bb9 into main Oct 13, 2026
6 checks passed
currentbits pushed a commit that referenced this pull request Oct 13, 2026
…indows CI

node --test applies --test-timeout to each file as well as each test.
On windows-latest several renderer files now take 17-20s, so whichever
crosses 20s fails as testTimeoutFailure (appWiring on main #1615,
threadView here) while running in under 3s locally. 60s still catches
a wedged file well inside the 25-minute job limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
currentbits pushed a commit that referenced this pull request Oct 13, 2026
…-0c31dd

Replay harness files take main's #1614 version. htmlFence takes main's
warm-import fix (#1615); threadView uses the same warm import instead of
polling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
currentbits added a commit that referenced this pull request Oct 13, 2026
* Merge worktree coder/automations-natural-language-authoring-d-4d26e0: Automations: natural-language authoring (describe it in chat

* Merge worktree coder/p2-replay-fixture-provider-harness-recor-9dbd6f: P2: Replay-fixture provider harness: recorded CLI output thr

* coder-checkpoint: turn 70

Solenta-Message-Id: 306b13e4-79c9-4f4d-bc27-923754043258

* Fix main's red CI: preload HtmlPage in tests, refresh two stale fixtures

HtmlPage used plain React.lazy, which mount() never preloads, so on a
cold CI runner the tool.html card suspended past three flushes and its
late resolve tripped the next test's act() gate. lazyNamed puts it in
the preload set like every other lazy view.

automation-create-mcp and store round-trip expectations predate the
Linear/Sentry trigger fields (#1588) and prLinks normalization.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Raise renderer --test-timeout to 60s: it bounds whole files on slow Windows CI

node --test applies --test-timeout to each file as well as each test.
On windows-latest several renderer files now take 17-20s, so whichever
crosses 20s fails as testTimeoutFailure (appWiring on main #1615,
threadView here) while running in under 3s locally. 60s still catches
a wedged file well inside the 25-minute job limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Willem <[email protected]>
Co-authored-by: Solenta <solenta@local>
Co-authored-by: Willem <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
currentbits pushed a commit that referenced this pull request Oct 19, 2026
…indows CI

node --test applies --test-timeout to each file as well as each test.
On windows-latest several renderer files now take 17-20s, so whichever
crosses 20s fails as testTimeoutFailure (appWiring on main #1615,
threadView here) while running in under 3s locally. 60s still catches
a wedged file well inside the 25-minute job limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
currentbits pushed a commit that referenced this pull request Oct 19, 2026
…-0c31dd

Replay harness files take main's #1614 version. htmlFence takes main's
warm-import fix (#1615); threadView uses the same warm import instead of
polling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P2: Show before-and-after image changes in Git review

1 participant