Rearrange some information about a PR in the right pane - #34
Conversation
3ca371d to
2c659ba
Compare
|
this change looks great to me so far - |
29f1a37 to
7e69451
Compare
|
I played around with this a little more. I wanted to make it so the "action" (merge) button is on the header and everything else is just information. |
7e69451 to
6b172ff
Compare
Every GH fetch now funnels through trackedFetch, which logs `[github-api] METHOD /path → status (Nms)` to debug.log and bumps a PerfMonitor counter. The HUD shows "GH API" as calls/sec alongside the existing Store/IPC/Terminal metrics, with a toggleable chart line. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- New `expandedDiagnosticLoggingEnabled` setting (default off) gates the per-call `[github-api]` debug.log lines added in the previous commit. HUD's "GH API" rate metric is unaffected — it stays on. - PerfMonitor now keeps a 60-bucket rolling count of GH API calls in the last hour, surfaced as `githubApiCallsLastHour` and shown as "GH (1h)" in the HUD scalar row. - Widen the HUD from 520 to 580px (chart 500 → 560) so longer scalar labels like "Memory (render)" no longer wrap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fits more naturally beside the debug-log open/show buttons than in the GitHub auth section. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR pane layout
- #nnn rendered as a state-colored outlined pill at the start of the
title row (border + text use success/warning/accent/danger per state).
- Title is draggable + opens the PR in the browser on click.
- Assignees render as an avatar stack at the left of the second row.
- Milestone rendered as its own pill linking to the milestone page.
- Target branch displayed in the second row (warning color when not
the repo default); baseBranch/isDefaultBase added to PRStatus and
populated by the GitHub fetcher.
- Labels rendered as colored pills above linked issues with a
luminance-aware text color.
- Linked issues (Closes #N / GitHub link-issue UI) shown with open/
closed state icons under the merge row.
- Checks sorted by status (failures → pending → success/neutral) and
then by start time.
Merge button
- Lives in the panel header actions slot, labeled by strategy
("Squash+Merge" / "Merge" / "Rebase+Merge").
- Tooltip "Merge the pull request"; confirm step "Confirm merge into
<branch>".
- Disabled with red styling + GitMergeConflict icon when the PR has
merge conflicts; tooltip "There are merge conflicts".
- Hidden while the PR is in the merge queue.
Open / unmerged PRs
- Show "↓ N" chip next to the target branch when behind base
(new fetchBehindBy via GitHub's compare endpoint).
Merged PRs
- Hide the behind chip; show the earliest local tag containing the
merge commit (accent "vX.Y.Z") or italic "unreleased" when no tag
yet contains it (new getFirstTagContaining git tag --contains lookup
in main; firstReleaseTag field on PRStatus).
Merge queue
- New fetchPRExtras GraphQL helper (5th parallel call in the detail
fanout) returns mergeQueueEntry and closingIssuesReferences.
- State pill shows "Queued (Nnd · ~12m)" while enqueued; merge button
hidden while in queue.
Drag-and-drop into terminal
- XTerminal's drop handler accepts in-app text/plain payloads in
addition to OS file drops, wrapping in bracketed-paste markers.
- Source panels set drag payloads:
- Changed files / all files: "@<path> "
- PR checks (with detailsUrl): URL
- PR title + linked issues: URL
- Commits: full commit SHA
- Existing click handlers still work — dragging only fires on a real
drag gesture.
Changed Files toolbar
- Refresh moved rightmost; Review button contrast bumped.
Internal
- Reducer + sort tests extended for the new fields; pr-poller stub
updated to include all newly required PRStatus fields.
- usePRMergeAction extracted as a hook returning {button, errorRow}
so the button can render in the panel header while the error row
stays in the body.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
im trying to review this but ironically my gh rate limit is all used up. give me a bit but I can merge it today |
I'm trying a version of this locally that uses graphql to see if that cuts down the number of GH API calls. This PR added ~50% more calls for me. |
Replace the per-repo "list 100 most-recent + match by ref/sha + 5 detail calls per PR" flow with a single aliased GraphQL request that looks up each worktree's PR by headRefName. Two wins: * Stale long-lived branches whose PR fell out of the top-100-most-recent window now show their status correctly. * Call volume drops from ~6N+1 REST calls per repo refresh to roughly N+1 (one GraphQL plus per-PR behind_by compares). Dedupes checks by name since statusCheckRollup returns an entry per re-run, which collided with the renderer's name-keyed list. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
6b172ff to
dc49db6
Compare
|
The latest commit appears to drop the number of GH requests by a lot. Curious if you see the same thing. |
|
@big-guy this looks awesome, my only comment is that milestones are not a universally used feature, so it might be best for the "No milestone" state to be invisible or optional somehow
|
it seems like we are at N+1 now, which is much better than where we started, so I am down to merge this PR. However, from my investigation we could probably do 1 graphql call for the most recent 100 PRs and then backup to doing another call for the missing PRs. Likely that would reduce further (although graphql calls seem to be charged differently based on some points math) |
A few ideas:
Do you want to merge first and I'll do one of these next? WDYT?
Yep, this sounds like a good idea, the fewer per worktree calls the better. |
Adds repository.milestones(first:1){totalCount} to the batched GraphQL
request — no extra round-trip. PRs now carry a hasMilestones flag and
the PR pane skips rendering the milestone pill (or its "No milestone"
placeholder) entirely when the repo doesn't use milestones.
Tests cover all four states of the (hasMilestones × milestone) matrix
via an extracted milestoneDisplay helper.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
I ended up doing this:
|
… the PR's head ref `gh pr checkout` creates a synthetic local branch (e.g. `pr-37320-...`) that doesn't match the upstream PR's `head.ref`, so a headRefName-only GraphQL lookup misses the PR entirely. Adds a parallel `object(oid: $sha).associatedPullRequests` sub-query that runs in the same request, no extra round-trip. pickPRBySha already prefers SHA-matched candidates, so the combined result resolves to the correct PR. Tests cover the gradle/gradle scenario, the SHA-disambiguation case where branch and SHA lookups return different PRs, dedup when both return the same PR, and the absence of the SHA alias when the worktree HEAD isn't a 40-char SHA. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

PR pane layout
title row (border + text use success/warning/accent/danger per state).
the repo default); baseBranch/isDefaultBase added to PRStatus and
populated by the GitHub fetcher.
luminance-aware text color.
closed state icons under the merge row.
then by start time.
Merge button
("Squash+Merge" / "Merge" / "Rebase+Merge").
".
merge conflicts; tooltip "There are merge conflicts".
Open / unmerged PRs
(new fetchBehindBy via GitHub's compare endpoint).
Merged PRs
merge commit (accent "vX.Y.Z") or italic "unreleased" when no tag
yet contains it (new getFirstTagContaining git tag --contains lookup
in main; firstReleaseTag field on PRStatus).
Merge queue
fanout) returns mergeQueueEntry and closingIssuesReferences.
hidden while in queue.
Drag-and-drop into terminal
addition to OS file drops, wrapping in bracketed-paste markers.
drag gesture.
Changed Files toolbar
Current:

With PR:
