feat(desktop): a pull request pane is keyed by repository and number

Merged
SA
1mo ago
+731-314

What

The workspace PR pane is identified by the PR's own key, { repoFullName, number }, instead of { prNumber } plus whatever project the workspace happened to have. Every opener feeds it: sidebar chip, Workspaces list row, ShipControl's toast, the diff pane's PR link, the Changes menu, the Review tab title, and the browser pane's "Open in app" (which no longer needs a matching project to show).

Two sources, one shape. @superset/shared/pull-request owns the vocabulary (PullRequestDetail, checks, state, review decision). The API normalizes once (getByBranches now returns it; new integration.github.getPullRequest serves content by repo + number with the installation token). The host's gh pr view output maps into it through fromHostPullRequestContent.

Source rule (usePullRequestPaneDetail): the workspace's host when its project is the PR's repository — the person's own gh, no GitHub App needed, unchanged for local and remote hosts — else the API, which is what a closed cloud box or a PR in a repo nobody has checked out needs. The API query waits for host projects to answer so it never fires speculatively. Threads and close/merge stay host-side for the workspace's linked PR. The /pull-requests page is host-only as before.

Why

A number only means something inside a repository. Borrowing the repo from the workspace broke on cloud boxes ("Choose a project from Pull requests…" while the host row hadn't arrived) and is ambiguous once a workspace has several repos (#7699, cloud_workspace_repositories).

Verified

Dev app, real clicks over CDP:

  • Sidebar chip → pane for #7784: title, Merged, author, branch, body, 22 checks; network shows only the host's pullRequests.getContent.
  • ⌘⇧B → github.com/superset-sh/mastra/pull/9 → "Open in app" → pane called only integration.github.getPullRequest (no host call). It rendered the error state because the dev .env's GitHub App isn't the one behind the prod installation row; the same request is verified on prod after deploy (closed box + #7799).
  • Desktop tests 253/253 (incl. rewritten openPullRequestPaneInStore and getPullRequestTarget suites), trpc, i18n 157/157; root typecheck 42/42; the one new server-error string is translated in all 16 locales.

Existing saved PR panes carry the old { prNumber } shape and show an error until reopened — panes are transient, and reopening is one click.

Follow-ups (not in this PR)

  • The /pull-requests/$prNumber page keyed by repo, so a PR opens there without a project too.
  • Collapse the remaining PR shapes (V2WorkspacePrSummary, LinkedPR, DashboardSidebarWorkspacePullRequest, PRIcon.PRState, the host's two state enums) onto the shared type.
  • Lift pullRequestRef, the adapter and the source rule into a package mobile can import, alongside the cloud-workspace sync logic.

https://claude.ai/code/session_01RL946q6aRucLVJs659sW24


Summary by cubic

Keys the workspace PR pane by { repoFullName, number } instead of the pane's { prNumber } plus whatever project the workspace had open, so a PR opens even when no host has that repo checked out (cloud boxes, multi-repo workspaces).

The pane reads from the workspace's host when its project is the PR's repository, and falls back to the new integration.github.getPullRequest using the GitHub App installation otherwise. All openers now pass the ref parsed from the PR URL, and @superset/shared/pull-request unifies the detail shape across the API and host output.

Migration

  • Existing saved PR panes with the old { prNumber } shape show an error until reopened; panes are transient and reopening restores them.

Summary by CodeRabbit

  • New Features
    • Open pull requests in workspace panes using their repository and number, including pull requests from repositories not linked to a project.
    • View pull-request details from GitHub when available, including author, branch, review, and check information.
    • See a translated message when a repository isn’t covered by the GitHub App installation.
  • Bug Fixes
    • Improved pull-request matching across repositories and ensured links that can’t be recognized still open in a browser tab.
    • Corrected merge confirmation details and pull-request information displayed in the interface.