Skip to content

Phase 8: render "Binary file — not displayable" placeholder for binary diffs #810

@srid

Description

@srid

Why

Phase 8 of #514 lists "binary file diffs" as a robustness gap. The original concrete failure mode (UTF-8-munge of binary content in the diff viewer) was incidentally closed by #708 when it deleted readHeadContent / readWorkingContent and switched to passing git diff output verbatim to Pierre. Today binary files don't crash anything — git diff emits Binary files a/foo and b/foo differ with no @@ hunks, the server returns { hunks: [], … }, and the client renders an empty diff pane.

That's correct behavior, but it's uninformative: an empty pane is indistinguishable from "I clicked a file with no real changes." The user has to dig into the terminal to verify the file is binary and that's why they see nothing.

What ships

A small, independent change. No coupling to #807 or to virtualization.

Server

  • packages/integrations/git/src/review.ts — in getDiff, run git diff --numstat <ref> -- <path> alongside the existing git diff call. Numstat reports -\t-\t<path> for binary files (cheap — no extra round trip if we batch with the existing git diff).
  • packages/integrations/git/src/schemas.ts — extend GitDiffOutputSchema with binary: boolean (default false). When --numstat reports -\t-\t, set binary: true on the response.
  • Streaming endpoints (git.onDiffChange from feat: Code view auto-refreshes from filesystem changes #786) inherit the new field automatically since they re-emit the same schema.

Client

  • packages/client/src/ui/PierreDiffView.tsx — when props.binary === true, short-circuit before calling Pierre and render a placeholder panel instead. Suggested copy: "Binary file — not displayable" with a sub-line showing the file's size delta from numstat if available, or just the path. Match the existing empty-state styling in the Code tab.

E2e

  • packages/tests/features/code-tab.feature — add scenarios: open a repo with a binary file change (a .png swap or a .wasm rebuild), verify the placeholder renders. Negative case: a no-op file selection still renders an empty pane (not the placeholder), so the two states stay distinguishable.

Out of scope

Acceptance

  • A binary file in the diff list renders the placeholder instead of an empty pane.
  • A no-op file selection still renders an empty pane (we don't regress the "nothing to show" case into a binary placeholder).
  • Streaming updates (feat: Code view auto-refreshes from filesystem changes #786) flip the placeholder on/off correctly when a file transitions between binary and text states.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions