feat(desktop): pull request page as summary, info rail, conversation, and draft flow

Merged
AV
1mo ago
+6673-1762

Pages

Summary

  • The pull request route and the workspace's pull-request pane open on a page layout: a top bar (Summary / Changes tabs with the diff size, copy link, open on GitHub, Send to agent, and a split primary pill), a header (state pill, repo #n, large title, author · age · head → base, labels), the description as page prose, and an info rail with merge status, comments, reviews, and checks that folds into rows under the header when the pane is narrow.
  • The Summary ends in a Comments section (reviews and comments as collapsible rows, bot findings lifted into a title and severity line, a "Leave a comment" pill that posts as the gh user). Draft pull requests get Ready for review and a Draft / Ready state menu; every menu is the frosted picker panel with glyphs on each row, plus Fix findings and Resolve conflicts that hand a prompt to an agent on the PR.
  • Host: additive pullRequests.addComment and pullRequests.setDraft procedures, and the PR content read also returns mergeability, diff counts, reviewers, comments, commits, labels, and merge/close times. Every new field is optional, so older hosts and the cloud route still render.

Why / Context

The Changes/Review surfaces were audited against a stronger reference review experience. The detail page was the weakest half: a one-line header, checks in a side column, description in a document-styled scroller, no conversation, no draft handling, and text-only loading states.

How It Works

  • PullRequestDetailContent keeps the Summary mounted and lazy-loads the Changes tab (the diff renderer and worker pool) behind a Suspense skeleton. The detail itself loads behind a page-shaped skeleton; the skeletons share one viewport-fixed shimmer sweep.
  • PullRequestPageBody is an @container: the rail is a sticky column at ≥52rem and PullRequestInfo renders the same facts as label/value rows below that.
  • PullRequestMarkdown layers element renderers over the shared MarkdownRenderer (external links lead with the site's mark, task boxes sit in the list gutter read-only, tables are a bordered grid at natural width with sideways scroll) and an unlayered stylesheet for the prose scale, because the renderer's own sheet is unlayered and outranks Tailwind utilities.
  • PullRequestConversation lists detail.comments oldest first (last two open); PullRequestConversationComposer posts through pullRequests.addComment (gh pr comment) and invalidates the detail; the host evicts its content cache so the refetch carries the comment.
  • usePullRequestDraftMutation drives pullRequests.setDraft (gh pr ready [--undo]); the host records the draft flag on linked rows before the refetch lands so sidebar chips agree.
  • usePullRequestAgentHandoff sends a prompt to the PR's linked workspace via agents.run, or starts a workspace checked out on the PR with the host's first agent; buildFixFindingsPrompt quotes reviews and failing checks, buildResolveConflictsPrompt names the base and head.
  • Every green and red on the page (diff stat, state glyph and pill, check marks) reads one shared constant that the list row also uses, so the page and the sidebar are the same tone.

Screenshots

Summary · narrow fold · skeleton · Changes · conversation · draft menu · table · task list

summary

Manual QA Checklist

Verified live over CDP in the dev app against real PRs on this repository (#8238, #8242, #8243 draft, #8234 merged):

  • Summary header, rail column at full width; rail folds into rows at a 1000px window
  • Switching PRs shows the page skeleton; a cold Changes click shows the diff skeleton, then the diff with 118 files
  • Changes tab shows the title row above the files toolbar
  • Description: favicon/GitHub link marks, task boxes in the gutter (7 on #8238), bordered table scrolling sideways (#8234)
  • Conversation lists 9 comments and reviews with state labels; composer renders
  • Draft #8243: Ready for review split pill; menu lists Draft (checked), Ready for review, Fix findings, Close pull request; header pill is a state menu; no Merge offered
  • Merge menu on a non-draft PR: methods with glyphs, Force merge on failing checks, Fix findings, Convert to draft, Close
  • Frosted menu panel measured: 14px radius, blur 40px, rows 10px at 12px
  • Top bar has no bottom rule; copy link and open-on-GitHub glyphs match
  • Not exercised, because each would write to a real PR or launch an agent: posting a comment, Ready for review / Convert to draft, Merge, Close, Fix findings, Resolve conflicts

Testing

  • bun run typecheck (root) exit 0
  • bun test apps/desktop/src/renderer/routes/_authenticated/_dashboard/pull-requests plus the workspace PullRequestPane fixtures (46 pass)
  • bun test packages/host-service/src/trpc/router/pull-requests (73 pass; new: add-comment, set-draft, extended content read)
  • bun run check:i18n clean; new strings translated in all 17 locales
  • biome on the touched paths

Design Decisions

  • Lucide glyphs instead of the reference's icon packs: one of the two is a paid set vendored without a license file and the other would add a dependency for one glyph; lucide carries the same shapes.
  • Tables at natural width with scroll, not 100%: a 100% table squeezed the prose column behind unbreakable code tokens on #8234; GitHub's approach reads better.
  • Menu skin as a wrapper, not a change to @superset/ui: scoped to the PR page so no other dropdown moves.
  • Comment and draft writes through the host (gh), like merge and close already are; no GitHub App needed.

Known Limitations

  • Older hosts answer the content read without the new fields: the rail then shows reviews and checks only, and the conversation shows only the composer.
  • Fix findings uses the host's first configured agent; there is no agent picker yet.

Follow-ups

  • Timeline tab (removed for now; the host already returns commits).
  • An "ask about this pull request" composer (removed for now).
  • The sidebar PR list rows were only lightly touched (meta ink, avatar ring).

Compatibility

tRPC changes are additive: two new host procedures and new optional fields on pullRequests.getContent / getContentByRepo. Released desktop, mobile, and CLI builds keep calling the existing shapes; checked per .agents/skills/trpc-compat.


Summary by cubic

Rebuilds the pull request detail page (route and workspace pane) as a full page layout: a top bar with Summary/Changes tabs and the diff size, a header with state, author, and branch details, the description as page prose, and an info rail with merge status, comments, reviews, and checks that folds into rows on narrow panes. The pane scales to its width: action labels fold to glyphs, the title and gutters step down, and the diff runs edge to edge in tight panes.

The Summary ends in a Comments section with a composer that posts as the gh user via the REST endpoint, so a successful write never reports failure. Draft pull requests get Ready for review plus a Draft/Ready state menu; Merge, Fix findings, and Resolve conflicts hand prompts to an agent in the pull request's workspace. GitHub alert markers (> [!NOTE] and friends) render as bold labels, images stay inside the column, and the Summary/Changes choice resets per pull request.

The host gains additive pullRequests.addComment and pullRequests.setDraft procedures; the PR content read also returns mergeability, diff counts, reviewers, comments, labels, review decisions, and merge/close times. Every new field is optional, so older hosts and the cloud route leave them out and the page still renders; hosts missing the new procedures hide the composer and the draft/state menus instead of failing. Draft rows in the sidebar pick up the dashed draft glyph, matching the detail page.

Summary by CodeRabbit

  • New Features

    • Pull-request pages now offer controls to merge, close, reopen, and change draft status, with confirmations where needed.
    • View comments and reviews, post comments, and hand off review findings or merge conflicts to an agent.
    • See change counts, mergeability, checks, reviewers, and labels alongside improved pull-request descriptions.
    • The “Code” tab is now “Changes” and displays additions and deletions.
    • Markdown rendering supports custom component overrides.
  • Improvements

    • Loading states and layouts adapt to available space.
    • Updated translations for pull-request actions and statuses, plus clearer draft-state visuals.