feat(web): collapse large git diffs by default to make chat more readable#4409
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ 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.
ApprovabilityVerdict: 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. |

What changed
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
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.tsvp run --filter @t3tools/web typecheckvp lintandvp fmt --checkNote
Collapse large git diffs in chat to improve readability
ChangedFilesCard, controlled by newexpanded,showCompactPreview, andonExpandedChangeprops; a chevron button in the header toggles between states.MessagesTimelinenow auto-expands changed-file sections only for the latest turn and only when under configurable file/line limits (via newshouldAutoExpandChangedFilesinchangedFilesPresentation.ts); older turns render collapsed.uiStateStoreis now versioned (THREAD_CHANGED_FILES_EXPANSION_VERSION = 1) and stores explicittrue/falseper turn; legacy unversioned state is discarded on load.DiffStatLabelgainsrole="group"and an aggregatedaria-labelfor screen readers, with visual tokens markedaria-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.
ChangedFilesCardgains 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 witharia-expanded; folder expand/collapse and “Open diff” actions are updated and only shown when relevant.Presentation logic moves into
changedFilesPresentation.ts(shouldAutoExpandChangedFiles,summarizeChangedFileScopes,selectChangedFilePreview).MessagesTimelinedelegates toChangedFilesCardand passeslatestTurnIdvia activity context for latest-vs-older behavior.uiStateStorenow persists both expanded and collapsed choices per turn, tagged withthreadChangedFilesExpansionVersion: 1; legacy persisted folder-only collapse state is ignored on load.DiffStatLabeladds a screen-readeraria-labelon the stat group with decorative+/-spans markedaria-hidden.Reviewed by Cursor Bugbot for commit d7abda3. Bugbot is set up for automated code reviews on this repo. Configure here.