feat(desktop): PR comments as an activity timeline

Merged
AV
2mo ago
+2829-661

Summary

The PR Summary's Comments section becomes an Activity rail, on both the Pull requests route and the workspace pane.

  • One stream, oldest first. Comments, reviews, the pane's review threads, and commits share a rail: "name added N commits · time" with each subject and short SHA, verdict icons for reviews without a note, and full comment cards whose long bodies fold at a readable height behind "Show more". The host reads commits again from gh pr view --json as a new optional output field; older hosts and the cloud route still render the rail without them.
  • Review threads interleave by time, one card per thread with its replies inside, and keep copy, resolve/unresolve and open-in-diff. Reply hands the thread to the composer at the end of the section, which says who it is replying to and posts through the host's reply-to-thread procedure; where no composer can take a reply it links to the comment on GitHub. The old pane listed the conversation twice (host copy plus threads-query copy); it now shows the threads query's conversation only when the host sends none.
  • Narrow panes (under 30rem) trade the rail for folded rows: one soft row per comment, thread or commit push that unfolds in place.
  • Markdown in bot comments now lays out as GitHub does: images inline with their width/height/align hints (a 20px badge rendered at 180px before), <picture> light/dark badges chosen by the app's theme rather than the OS, native <details> folds, italic alert quotes, <dl><dd> padding, and flat full-width tables with faint row rules that scroll inside their frame. Links inside comments stay plain; the description keeps its site marks.

Before/after captures (route, pane, narrow pane, bot comment markdown): https://app.superset.sh/page/pr-activity-timeline-4eeugx

Test plan

  • bun run typecheck in apps/desktop (exit 0), Biome clean on the touched folders, touched suites green (desktop 71, host-service 75), bun run check:i18n with every new string translated in all 17 locales
  • Driven over CDP in the dev app: Pull requests route on #8389; workspace pane at ~650px, ~550px, 475px (rows), 414px and 354px; bot comment markdown (CodeRabbit, Greptile, github-actions tables) compared against GitHub
  • Reply from a thread card posts to the thread and the pane's thread list refreshes (not exercised live; posting would hit a real PR)
  • An older host (no commits field) and the cloud route render the rail without commits

Summary by cubic

Turns the PR Summary's Comments section into an Activity timeline on both the Pull requests route and the workspace pane, merging comments, reviews, review threads, and commits into one oldest-first rail.

  • Review threads interleave by time with replies inside their root card, keeping resolve, copy, and open-in-diff; a long thread path truncates from the start so the filename and line stay in view.
  • Reply hands a thread to the composer, which posts via the host's reply-to-thread procedure; without a composer it links to the comment on GitHub. The composer keeps one draft per reply target, so replying to a thread doesn't carry a half-written conversation comment along, and cancelling restores it.
  • Panes under 30rem fold the rail into expandable rows; a section that mounts after the first render is still measured for the narrow layout.
  • Bot comment markdown now matches GitHub: inline images with width/height/align hints (including height-only hints), <picture> badges chosen by the app theme, native <details>, blockquote italics scoped to comments, and flat full-width tables whose code tokens stay whole.
  • The host reads commits from gh pr view --json as a new optional field; older hosts and the cloud route render the rail without commits.

Summary by CodeRabbit

  • New Features
    • Pull requests now show comments, review decisions, commits, and review-thread discussions in a chronological activity timeline, with counts and loading or empty states.
    • Reply to review threads inline, cancel a reply, and view thread replies alongside comments.
    • Review threads show file locations and resolved or outdated status, with controls to open the related diff.
    • Activity adapts to available space with compact expandable rows or detailed cards. Long content can be expanded as needed.
    • Pull-request images respect their specified dimensions and alignment.
  • Style
    • Improved pull-request Markdown presentation, including tables, blockquotes, images, and collapsible sections.