Repository navigation
refactor(pull-requests): move the last PR callers off the host's gh - #8771
Conversation
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
[Medium impact] The changes stay within pull-request workflows on desktop and mobile. The PR appears safe to merge, with a non-blocking concern about unused data fetched for mobile PR counts. Findings
Fix with agent prompt### Issue 1
apps/mobile/screens/(authenticated)/workspace/[id]/hooks/usePullRequestDiffstat/usePullRequestDiffstat.ts:32-38
`usePullRequestDiffstat` now loads the whole PR conversation to read two counts. `getPullRequestContent` also requests up to 100 comments, reviews, commits, and check results. Opening `PullRequestsSheet` can run this request for 20 rows, then discard everything except `additions` and `deletions`.
Use a small viewer-authenticated read for these counts so opening the list does not download every PR's conversation.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryMoves the remaining direct PR callers to the viewer API:
One non-blocking concern: mobile rows now fetch full PR conversations for two counts. Acknowledged behavior: Reviews (1) · Last reviewed commit: "refactor(pull-requests): move the last P..." · Reviewed by Greptile |
| const pr = await apiClient.integration.github.getPullRequestContent.query( | ||
| { | ||
| organizationId, | ||
| repoFullName: `${pullRequest.repoOwner}/${pullRequest.repoName}`, | ||
| number: pullRequest.prNumber, | ||
| }, | ||
| ); |
There was a problem hiding this comment.
PR rows fetch unused conversations
usePullRequestDiffstat now loads the whole PR conversation to read two counts. getPullRequestContent also requests up to 100 comments, reviews, commits, and check results. Opening PullRequestsSheet can run this request for 20 rows, then discard everything except additions and deletions.
Use a small viewer-authenticated read for these counts so opening the list does not download every PR's conversation.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile/screens/(authenticated)/workspace/[id]/hooks/usePullRequestDiffstat/usePullRequestDiffstat.ts
Line: 32-38
Comment:
**PR rows fetch unused conversations**
`usePullRequestDiffstat` now loads the whole PR conversation to read two counts. `getPullRequestContent` also requests up to 100 comments, reviews, commits, and check results. Opening `PullRequestsSheet` can run this request for 20 rows, then discard everything except `additions` and `deletions`.
Use a small viewer-authenticated read for these counts so opening the list does not download every PR's conversation.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.ee04810 to
ec2ed7c
Compare
134d32f to
318a285
Compare
318a285 to
23d82f5
Compare
23d82f5 to
a300d30
Compare
a300d30 to
487740d
Compare
ChangesControl's merge and mark-ready, the new-workspace prompt's PR body, and mobile's per-row diffstat go through the API as the viewer. Only the PR pane's fallback still calls the deprecated host procedures.
487740d to
bc4cdb3
Compare
Step 1 of the PR-pane cleanup. Stacked on #8765.
Summary
Moves the last direct callers of the host procedures #8765 deprecated onto the viewer's API path:
ChangesControl → PRStatusGroup(desktop tab-bar PR badge): merge and mark ready usemergePullRequest/setPullRequestDraftfrompullRequestClient, in place of hostgithub.mergePR/github.markPullRequestReady. The host'srefreshByWorkspacessync after a write stays; that's the host's own state, not GitHub auth.fetchPrBody): reads the linked PR's body withreadPullRequestContent, keyed by the PR's URL, in place of hostpullRequests.getContent.usePullRequestDiffstat):integration.github.getPullRequestDetail(without activity) in place of hostgithub.getPR. This drops the host URL plumbing fromPullRequestsSheet/RowDiffstat.After this, the only callers of the deprecated host PR procedures are the desktop
pullRequestClientfallbacks, which step 4 removes.Behaviour note: in a session workspace (no project) with no GitHub connection, merge from the badge now fails with the "Connect GitHub" error. It used to merge through the host's
gh.Test plan
lib/githuband ChangesControl pass;tscclean in touched filesbun test233/233;tscclean in touched files