perf(pr): speed up list and detail loading #19227
main fromrefs/pull/19227/head·opened View on GitHubPR loading does unused work and repeats reads. This speeds up shared server paths on web, desktop and mobile, plus web hover and mobile focus.
- Lighter list queries, inline stack badges and shared repository resolution.
- Activity cache has a 10-minute limit and clears after failed reads, including strict reads. Smaller continuation reads and fresh-check reuse. Empty workflow-approval results stop waiting for branch matching; actual approvals keep all guards.
- Mobile joins its first detail read and delays hidden timeline work. Hover uses the narrow preview read.
Benchmarks#
Five alternating pairs of sequential gh api reads, no retries; medians include CLI/network, exclude rendering.
| Path | Before | After | GitHub cost |
|---|---|---|---|
| Full 100-row list | 7.40s | 5.37s | Same 4 points |
| Cold detail + workflow read, #18642 | 3.35s | 2.80s | Same 3 calls / ≤2 points |
| Hover core vs preview, #19111 | 1.34s / 16.7KB | 0.73s / 0.47KB | Same 1 point |
Public pingdotgg/t3code data. Detail outputs matched. Four list pairs matched; #11340 gained a live approval during pair five. Detail timings were noisy; the full gain cannot be assigned to cancellation. Mobile mount: 2 reads → 1. Activity continuation: 15 → 11 points. No new polling or quota bypass.
Scope and approval#
Focused fix for wasted work in existing PR loading, submitted under the obvious-bug exception. No new workflow or setting; maintainers decide eligibility.
Verification#
Focused cache, account, mutation, pagination, approval and mobile-focus tests; scoped types/lint; production web list/detail/activity/hover check. Native iOS/Android unavailable. GitHub media upload denied by upstream write permissions.
GPT-6.1-Sol High via Codex; Claude Opus 5.5 High via T3 Code delegation.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This PR changes shared server caching and GitHub query behavior alongside mobile loading and focus semantics, including new stale-data and work-gating paths. The breadth and altered runtime defaults require human review despite the accompanying tests and performance focus.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4899db2a-3361-4059-921b-56cc7366a7a7
📥 Commits
-
Reviewing files that changed from the base of the PR and between 26c8dd361ef516cdd72d51bfb0b97b1e1debfb26 and 471b71509491c58a47820951b9d0e8756bd1cc81.
📒 Files selected for processing: 2
-
apps/server/src/pullRequest/PullRequestService.test.tsapps/server/src/pullRequest/PullRequestService.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
📝 Walkthrough
-
The changes update server-side pull request caching and route resolution, mobile query refresh behavior, GitHub GraphQL reads, and the web pull request link preview.
Changes: Server pull request lookups
Layer / File(s) Summary Batch route resolution
apps/server/src/pullRequest/PullRequestService.ts,apps/server/src/pullRequest/PullRequestService.test.tslistStatsresolves each distinct route once per call and passes successfully canonicalized references to the stats reader. Tests cover reuse within a batch and resolution on a later call.Checks cache behavior
apps/server/src/pullRequest/PullRequestService.ts,apps/server/src/pullRequest/PullRequestService.test.tschecksprefers successful cached checks, then uses sufficiently fresh GitHub detail when supported. Tests cover expiry, invalidation, and a Bitbucket checks-read failure.Activity refresh and fallback
apps/server/src/pullRequest/PullRequestService.ts,apps/server/src/pullRequest/PullRequestService.test.tsActivity reads can return held data while a refresh runs. Strict reads wait for refreshed data. Held activity expires after ten minutes and is cleared after a read failure. Tests cover refresh outcomes and isolation by route and credential. Mobile pull request queries
Layer / File(s) Summary Focus refresh hook and screen integration
apps/mobile/src/state/use-query-focus-refresh.ts,apps/mobile/src/state/use-query-focus-refresh.test.tsx,apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx,apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx,apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsxThe screens use useQueryFocusRefreshfor detail queries. Tests cover focus refresh, atom changes, settled query data, and pull-to-refresh.Activity query enablement
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsxThe activity query is enabled when Activity is selected or was previously visited for the current pull request. GitHub pull request reads
Layer / File(s) Summary Stack fields in listing queries
packages/source-control-github/src/server/GitHubPullRequestApi.ts,packages/source-control-github/src/server/GitHubPullRequestApi.test.ts,packages/source-control-github/src/server/gitHubPullRequestJson.ts,packages/source-control-github/src/server/gitHubPullRequestJson.test.tsGitHub.com listing queries request stack fields and retry without them for matching GraphQL errors. The separate stack-membership lookup and decoder are removed. Tests cover listing results, fallback, and errors. Workflow approval reads
packages/source-control-github/src/server/GitHubPullRequestApi.ts,packages/source-control-github/src/server/GitHubPullRequestApi.test.tsWhen no workflow runs require approval, the read returns without waiting for head validation. Tests cover pending head validation and refusal cases when runs require approval. Review-thread page fields
packages/source-control-github/src/server/gitHubPullRequestJson.ts,packages/source-control-github/src/server/GitHubPullRequestApi.ts,packages/source-control-github/src/server/gitHubPullRequestJson.test.ts,packages/source-control-github/src/server/GitHubPullRequestApi.test.tsThe first review-thread page requests pull-request-level head fields; later pages omit them. Listing-row review queries no longer request author logins. Pull request link preview
Layer / File(s) Summary Preview query and interaction
apps/web/src/components/pullRequest/PullRequestLinkPreview.tsx,apps/web/src/components/pullRequest/PullRequestLinkPreview.test.tsxThe card uses the preview query. Tests verify that hovering loads the preview and clicking opens the original URL without requesting detail or calling the fallback. Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Suggested reviewers:
eimexdev
Merge Risk: ⚪ Minimal · up to
471b7-
The change speeds up pull request loading by reusing data and trimming requests. No concrete merge-blocking defect was identified in the supplied evidence, so it looks safe to merge after normal checks.
Security architecture risk: 🔵 Low · up to
471b7-
The reviewed changes preserve repository/account scoping and the guards required for actual workflow approvals. Recent activity can now be displayed while refreshing, with expiry and failure cleanup. No introduced security issue was substantiated, but broader runtime coverage remains incomplete.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- observed — The relevant data scope remains the repositories reachable through existing project/provider routing and credentials, not necessarily only the selected project's own repository. Hostless references must match the selected remote; explicitly hosted references can use existing matching-checkout or supported public-host fallback behavior. The new per-call route deduplication retains project, normalized host, and repository in its grouping key.
Trust Boundaries and Controls
- observed — Activity and checks still pass through canonical reference routing. Their keys include the canonical project, host, repository, PR number, expected account, available credential fingerprint, and invalidation epoch. When an expected account is supplied to credential routing, the existing wrapper verifies that account before running the operation. The PR reuses these controls rather than introducing a broader credential scope.
-
Pre-merge checks:
4-
Passed checks: 4 passed-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly and concisely describes the main performance improvements to pull request list and detail loading. Description check The description covers the problem, changes, scope and approval rationale, benchmarks, focused verification, unavailable platform testing, and media-upload limitation. It is sufficiently complete, alt…
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
Bil0000(GitHub profile, opens in a new tab) changed the title
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
Fixed the held-activity cache concern in 471b715094. Activity now expires after 10 minutes and drops its held copy after any failed read, including strict reads and generic permission failures.
Expiry and background/strict-denial regressions pass. All 208 service tests and scoped types/lint pass. Detail and summary cache behavior is unchanged.
Bil0000(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed