Skip to content

feat(web): collapse large git diffs by default to make chat more readable#4409

Merged
t3dotgg merged 4 commits into
mainfrom
t3code/collapse-large-diffs
Jul 24, 2026
Merged

feat(web): collapse large git diffs by default to make chat more readable#4409
t3dotgg merged 4 commits into
mainfrom
t3code/collapse-large-diffs

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Jul 23, 2026

Copy link
Copy Markdown
Member

What changed

  • adaptively expand only small latest-turn change summaries
  • show a compact scope preview with representative files for large latest-turn changes
  • collapse older changed-file summaries to a one-line receipt by default
  • persist explicit expanded and collapsed choices across reloads
  • add labeled disclosure controls and non-color-only diff-stat accessibility text

Why

Large changed-file trees dominate the conversation and make completed work difficult to scan. The inline surface should summarize scope first and leave the full tree and diff available on demand.

Behavior

  • latest changes with at most 5 files and 200 changed lines expand automatically
  • larger latest changes show top-level scope counts and three files selected across distinct scopes
  • older turns start collapsed
  • expanding a large receipt initially keeps folders collapsed to avoid another oversized view

Validation

  • vp test run apps/web/src/components/chat/ChangedFilesTree.test.tsx apps/web/src/components/chat/changedFilesPresentation.test.ts apps/web/src/uiStateStore.test.ts
  • vp run --filter @t3tools/web typecheck
  • targeted vp lint and vp fmt --check
  • isolated authenticated browser pass covering the latest-turn preview, older-turn collapse, tree expansion, folder reveal, and persisted state after reload

Note

Collapse large git diffs in chat to improve readability

  • Adds collapsed, preview, and expanded display modes to ChangedFilesCard, controlled by new expanded, showCompactPreview, and onExpandedChange props; a chevron button in the header toggles between states.
  • When collapsed with preview enabled, the card shows scope summary badges and a representative set of changed files, plus a 'Show all N files' button to expand.
  • MessagesTimeline now auto-expands changed-file sections only for the latest turn and only when under configurable file/line limits (via new shouldAutoExpandChangedFiles in changedFilesPresentation.ts); older turns render collapsed.
  • Persisted expansion state in uiStateStore is now versioned (THREAD_CHANGED_FILES_EXPANSION_VERSION = 1) and stores explicit true/false per turn; legacy unversioned state is discarded on load.
  • DiffStatLabel gains role="group" and an aggregated aria-label for screen readers, with visual tokens marked aria-hidden.

Macroscope summarized d7abda3.


Note

Low Risk
Chat UI and local UI-state persistence only; no auth, API, or data-layer changes. Versioned migration may reset prior collapse preferences once.

Overview
Changed-files blocks in the chat timeline are now collapsible instead of always showing the full tree, so large diffs don’t dominate the thread.

ChangedFilesCard gains three UI modes (expanded, preview, collapsed) driven by parent props. The latest turn auto-expands only when there are ≤5 files and ≤200 changed lines; otherwise it shows a compact preview (top-level scope counts plus up to three representative files, each opening that file’s diff). Older turns default to a one-line receipt with no file list. Disclosure is a clickable header with aria-expanded; folder expand/collapse and “Open diff” actions are updated and only shown when relevant.

Presentation logic moves into changedFilesPresentation.ts (shouldAutoExpandChangedFiles, summarizeChangedFileScopes, selectChangedFilePreview). MessagesTimeline delegates to ChangedFilesCard and passes latestTurnId via activity context for latest-vs-older behavior.

uiStateStore now persists both expanded and collapsed choices per turn, tagged with threadChangedFilesExpansionVersion: 1; legacy persisted folder-only collapse state is ignored on load. DiffStatLabel adds a screen-reader aria-label on the stat group with decorative +/- spans marked aria-hidden.

Reviewed by Cursor Bugbot for commit d7abda3. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c1d3a38f-047c-42e7-a7c1-975357e90129

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/collapse-large-diffs

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 23, 2026
@t3dotgg t3dotgg changed the title Collapse large changed-file summaries wip: collapse large git diffs to make chat more readable Jul 23, 2026
@t3dotgg
t3dotgg marked this pull request as ready for review July 23, 2026 23:43

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cb78d9b. Configure here.

Comment thread apps/web/src/uiStateStore.ts
@macroscopeapp

macroscopeapp Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

UI-only changes adding collapse/expand functionality for changed files display in chat. Self-contained presentation logic with tests, minor accessibility improvements, and UI state persistence updates. No backend or security implications.

You can customize Macroscope's approvability policy. Learn more.

Comment thread apps/web/src/components/chat/DiffStatLabel.tsx
@t3dotgg t3dotgg changed the title wip: collapse large git diffs to make chat more readable feat(web): collapse large git diffs by default to make chat more readable Jul 24, 2026
@t3dotgg
t3dotgg merged commit 51672b6 into main Jul 24, 2026
16 checks passed
@t3dotgg
t3dotgg deleted the t3code/collapse-large-diffs branch July 24, 2026 01:06
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…4309pingdotgg#4488) (#187)

* fix(client-runtime): keep a warm thread un-settled despite a merged/closed PR (pingdotgg#4309)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 193e3c6)

* Fix composer context strip alignment and glass shell (pingdotgg#4404)

(cherry picked from commit 6ef7aa8)

* Polish iOS git progress overlay with glass effects (pingdotgg#4387)

(cherry picked from commit ce467da)

* Improve composer glass fallbacks (pingdotgg#4406)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit 67a7b1a)

* feat(web): collapse large git diffs by default to make chat more readable (pingdotgg#4409)

(cherry picked from commit 51672b6)

* Stop new threads inheriting checkout/branch from viewed thread (pingdotgg#4411)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 2f41c07)

* fix: tone down branch-mismatch banner (pingdotgg#4416)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit fc3f78f)

* fix: Claude Code skills discoverable for the composer $ picker (pingdotgg#4414)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 6b9a598)

* fix(web): keep settled threads reachable when opened directly (pingdotgg#4413)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit bb38c33)

* feat(sidebar-v2): thread snoozing (pingdotgg#4311)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: maria <maria@kuuro.net>
(cherry picked from commit 202e560)

* Upgrade Clerk packages and Expo integration (pingdotgg#4440)

(cherry picked from commit 5d17354)

Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>

* Increase light-mode contrast for user message bubbles (pingdotgg#4441)

(cherry picked from commit 15e875a)

* Restore model picker layout and retain iterative test state (pingdotgg#4450)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit f7cc776)

* Color settled PR labels on hover (pingdotgg#4451)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit a7ee309)

* [codex] Fix glass hover compositing artifacts (pingdotgg#4446)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit ece0508)

* Add Claude Opus 5 model (pingdotgg#4472)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Theo Browne <me@t3.gg>
(cherry picked from commit 41a430a)

* feat(web): add collapse-all toggle to diff panel (pingdotgg#4475)

(cherry picked from commit 38cfc25)

* feat(web): show fast mode as a bolt instead of a "Normal" label (pingdotgg#4488)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 5719e8a)

* fix(sync): preserve Droid medium-access with Auto runtime mode

Keep fork-only medium-access in RuntimeMode alongside upstream Auto.
Update presentation maps and drop obsolete provider kind from slug helper.

Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>

* fix(sync): restore fork release and runtime-mode adaptations

Keep WSL node-pty on bullseye glibc, pin releases to the fork, and stop
hard-requiring upstream relay/npm publish. Scope Auto vs Medium access by
provider, normalize carried modes on new threads, and fix Claude/Droid
type regressions from the restack.

Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>

* fix(sync): refresh lockfile after Clerk upgrade restack

Align patchedDependencies hashes (react-native-screens) and importer
entries with the current workspace patches so frozen CI installs succeed.

Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>

---------

Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: maria <maria@kuuro.net>
Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>
Co-authored-by: tomlit <tomlit@gmail.com>
Co-authored-by: jan <hi@4bs3nt.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant