Skip to content

feat(web): file headers with state chips, a collapse chevron, and copy path - #1334

Merged
benvinegar merged 2 commits into
mainfrom
claude/web-ui-06-file-headers
Nov 17, 2026
Merged

benvinegar merged 2 commits into
mainfrom
claude/web-ui-06-file-headers

Conversation

@benvinegar

@benvinegar benvinegar commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Problem

In the browser review stream a file header is a path, +A −D, and a Viewed checkbox. A rename with no content change, a binary file, and a too-large file all print +0 −0 and then spend a body row on a sentence. A viewed file leaves a "Viewed · show changes" row behind, and only viewed files can be collapsed.

Approach

  • Path. The directory dims and the basename is semibold. Renames keep today's old → new order, with the old name dimmed and an arrow icon. The path's text and a copied selection are unchanged (old -> new included), as is section[aria-label].
  • State chips. web/format/fileHeader.ts builds the chip from what the review document already says (changeKind, flags.untracked, the shared ReviewEmptyDiffReason): new, deleted, untracked, "renamed, no content changes", binary, too large, empty. Nothing is re-derived in the renderer. Zero line stats are hidden rather than printed.
  • Header-only rows. Rename-only, empty, and binary-without-preview files have no body row and reserve no body height. A too-large file keeps one row saying why.
  • Collapse chevron. The per-tab, presentation-only collapse that viewed files already had gains a folded set, so any file can be collapsed. A hunk reveal, deep link, or composer opens a folded file through the same path that opens a viewed one. Marking or clearing viewed resets the fold. The "Viewed · show changes" row is gone; the chevron (aria-expanded) replaces it. No shared state.
  • Viewed control. Still a real checkbox, inside a bordered label; checked uses the theme's added color family, not the accent. The selected file's header shows the shortcut for toggling viewed, read from the page's keymap for hunk.web.toggleViewed; no chord, no hint.
  • Copy path. An icon button revealed on header hover or keyboard focus copies the file's path (the new path for a rename), with the same Copied / Copy failed feedback as the toolbar's copy link.
  • Diff / Rendered on Markdown files are icon segments with the same roles, test ids, and names.

No binding or command table is touched, and no key label is written as a literal.

Non-goals and known gaps

  • No "Load diff anyway" for a too-large file: the page has no path to load one.
  • The binary chip can show byte sizes, but the resource catalog only knows a size once the resource has been read, so it usually says just "binary".
  • A binary file named like an image keeps its chevron; if its bytes turn out not to be an image, its body is empty.
  • "Open in editor" (host-only) and file-level notes (notes are hunk-targeted) are not offered.

Tests

  • Unit: fileHeader.test.ts; useViewedFiles tests for folding.
  • New e2e in review-stream: chips and header-only rows, folding an unviewed file and opening it with hunk navigation, copy path through the clipboard. In review-viewed: the key hint appears only on the selected header and equals the chord the command palette shows for the command; the checked style.
  • .file-collapsed selectors became .file-collapse[aria-expanded="false"] across the suite.
  • review-interactive "shares the filter and note visibility with a second page" pressed a a second time as soon as the other page reflected the first press; the acting page's own copy can lag by tens of milliseconds, so the second press could resend "hide". It failed consistently with this change and passes on the base. The test now also waits for the acting page before the second press. In-page toggle-to-repaint time measured the same in both builds (10–50 ms); why the ordering shifted is not understood.
  • bun run typecheck, bun run lint, bun run format:check, bun run deps:check: pass.
  • bun test packages/hunk/src/web: 278 pass, 0 fail.
  • bun run test:web: 124 passed, 7 skipped (the opt-in capture specs), 0 failed, run after the last edit.

Checked in github-dark-default and a light theme at 1440px and 800px across modified, new, deleted, renamed, rename-only, binary, too-large, Markdown, image, viewed, and changed-since-viewed files. Platform: macOS only.

A second commit renames the old-path span's class to file-path-previous: the source-boundary gate scans for from "…", and a class name ending in from before a quote matched it. bun test scripts/quality passes.

Stack

6 of 9. Each PR is based on the one above it in this table and contains only its own change.

# PR Change Base
1 modem-dev/hunk#1329 Accent only for selection and focus main
2 modem-dev/hunk#1330 One-row toolbar, icon controls, View menu #1329
3 modem-dev/hunk#1331 Digit grouping, palette sections, one gap row, icons #1330
4 modem-dev/hunk#1332 Quieter minimap #1331
5 modem-dev/hunk#1333 Note threads with authors and icon actions #1332
6 modem-dev/hunk#1334 ← this PR File headers: state chips, collapse, copy path #1333
7 modem-dev/hunk#1335 Sidebar review state #1334
8 modem-dev/hunk#1336 Summary strip; side panel starts closed #1335
9 modem-dev/hunk#1337 Review bar: progress, next unviewed, key hints, copy notes #1336

