feat(desktop,host-service): add native streaming PR diff viewer built on @pierre/diffs 1.3
Summary
First step of the diff-viewer rewrite: a diffshub-style native Files changed tab on the PR detail page (tasks/pr/$prNumber), built from scratch on @pierre/diffs 1.3.1 with Pierre's diffshub app pipeline ported nearly verbatim. This is the foundation the workspace DiffPane will be ported onto next; no existing diff code paths were modified.
How it works
- Streaming end to end — host-service gains
GET /pull-requests/diff, which pipesgh pr diffstdout straight into the HTTP response. The renderer splits the stream ondiff --gitboundaries (port of diffshub's incremental parser), parses each file on an 8ms work budget, publishes a viewport-sized first batch, then appends viaviewer.addItems()— files paint while the patch is still downloading. - Virtualized rendering — one
CodeViewfor the whole changeset; only rows near the viewport are mounted, highlighting runs in the existing app-wide shiki worker pool. - On-demand context expansion — new
pullRequests.getDiffFilesprocedure resolves the PR's merge-base/head refs (cross-repo aware, 5-min cache) and fetches full file contents viagh api, wired into 1.3'sloadDiffFilespartial-diff hydration. - Sidebar —
@pierre/treesfile tree with git-status coloring, sticky folders, click-to-scroll (auto-expands collapsed files), plus diff stats and Collapse all / Expand all and Unified/Split toggles.
Also upgrades @pierre/diffs 1.2.12 → 1.3.1 (the Edit release); the existing workspace DiffPane compiles unchanged. The bunfig release-age exclusion is removable after 2026-08-04.
Verification (CDP, real dev stack, real PRs)
- 5-file PR: stats match GitHub exactly; context expansion hydrates and realigns hunks.
- 95-file / +2873-line PR: first files paint ~770ms after clicking the tab, stream completes ~1s, 3
<pre>surfaces mounted at any time. - Tree click, collapse-all, and split/unified verified with before/after screenshots.
Follow-ups
- Port the workspace DiffPane onto this foundation (kills the fetch-all-contents + rediff-on-every-render plumbing), then delete the legacy v1 LightDiffViewer path.
- Candidate diffshub ports: line-anchored review comments, status-filtered tree, line-selection deep links, wrap/line-number toggles.
https://claude.ai/code/session_01BpQqCmbQmBViy7rf6Gtuig
Summary by cubic
Adds a native, streaming “Files changed” tab to the PR detail page using @pierre/diffs 1.3.1 for fast, virtualized diff viewing. First files render while the patch is still downloading for a snappier experience.
-
New Features
- Streaming pipeline: host-service
GET /pull-requests/diffpipesgh pr diffstdout directly to the client. - Incremental parsing: split on
diff --git, publish a viewport-sized first batch, then append as data streams. - Virtualized
CodeViewwith worker-pool syntax highlighting. - On-demand context:
pullRequests.getDiffFilesresolves merge-base/head refs and fetches contents viagh api(5‑min cache). - Sidebar:
@pierre/treesfile tree with git-status colors, click-to-scroll, Collapse/Expand all, Unified/Split toggles, and stats. - Performance: ~770ms to first paint on a 95‑file PR; stream completes ~1s.
- Streaming pipeline: host-service
-
Dependencies
- Upgrade
@pierre/diffsfrom 1.2.12 to 1.3.1. - Add bunfig minimumReleaseAge exclusion for
@pierre/diffs(removable after 2026‑08‑04).
- Upgrade
Summary by CodeRabbit
-
New Features
- Added a Files changed tab to pull request pages.
- Added a diff viewer with split or unified layouts, file navigation, search, statistics, and collapse/expand controls.
- Added support for streamed diff loading and expanding file context.
- Added loading, empty, retryable error, and rename handling states.
-
Bug Fixes
- Improved handling of large, streamed, empty, and incomplete diffs.
- Added validation and safeguards for diff file retrieval.