feat(desktop): open the PR summary as a workspace pane from the Changes pane

Merged
KI
2mo ago
+1603-742

Summary

  • The Changes pane's "Open PR #N" button now opens a pull-request pane beside the diff instead of navigating away to the Pull requests screen.
  • Every other in-app jump to the PR lands in that pane too: the Review sidebar's PR title, the top-bar PR badge menu's "Open pull request", the "PR #N created" toast's Open action, the sidebar workspace row's PR icon, and V2WorkspaceRow's PR icon (history dropdown, recently viewed). The pane keeps its own GitHub link.
  • The pane shows the PR view's summary side: title, GitHub link, merge menu with its confirmation, state/author/branch/age, description, and checks. A header button jumps to the full Pull requests screen where the Code tab lives.
  • The PR detail page is split into four shared pieces so both surfaces compose the same header, body, query, and fallback ladder.

Results page with before/after screenshots and the verification log: https://app.superset.sh/page/pr-summary-pane-7uewrj

Why / Context

Reading a PR's description and checks while reviewing its diff meant leaving the workspace for /pull-requests/$prNumber or GitHub, then coming back. The Changes pane already shows this branch's diff, so the only thing missing in the workspace was the summary side. Putting it in a pane keeps the diff and the summary side by side, and pointing the other entry points at it means the workspace stays the place you review from.

How It Works

  • pull-requests/hooks/usePullRequestDetail owns the getContent query (one cache entry per PR) and its invalidation after merge/close.
  • pull-requests/components/PullRequestDetailHeader holds the title, actions, meta row, mutations, and the confirmation dialog. showStartWorkspace is off in the pane, where the PR is already the workspace's own.
  • pull-requests/components/PullRequestSummaryContent is the description + checks grid; it lays out on container width, so both hosts are @container.
  • pull-requests/utils/resolvePullRequestDetail is the ordered fallback ladder as a discriminated result, so the page and the pane narrow to data/projectId/hostUrl without re-checking.
  • PullRequestPane composes those around the workspace's own host and project from useWorkspace().
  • openPullRequestPaneInStore reuses an existing pull-request pane in any tab (switching to that tab, retargeting it when the number changes) and otherwise calls the store's openPane, which splits the active pane to the right.
  • Inside the workspace route, openPullRequestPane from useWorkspacePaneOpeners reaches the Review sidebar, ChangesControl (PRStatusGroup menu and ShipControl toast), and the Changes pane header gets the store from the renderer context.
  • Outside it, the sidebar row and V2WorkspaceRow record a pull-request-pane-intent and navigate to the workspace; usePullRequestPaneIntentOpener consumes it once the pane layout is ready, the same hand-off the page pane uses.
  • The page keeps its tab row, the Code tab, and the kept-mounted ScrollArea; it now composes the shared pieces (777 → 149 lines).

Manual QA Checklist

Driven over CDP in the dev app from this worktree, against the seeded dev session. Console errors were hooked and stayed empty throughout.

Entry points (workspace "Review PR 6344 for Superset", PR #7186, open):

  • Changes pane header "Open PR #N" splits the active pane right with the summary
  • Review sidebar PR title (now a button, no GitHub anchor left) opens the same pane
  • Top-bar PR badge menu → "Open pull request" opens the pane
  • Sidebar workspace row PR icon, clicked from a different workspace: navigates and arrives with the pane open (intent hand-off)
  • "PR #N created" toast → Open (not driven: would create a real PR; same onOpenPullRequest callback as the menu)
  • V2WorkspaceRow PR icon in the history dropdown / recently viewed (not driven: rows weren't populated in the dev session; same intent path as the sidebar icon)

Pane behavior:

  • Title, GitHub link, Merge menu, Open badge, author, #number, branch, age, description, checks; "Start Workspace" absent
  • Merge menu → "Squash and merge" opens "Merge #7186?" with Cancel / Merge pull request; Cancel closes it and no mergePR request is sent
  • Re-opening from any entry point focuses the existing pane instead of adding a second
  • Opening from a different tab switches to the tab holding the pane
  • location.reload() restores the pane with its title
  • Pane header context menu reads "Close Pull Request ⌘W"
  • "Open in Pull Requests" lands on /pull-requests/N?project=… with Summary and Code tabs, Start Workspace, and the checks side column unchanged; the Code tab still loads the file list
  • 1000px-wide window: no horizontal overflow in the pane root or its scroll viewport

States:

  • Fetch failure (pane retargeted to #999999 then reloaded): bare "#999999" title, the gh error in the body, working "Try again"; opening the real PR retargets the same pane back
  • Host paused (SIGSTOP on the host-service): pane holds its loading skeletons with no error; resumed, it resolves
  • Draft PR (#7132): "Draft" badge, no Merge button
  • Merged PR (#7225, #7208): "Merged" badge, no Merge button
  • Closed PR, real journey in a different project (workspace "trunk", superset-repro/cli, PR #1080): "Closed" badge, no Merge, "No checks reported" empty state
  • Workspace with no linked PR: no "Open PR" button in the Changes header
  • Session workspace (null projectId): Changes header renders without "Open PR", no PR/ship controls in the top bar, Review tab shows "Open a pull request to view review status, checks, and comments."

Testing

  • bun run typecheck (apps/desktop)
  • bun run lint:fix then a clean biome check on the touched files
  • bun test on openPullRequestPaneInStore (3) and resolvePullRequestDetail (7), plus the ChangesControl, DashboardSidebar, v2-workspaces, workspace hooks, and persisted-key suites (362 pass); confirmed the opener test fails when the retarget write is removed
  • bun run check:i18n: two new strings ("Close Pull Request", "Open in Pull Requests") translated into all 16 locales; the pane title reuses the existing "Pull request #{0}" entry

Design Decisions

  • Summary only, not the Code tab: the workspace's Changes pane is already this branch's diff, and the PR code viewer carries its own polling and comment subscriptions that would double up.
  • Split right via openPane rather than a new tab: the point is seeing the diff and the summary together; changesOpenTarget still governs the Changes pane itself.
  • Intent store for cross-route entry points: the sidebar and list rows have no pane store. Recording an intent and letting the workspace page consume it after layout is ready is the pattern the page pane already uses, so both share one shape.
  • GitHub links that stay: the pane header's GitHub icon, "View on GitHub" in the badge menu and hover card, the toast's PR URL, and the Review tab's per-check links all still go to GitHub. They point at things the pane doesn't show.

Known Limitations

  • "Force merge" in the merge menu only changes the confirmation copy; the host mergePR has no force/admin input, so it sends a normal merge. That predates this PR (#6843) and was moved verbatim into the shared header; flagged by CodeRabbit, left for a follow-up.
  • The pane root needed w-full min-w-0 inside the pane host's flex row; without it the body rendered zero-width. Caught in the live run, fixed before commit. Worth remembering for the next pane kind.
  • An older build restoring a persisted pull-request pane has no renderer for it, same as any new pane kind.

https://claude.ai/code/session_01VsCqyq5EJS5CgvTWgixMav

Summary by CodeRabbit

  • New Features
    • Pull request details now include titles, descriptions, checks, metadata, branch copying, and GitHub access.
    • Added merge, close, reopen, workspace, retry, and confirmation actions.
    • Pull requests can open beside the diff in a workspace pane.
    • Added navigation between the workspace pane and the full Pull Requests view.
    • Workspace pull request links now open in-app.
  • Bug Fixes
    • Improved loading, error, unavailable-host, and missing-project states with retry support.
  • Localization
    • Added translations for new pull request actions.
  • Tests
    • Added coverage for pull request state handling and workspace pane behavior.