Merge order: 1 to 9, from the top of the table. After a PR merges, the next one's base becomes main (GitHub retargets it when the merged branch is deleted; otherwise change the base by hand) and its diff still shows only its own change.

This PR description was generated by Claude Code using Claude Fable 5.2

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect the browser review stream, not shared review-state behavior.

The PR appears safe to merge with these non-blocking display issues.

Findings

  1. P2 Rendered Markdown cannot fold ▶
  2. P2 Empty files keep stale space ▶
Fix with agent prompt
### Issue 1
packages/hunk/src/web/stream/FileSection.tsx:228-233
**Rendered Markdown cannot fold.** A rename-only Markdown file can still offer and show its full rendered document. But `fileHasBody` returns false for that file, so this check removes its collapse chevron even while the document is visible. Include the rendered preview when deciding whether the file has a body, and update that decision when its view changes.

### Issue 2
packages/hunk/src/web/stream/FileSection.tsx:405
**Empty files keep stale space.** These bodies can now shrink to zero, but `ReviewStream` only saves heights greater than zero. For example, render a rename-only Markdown file, switch back to Diff, then scroll away. The old preview height stays cached and gets applied when the file leaves the mounted window, leaving a large blank area under its header. Save zero heights for mounted bodies or clear their old measurements when they become empty.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Updates browser file headers with state chips, copy-path buttons, and controls for folding any file.

  • File headers identify each change and skip empty body rows.
  • Readers can fold any file from its header.
  • Readers can copy a file path from its header.
  • The selected file shows the Viewed shortcut beside its checkbox.
  • Markdown view choices use labeled icon buttons.

Two non-blocking issues remain around Markdown previews and empty-body height tracking.

Reviews (1) · Last reviewed commit: "feat(web): file headers with state chips..." · Reviewed by Greptile

Comment on lines +228 to +233
// A file with rows to draw can fold; a header-only row has nothing under it to hide.
const hasBody = plan ? fileHasBody(plan) : emptyReason === undefined;

return (
<header className="file-header" data-file-header={fileKey}>
{viewed && hasBody ? (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Rendered Markdown cannot fold. A rename-only Markdown file can still offer and show its full rendered document. But fileHasBody returns false for that file, so this check removes its collapse chevron even while the document is visible. Include the rendered preview when deciding whether the file has a body, and update that decision when its view changes.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/hunk/src/web/stream/FileSection.tsx
Line: 228-233

Comment:
**Rendered Markdown cannot fold.** A rename-only Markdown file can still offer and show its full rendered document. But `fileHasBody` returns false for that file, so this check removes its collapse chevron even while the document is visible. Include the rendered preview when deciding whether the file has a body, and update that decision when its view changes.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

) : mounted ? (
) : plan.emptyReason === "too-large" ? (
<p className="file-placeholder">{TOO_LARGE_MESSAGE}</p>
) : plan.emptyReason ? null : mounted ? (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Empty files keep stale space. These bodies can now shrink to zero, but ReviewStream only saves heights greater than zero. For example, render a rename-only Markdown file, switch back to Diff, then scroll away. The old preview height stays cached and gets applied when the file leaves the mounted window, leaving a large blank area under its header. Save zero heights for mounted bodies or clear their old measurements when they become empty.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/hunk/src/web/stream/FileSection.tsx
Line: 405

Comment:
**Empty files keep stale space.** These bodies can now shrink to zero, but `ReviewStream` only saves heights greater than zero. For example, render a rename-only Markdown file, switch back to Diff, then scroll away. The old preview height stays cached and gets applied when the file leaves the mounted window, leaving a large blank area under its header. Save zero heights for mounted bodies or clear their old measurements when they become empty.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

benvinegar and others added 2 commits November 17, 2026 10:38
…y path

A file header in the browser review stream now dims the directory and
bolds the file name, states what kind of change it is in a chip (new,
deleted, renamed with no content changes, binary, too large) instead of
printing "+0 −0" and a sentence row, and gains a chevron that collapses
any file, a copy-path button, and a button-like Viewed control whose
shortcut hint comes from the keymap. Files with nothing to draw become
header-only rows.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t right

The source-boundary gate scans for `from "…"` to find module specifiers,
and a class name ending in `from` followed by a quote matched it. The
old-path span is now `file-path-previous`, and the helper's field is
`previous` to match.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@benvinegar
benvinegar force-pushed the claude/web-ui-06-file-headers branch from a03d8ab to 7947fdd Compare November 17, 2026 15:38
@benvinegar
benvinegar changed the base branch from claude/web-ui-05-note-threads to main November 17, 2026 15:38
@benvinegar
benvinegar merged commit 9bc163a into main Nov 17, 2026
15 of 26 checks passed
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.

1 participant