feat(web): surface pull request deployments with one-click preview links - #8261
vitalyiegorov wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
| commits(last: 1) { | ||
| nodes { | ||
| commit { | ||
| deployments(first: ${GRAPHQL_PAGE_SIZE}, orderBy: { field: CREATED_AT, direction: DESC }) { |
There was a problem hiding this comment.
🟡 Medium pullRequest/gitHubPullRequestJson.ts:2006
A head commit with more than 100 deployments returns incomplete environment data: deployments after the first 100 are silently omitted, so environments whose newest deployment is on a later page disappear despite the decoder promising one row per environment. Add pageInfo handling and follow-up queries until all deployment pages are fetched.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/pullRequest/gitHubPullRequestJson.ts around line 2006:
A head commit with more than 100 deployments returns incomplete environment data: deployments after the first 100 are silently omitted, so environments whose newest deployment is on a later page disappear despite the decoder promising one row per environment. Add `pageInfo` handling and follow-up queries until all deployment pages are fetched.
There was a problem hiding this comment.
🟢 Low user/source-control.md:52
The globe button does not always open a menu when a deployment has several environments: openableDeployments filters to successful deployments with URLs, so one live, openable preview opens directly and none removes the globe control. Please document that the menu requires multiple live, openable previews.
| - When there are several environments, the globe button opens a menu so you can pick which one to open | |
| - When there are multiple live, openable environments, the globe button opens a menu; with one, it opens that preview directly, and with none, no globe control is shown |
🤖 Copy this AI Prompt to have your agent fix this:
In file @docs/user/source-control.md around line 52:
The globe button does not always open a menu when a deployment has several environments: `openableDeployments` filters to successful deployments with URLs, so one live, openable preview opens directly and none removes the globe control. Please document that the menu requires multiple live, openable previews.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit eaf33a027953d04ad7bde9349ebc8c58b6ae9068. Configure here.
| environmentUrl ?? (status === "success" ? null : trimmed(node?.latestStatus?.logUrl)); | ||
| latestByEnvironment.set(environment, { environment, status, url }); | ||
| } | ||
| return Result.succeed([...latestByEnvironment.values()]); |
There was a problem hiding this comment.
Redeploy hides live preview URL
Medium Severity
decodePullRequestDeploymentsJson keeps only the newest deployment per environment. When that newest row is failure or in-progress, an older success row for the same environment (often still serving a live preview) is dropped, so the header globe and Summary lose the working URL even though GitHub typically leaves the prior deployment active until a later success marks it inactive.
Reviewed by Cursor Bugbot for commit eaf33a027953d04ad7bde9349ebc8c58b6ae9068. Configure here.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a substantial cross-layer capability that queries GitHub deployments on every PR detail read and exposes new preview-opening UI behavior. Unresolved concerns include incomplete pagination and potentially hiding still-live preview URLs during redeploys, so the runtime behavior needs human review. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
The PR pane buries provider preview links (Vercel and similar) inside the Checks section as generic Details rows. This reads GitHub's Deployments API for the head commit, adds an optional deployments field to the detail contract, renders a Deployments section in the Summary tab, and puts an Open preview button in the pane header: one live environment opens directly, several open a menu. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
eaf33a0 to
1fdc0d7
Compare
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together. We are not adding pull request deployment discovery and one-click preview links in this form. The provider authentication and deployment API support cost is too high for this narrow source control convenience. If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed. |
|
Understood, and thanks for the clear reasoning — the cost/benefit call on provider deployment support makes sense, and it's more useful to hear it plainly than to have it linger. No follow-up needed on this one. For anyone who finds this later: preview links already reach the pane today through Discussion context, if it's ever worth revisiting: #8258 |


What Changed
When a pull request has deployments (for example Vercel preview environments on GitHub), the review now shows them as first-class data instead of generic check rows:
deploymentsfield onPullRequestDetail. GitHub only; other hosts leave the field absent, following theupdateMethods/reactionspattern. The read goes through the existing GraphQL budget and degrades to an absent field on failure, so it can never break the detail view. It rides the existing detail query — no new RPC, no extra polling.Proposed and discussed in #8258.
Why
The preview URL is the thing you usually want mid-review, and today it is buried: providers post it as a commit status, so it renders as an indistinguishable "Details" link among lint and test checks. This promotes deployments to a labeled section and a one-click affordance without new machinery — the data rides the existing detail read, refresh, and cache.
UI Changes
Before — the Vercel preview is two generic "Passed" rows inside Checks:
After — a Deployments section names the environment and its state:
Header "Open preview" button with tooltip:
Multiple environments become a menu (real data: vercel/commerce#1535):
Verified end-to-end against live PRs: single environment opens the deployed preview directly; menu entries open their environment's URL.
Checklist
Built with Claude Fable 5 in the Claude Code harness.
🤖 Generated with Claude Code
Note
Medium Risk
Every GitHub PR detail load gains an extra GraphQL read (budgeted, but raises parallel fan-out from 3 to 4), though deployment fetch failures are isolated from the rest of the detail response.
Overview
Adds optional preview deployment data to pull request detail so reviewers can open live environments without digging through generic check rows.
Contracts & API: Introduces
PullRequestDeployment/PullRequestDeploymentStatusand an optionaldeploymentsfield onPullRequestDetail(absent when the host does not report deployments or the read failed—not the same as an empty list).GitHub server path: New
getPullRequestDeploymentsGraphQL read (head commit, newest deployment per environment) with decoding that maps GitHub states, dedupes by environment, and picks environment URL vs build log (logs only for non-success previews).getChangeRequestloads deployments in parallel with the existing detail fetches (concurrency 3 → 4) and degrades withorElseSucceed(() => undefined)so failures never break the page.UI: Summary tab Deployments section with status labels/icons and clickable URLs when present. Header globe opens the sole live preview directly or a menu when multiple environments have URLs.
Docs: Short “See preview deployments” note in the source-control guide. GitHub-only for now; other providers omit the field.
Reviewed by Cursor Bugbot for commit 1fdc0d7. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add pull request deployment preview links to
PullRequestDetailPullRequestDeploymentandPullRequestDeploymentStatusschemas to contracts, and an optionaldeploymentsarray onPullRequestDetail(most recent first)GitHubPullRequestCli;decodePullRequestDeploymentsJsonnormalizes the response, maps GitHub states to internal statuses, deduplicates by environment, and skips unnamed entriesGitHubPullRequestProvider.getChangeRequestincludes deployments withorElseSucceed(() => undefined)so fetch failures never fail the page; concurrency inEffect.allraised from 3 to 4getChangeRequestconcurrency increase from 3 to 4 in GitHubPullRequestProvider.ts may raise GitHub API rate pressure under high load📊 Macroscope summarized 1fdc0d7. 10 files reviewed, 2 issues evaluated, 0 issues filtered, 2 comments posted
🗂️ Filtered Issues