Skip to content

perf(pr): consolidate GitHub access reads and prefetch detail on hover - #445

Merged
ronak-guliani merged 1 commit into
mainfrom
t3/thread/a0b8db56e72fde607b7b2189
Sep 20, 2026
Merged

ronak-guliani merged 1 commit into
mainfrom
t3/thread/a0b8db56e72fde607b7b2189

Conversation

@ronak-guliani

@ronak-guliani ronak-guliani commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Port of pingdotgg/t3code#11825 to this codebase: consolidate GitHub requests and share detail data between hover and click. Upstream measured 36% faster fresh opens and 56% fewer GraphQL requests for three hovers — their measurements, not yet ours; see testing notes for what was verified here.

Server (3 gh reads → 2 per detail open): getChangeRequest fired gh pr view + gh repo view + a viewer-permissions GraphQL query. The viewer-permissions query now also selects mergeCommitAllowed/squashMergeAllowed/rebaseMergeAllowed, so one gh api graphql replaces gh repo view plus the second permissions query. Removes getRepositoryAccess, REPOSITORY_ACCESS_JSON_FIELDS, and decodeRepositoryAccessJson.

Web (hover warms the click): rows prefetch the detail query on intentional hover (350ms delay, so crossing rows costs nothing) and at once on keyboard focus; selecting the row then reads from the react-query cache. Only the detail is warmed — the activity's review-thread walk is paginated and unbounded, while the detail is one consolidated read.

Scar compliance

  • Write-path reads unchanged: mutations still re-read viewer access immediately before mutating (getViewerPermissions intact); the combined read is presentation, same as before.
  • No PR-badge or association changes: only explicit durable associations render (untouched).
  • Review-capture prewarm rule respected: this is react-query cache prefetch on read-only detail, not review-capture prewarming; no shared-resolver caching, no mutable-scope reuse.
  • Effect.all fan-out narrowed 3 → 2 with matching concurrency; no SQLite paths touched.

Verification

  • pnpm fmt:check — pass
  • pnpm lint — pass (no new warnings on touched lines)
  • pnpm typecheck — pass (exit 0)
  • Focused tests — pass: server src/pullRequest/ (20 passed, incl. new combined-decode + single-access-read tests), web pullRequestReactQuery.test.ts (7 passed, incl. new prefetch tests), row browser tests (3 passed, incl. new hover/focus test), client-runtime pullRequests (3 passed)
  • Combined GraphQL shape proven against real GitHub: gh api graphql on perf(server): parallelize independent Effect.all I/O fan-outs #439 returned merge settings + viewer standing in one read
  • Real-client pass (isolated dev server + authenticated browser, revision a0bf232): PR list rendered 50 real PRs with 0 console errors; hovered row feat: add PR monitor acceptance review ledger primitives #443 past the 350ms delay, clicked it, and the detail panel opened with summary, checks, and Merge/Close actions (viewer permissions + merge capabilities from the combined read). Only failed-network entries were dev OTLP telemetry aborts (benign, no OTLP endpoint in dev). Captures published below; upstream's 36%/56% figures are theirs and were not re-measured here.

Feature captures

PR head at upload: a0bf2327f928d5a2683f3c24073dacf8fafa18eb. See the testing notes for exercised behavior and limitations; uploading media is not a test result.

pr-detail-after-hover.png

pr-hover-open.webm

pr-hover-open.webm

Port of pingdotgg#11825 to this codebase: share detail data
between hover and click, and combine the permission queries into one
GraphQL read.

Server: getChangeRequest fired three gh subprocesses (pr view, repo
view, viewer-permissions GraphQL). The viewer-permissions query now
also selects mergeCommitAllowed/squashMergeAllowed/rebaseMergeAllowed,
so one gh api graphql replaces gh repo view plus the second
permissions query (3 reads -> 2). Removes getRepositoryAccess,
REPOSITORY_ACCESS_JSON_FIELDS, and decodeRepositoryAccessJson.

Web: rows prefetch the detail query on intentional hover (350ms delay,
so crossing rows costs nothing) and at once on keyboard focus. The
click then reads from the react-query cache. Only the detail is warmed:
the activity's review-thread walk is paginated and unbounded, while the
detail is one consolidated read.
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 19, 2026
@ronak-guliani
ronak-guliani merged commit 534a4fb into main Sep 20, 2026
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant