Skip to content

feat(native): pull requests page, detail panel and thread links - #36

Merged
rynfar merged 3 commits into
nativefrom
nw/w10-prs
Nov 2, 2026
Merged

rynfar merged 3 commits into
nativefrom
nw/w10-prs

Conversation

@rynfar

@rynfar rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Problem

The native client had no pull request surfaces: no pull requests page, no detail view, and no way to link a pull request to a thread or see the ones linked.

Approach

Ported from the web, logic first:

  • crates/core/src/pull_requests/ (pure, tested): wire types for pullRequests.list / listStats / filterOptions / detail / checks / activity and the diff result. Decoding is forward-compatible: unknown literals become Unknown, and a bad entry is dropped instead of failing the whole list. Also ported: the search syntax (pullRequestQuery.ts, including applyPullRequestDraftFilterChange), the list logic (pullRequestList.logic.ts: involvement, local filters, grouping, all seven sorts, match scores, quick actions, facets), the persisted list preferences (t3.pullRequests.preferences), the detail logic (pullRequestDetail.logic.ts: checks summaries, primary control, merge method, review outcomes, conversation threads, timeline), link parsing (pullRequestLinkInput.ts over the GitHub, GitLab, Bitbucket, Azure DevOps and Forgejo change request routes), the thread.pull-request.link/unlink commands, and the tagged-error messages. 31 tests.
  • crates/client: ClientHandle::pull_request_diff sends POST /api/pull-requests/diff the way pullRequestDiffHttp.ts does. There's also a read-only pr_probe example.
  • crates/app/src/pull_requests/:
    • The page: header, search with a 250ms debounce (Enter sends at once), the sort menu, a Filters menu with a count badge (State, Involvement, Author, Labels, Draft, Review, Checks, Host when there is more than one, Project with "· Unavailable"), and Refresh (pullRequests.invalidate).
    • The list: grouped (Authored / Review requested / Others) and virtualized. Line counts come from listStats and are cached across reads. Shift shows quick actions (close, merge, ready, reopen), which run immediately as on the web. "Load more" follows cursors or grows the page size.
    • Every web state is covered: ghost loading, could-not-load with Retry, no projects, searching, nothing matches, nothing under these filters, and a stale-rows warning.
    • The detail panel: header with the primary control (merge with the selected method, auto-merge, ready, conflicts badge, approve workflows), plus an actions menu (refresh, ready/draft, merge now, disable auto-merge, merge method, open on host, copy link and number, close/reopen).
    • Merge, auto-merge, close and approve workflows use the web's two-step confirm: the first click arms, a second click within 3s runs it, and Escape or a click elsewhere disarms. Merges re-read the detail fresh before running.
    • Detail tabs: Summary (reviewers, labels, description markdown, collapsible checks), Timeline (virtualized events with threaded review comments) and Code. Code reuses the diff panel through a small detached mode: DiffPanel::detached and show_external, with no scope menu or whitespace toggle. Patch slices load in sequence.
    • Thread linking: a Link pull request dialog (URL, #42, or gh pr checkout 42, validated as you type) and a Linked pull requests right panel surface (state, checks, watching, source, unlink, open in the page, and footer counts).
  • Entry points:
    • Sidebar footer utility button: Pull requests, or Back while the page is open.
    • Command palette: Open pull requests, Link pull request to thread, Show linked pull requests.
    • The right panel launcher: Linked pull requests (L).
    • pullRequest.copyNumber (mod+shift+k) on the page.
    • Selecting a thread leaves the page.
  • Shared edits kept small:
    • AppState.pull_requests_open, and select_thread/start_draft leave the page.
    • Workspace render and action wiring.
    • One sidebar footer line, three palette items, and one keymap arm.
    • SurfaceKind::PullRequests in the core right panel model.
    • ThreadShell.pull_requests, lenient and not serialized; conformance unchanged.
    • 15 vendored Lucide icons.

PR state colors reuse the status-pill tokens, which are the same Tailwind hues: emerald for open, violet for merged, red for closed. Draft uses muted_foreground.

Ledger rows

PR-PAGE, PR-DETAIL, PR-LINK → partial (gaps below).

Verification

  • cargo test --workspace: core 469 passed (31 new), client 17, conformance 5, app 4.
  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • node scripts/gen-theme.ts --check: up to date. node --test parity/sync.test.ts: 42 pass. conformance/generate.ts --check: exit 0.
  • Headless decoding against the real-data server, using read-only RPCs only (cargo run -p t3-client --example pr_probe):
list: 115 on the wire, 115 decoded, 2 providers, 2 errors, truncated=true, viewers={"github.com": "rynfar"}
  group Authored: 26 rows
  group Others: 89 rows
listStats: 99 rows measured
pull request pingdotgg/t3code #29264: fix(client-runtime): slow SSH runtime downloads report their own error, not a setup timeout
  detail: Open draft=false +220 -9 files=4 checks=35 labels=4 reviewers=0 primary=None
  checks: 2 of 35 running
  activity: 2 comments (2 total), 0 review threads, 5 commits -> 8 timeline events
  checks read: Some(35)
  diff: 13607 bytes, 4 files, truncated=false, more=false

With --state all, after the rebase: 99/99 decoded, plus a pull request with 11 comments, 3 review threads and 2 commits, which made 10 timeline events.

  • The app was launched against the smoke and real-data servers with the page open, a pull request selected, and the Summary, Timeline and Code tabs shown (through temporary env hooks, since removed). There were no panics or errors in the logs. No mutations were sent to the real-data server.
  • No screenshots. Screen capture is not available in this environment, so the visuals still need a look in a real window.

Gaps (follow-ups)

  • Page:
    • Multi-environment routing and merging.
    • The authored/reviewing partition reads; grouping uses the web's local fallback instead.
    • Search inside the Author/Labels pickers; they show loaded facets plus one unfiltered filterOptions read.
    • Close sweep across rows, stack popover, checks popover, condensed topbar, a separate provider menu, avatar images, and the detail panel's tabs, resize and maximize.
  • Detail:
    • The Guide tab and AI review guide.
    • Comments section and filter in Summary; comment, reply and resolve forms; reactions; review submission.
    • Title, description, reviewer and label editing.
    • Checkout and resolve-conflicts handoffs, delete branch, update branch, revert.
    • Stack-aware merge, the project default merge method, and refresh subscriptions.
    • In Code: viewed files, inline review comments, and full-file context (diffFileContents).
    • The close confirmation is armed from the actions menu and confirmed with a header button, because menus close on click here.
  • Link:
    • Stack chains and depth (links show flat), the watch toggle, quick actions and context menu on linked rows, and a GitCafe URL route.

Ports pullRequestQuery.ts, the list logic (filters, grouping, ranking,
quick actions, facets), the detail logic (checks, primary control, merge
method, timeline) and link parsing into t3-core, with tests. Thread rows
now decode their linked pull requests.
ClientHandle::pull_request_diff posts to /api/pull-requests/diff as
pullRequestDiffHttp.ts does. The pr_probe example lists, reads one pull
request's detail, checks, activity and patch, and decodes each.
The page lists pull requests grouped and sorted, with the Filters and
sort menus, the search syntax and Shift quick actions. Selecting one opens
its detail: Summary, Timeline and Code (the diff panel in a detached mode),
with merge, auto-merge, ready, draft, close and reopen behind the web's
two-step confirmations. Threads gain the link dialog and a Linked pull
requests right panel surface. Opened from the sidebar footer and the
command palette.
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