Skip to content

Show pull requests in the Graph - #90

Merged
danipen merged 10 commits into
mainfrom
graph-pull-requests
Sep 22, 2026
Merged

danipen merged 10 commits into
mainfrom
graph-pull-requests

Conversation

@danipen

@danipen danipen commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Pull requests now show up on the Graph's branch labels.

What you see

  • A PR chip on each branch label, following the same rules as the branch switcher's #123 badge: an open PR leads with its CI status (✓ / ✗ / amber dot running, nothing when no checks ran), a settled PR with GitHub's merged or closed octicon. The chip is drawn inline in the branch's own color with a hairline divider, not as a gray patch, so it belongs to its label and fades with it at small zoom. On the solid-blue current-branch pill it sits in a small light inset so the glyphs keep their color.
  • Hover a chip for the shared PR card (the switcher's, now in common/PrHoverCard.tsx). Click a chip to open the PR.
  • Detail pane: selecting a branch lists its PRs; selecting a commit that landed a PR links to it ("Pull request Trim file paths in the discard dialog, and cut trimmed paths flush by measurement #84").
  • Deleted PR branches get their real names. GitHub's Merge pull request #N from owner/branch wasn't recognized before, so those rows showed a short hash.

How it stays cheap

  • Merged PRs cost nothing. GitHub writes the PR number into the landing commit (the merge subject, or the squash Title (#N)), so landed branches get their chip straight from the loaded log. No API call or account needed, and it works offline.
  • Live PRs are fetched only for labels on screen, once the view settles (250 ms debounce). The fetch goes through the existing per-branch cache and batched GraphQL lookup, so no new IPC was added. Below the zoom where labels disappear (0.4), nothing is requested. The first report after the tab opens revalidates, so open-PR state and CI stay honest.
  • No reshuffling. On GitHub hosts, labels reserve room for a chip in the row packing, so rows don't move when PR data arrives.

Also fixed

  • A render loop on startup with the Graph restored ("Maximum update depth exceeded", present on main): remotes={sync?.remotes ?? []} created a new array on every render, which re-ran the layout and its report-up effects.

Tests

Unit tests for: parsing PR numbers from commit subjects, the new layout behavior (landed PRs, PR-merge naming, chip reservation), host-vs-history precedence, chip geometry and hit-testing, the on-screen label query, the chip glyph rules, and pullRequestUrl. Checked visually in both themes at several zoom levels, with the hover card, the detail pane, and every PR/CI state (via temporarily injected data).

🤖 Generated with Claude Code

danipen and others added 8 commits September 22, 2026 20:52
GitHub records the PR in the commit that lands it ("Merge pull request #N
from owner/branch", or a squash subject ending in "(#N)"). Each row now
carries the PR that landed its tip, deleted PR branches are named from the
merge subject instead of a short hash, and labels can reserve room for a PR
chip so rows never reshuffle when PR data arrives.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Move the hovercard, its state glyphs and a reusable PrRow link row into
common/PrHoverCard.tsx, and promote .pr-card / .ci-status to primitives.
The card now anchors to anything with a client rect (so a canvas-drawn
chip can host it) and can line up with either anchor edge.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each branch label wears a PR chip — the switcher badge's grammar (CI rollup
for open PRs, merged/closed octicon otherwise) drawn inline in the branch's
own ink, with an inset chip on the accent HEAD pill. Named branches get the
host's live answer, fetched only for labels on screen once the view settles
(nothing at all zoomed out past the label layer); landed branches get the PR
their merge or squash commit recorded, with no API call. Hovering a chip
opens the shared PR card, clicking opens the PR, and the detail pane links
the open branch's PRs and a landing commit's PR.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A fresh [] for remotes on each render re-ran the layout, and its report-up
effects set App state — a render loop ("Maximum update depth exceeded")
on startup with the Graph restored.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The accent HEAD pill's chip was a light inset patch — the one foreign
surface left. It is now inline like every other label (divider and number
in the pill's ink), and its state glyph becomes a disc in the state color
with the mark knocked out, so a green check survives on the accent fill.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The canvas chip now mirrors .branch-pr precisely: the same check/cross
paths and 1.7 stroke at 10px, 11px octicons, a 6px running dot and 10.5px
text. On the accent HEAD pill it is the badge itself (neutral pill, ring,
muted number) instead of a disc or halo; the running dot pulses like the
badge's ci-pulse, animating only while one is on screen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Drop the neutral badge pill on the accent HEAD label: like every other
label, the chip is a divider plus the glyph and number, all in the pill's
ink. The glyph keeps the switcher badge's exact shape, so the state still
reads (check / cross / pulsing dot / octicon).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A white check and cross on the accent HEAD pill lost what makes CI
glanceable: red means stop. The plain state colors sink because they're
mid-luminance like the fill, so the HEAD glyph keeps its hue but is mixed
toward the pill's ink — pale mint/coral on the light theme's blue, deeper
green/red on the dark theme's lighter blue — derived from the theme tokens.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@danipen
danipen marked this pull request as draft September 22, 2026 19:58
danipen and others added 2 commits September 22, 2026 22:21
The badge showed nothing for a draft with no checks, and the hovercard
faked drafts with a gray open-PR icon. Add GitHub's git-pull-request-draft
octicon: the hovercard uses it for drafts, and the badge leads with it
when a draft has no CI yet (CI still wins once checks run).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
No state color sits well on the solid accent pill, so the current branch
no longer is one: its label is tinted in the accent like any other label
and leads with a solid cap carrying the home glyph — the same house the
HEAD commit wears. PR glyphs are now identical on every branch, red and
green intact. The graph chip also shows the draft octicon for a draft
with no checks, matching the badge.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@danipen
danipen marked this pull request as ready for review September 22, 2026 20:25
@danipen
danipen merged commit b255f10 into main Sep 22, 2026
9 checks passed
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.

1 participant