Skip to content

Show the pull request a branch already has - #15248

Draft
mtsgrd wants to merge 1 commit into
masterfrom
branch-tabs-workspace-only
Draft

Show the pull request a branch already has#15248
mtsgrd wants to merge 1 commit into
masterfrom
branch-tabs-workspace-only

Conversation

@mtsgrd

@mtsgrd mtsgrd commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Selecting a branch in the branches explorer showed a Diff / Pull Request toggle whose form could not work: publish_review derives the base from the branch's position in a workspace stack, and an unapplied branch has none.

The pane dispatched on the operand — what is selected, not what it is — and both outline tabs mint a Branch. It now takes a DetailsSelection:

AppliedBranch | UnappliedBranch | Commit | UncommittedFile

WorkspacePage already resolves selection per tab, so it names what it resolved. Applied and unapplied are the words the rest of the app uses — unappliedStacks is what fills the branches tab, and ListedBranch was already taken by the SDK type those stacks are made of.

What the branches tab shows now

header body
branch has a pull request Diff / Pull Request toggle diff, or the full review
branch has none title only diff

A review is keyed by branch name, so the description, conversation, checks, reviewers and labels were already reachable — nothing new was needed to read them. The toggle appears only alongside a review, so it is never a half-dead control. Opening a review is still not offered here; apply the branch and use the workspace, where the base exists.

AppliedBranchDetails and UnappliedBranchDetails share BranchTabToggle, useBranchTabHotkeys, BranchDiff, BranchTitleRow and ReviewView. Editing the description stays the applied view's affordance; the review's own controls work in both.

Operand keeps its shape. It is the argument type of getOperations, and an unapplied branch is precisely what operations cannot act on — so the distinction belongs where the two tabs converge, not in a dozen exhaustive matches that could not act on it. Its Branch case is now commented to say it means an applied branch, which it already did: operandLabel asserts the ref resolves to a segment.

Verification

Driven against the running dev app over CDP: an unapplied branch with a PR shows both tabs and the full review (description, checks, reviewers, labels, activity); one without shows title and diff only; an applied branch is unchanged and its pull-request tab still loads.

Checked against the committed tree in a scratch worktree, not the working copy: typecheck, oxlint over the whole repo, prettier, knip:prod, knip:non-prod and the lite unit tests (77/77) all clean.

@mtsgrd
mtsgrd force-pushed the branch-tabs-workspace-only branch from f04f994 to 43c5122 Compare August 9, 2026 21:13
@mtsgrd mtsgrd changed the title Show the branch tabs only for workspace branches Give the details pane a subject instead of a selection Aug 9, 2026
@mtsgrd
mtsgrd force-pushed the branch-tabs-workspace-only branch from 43c5122 to 9e1ed4c Compare August 9, 2026 21:26
@mtsgrd mtsgrd changed the title Give the details pane a subject instead of a selection Name what the details pane is showing Aug 9, 2026
@mtsgrd
mtsgrd force-pushed the branch-tabs-workspace-only branch from 9e1ed4c to 95c83de Compare August 9, 2026 22:04
@mtsgrd
mtsgrd force-pushed the branch-tabs-workspace-only branch from 95c83de to 09d754f Compare August 10, 2026 15:13
@mtsgrd
mtsgrd force-pushed the branch-tabs-workspace-only branch from 09d754f to 8dc24a5 Compare August 10, 2026 21:14
Selecting a branch in the branches explorer showed a Diff / Pull Request toggle
whose form could not work: publish_review derives the base from the branch's
position in a workspace stack, and an unapplied branch has none.

The pane dispatched on the operand, which says what is selected but not what it
is, and both outline tabs mint a Branch operand. It now takes a DetailsSelection
— AppliedBranch, UnappliedBranch, Commit or UncommittedFile — built by
WorkspacePage, which already resolves selection per tab. Applied and unapplied
are the words the rest of the app uses: unappliedStacks is what fills the
branches tab, and ListedBranch was already taken by the SDK type those stacks
are made of.

An unapplied branch now shows its review when one exists — a review is keyed by
branch name, so description, conversation, checks, reviewers and labels were
already reachable. The toggle appears only alongside a review, so it is never a
half-dead control, and a branch without one is its title and its diff.
AppliedBranchDetails and UnappliedBranchDetails share BranchTabToggle,
useBranchTabHotkeys, BranchDiff, BranchTitleRow and ReviewView; editing the
description stays the applied view's affordance.

Operand keeps its shape. It is the argument type of getOperations, and an
unapplied branch is precisely what operations cannot act on, so the distinction
belongs where the two tabs converge rather than in a dozen exhaustive matches
that could not act on it. Its Branch case is now commented to say it means an
applied branch, which it already did — operandLabel asserts the ref resolves to
a segment.
@mtsgrd
mtsgrd force-pushed the branch-tabs-workspace-only branch from 8dc24a5 to d64a747 Compare August 10, 2026 22:02
@mtsgrd mtsgrd changed the title Name what the details pane is showing Show the pull request a branch already has Aug 10, 2026
@mtsgrd
mtsgrd requested a review from samhh August 11, 2026 10:57
@samhh

samhh commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

From a UX perspective there are two issues:

  1. There is now layout shift when navigating between a branch with a PR and one without one.
  2. I might want to define a draft PR, and perform other actions, on a branch that's not applied. I don't personally see the value in this limitation; perhaps it speaks to a wider habit of how we treat the workspace and everything else as two different worlds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants