Skip to content

[Website] Detect the repository for pull request numbers - #4120

Merged
adamziel merged 19 commits into
trunkfrom
adamziel/detect-pr-repository
Jul 21, 2026
Merged

[Website] Detect the repository for pull request numbers#4120
adamziel merged 19 commits into
trunkfrom
adamziel/detect-pr-repository

Conversation

@adamziel

@adamziel adamziel commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Bare pull-request numbers in New Playground no longer assume WordPress Core. Playground checks wordpress/wordpress-develop and WordPress/gutenberg in parallel. One match opens directly, two matches show a repository choice, and no match names both repositories that were checked. Full GitHub URLs still route directly.

Repository choices are full-row buttons. They show the PR title, repository, number, and opened date. Recognized URLs use the same card, so the repository and PR or Gutenberg branch remain clear when a long URL scrolls inside the field.

Proxy failures no longer look like missing pull requests. Unavailable GitHub responses, missing workflows, expired artifacts, and builds still in progress receive separate messages. Repository checks use the shared inline progress indicator.

Local development can enable reserved PR numbers for Core-only, Gutenberg-only, both, neither, and proxy failure states. The website README lists the scenarios.

Builds on #4119.

Repository choice

Before After
Desktop Two plain repository buttons Repository cards with PR titles and opened dates
Mobile Two plain repository buttons on mobile Repository cards with readable metadata on mobile

A recognized URL uses the same action:

Desktop Mobile
Gutenberg branch URL shown as a preview card Gutenberg branch URL shown as a preview card on mobile

Failure message

Before After
Desktop Build failure shown as one paragraph Build failure with an outcome and next step
Mobile Build failure shown as one paragraph on mobile Build failure with an outcome and next step on mobile

Testing

  • Enter bare PR numbers that match Core, Gutenberg, both repositories, and neither repository.
  • Paste Core and Gutenberg PR URLs and a Gutenberg branch URL. Open the preview from the recognized card.
  • Exercise unavailable, missing-workflow, expired-artifact, and pending-build responses with the local mock scenarios.
  • Check repository choices, progress, and failure messages at desktop and mobile widths.
Base automatically changed from adamziel/prettier-error-state to trunk July 20, 2026 16:24
@adamziel
adamziel requested review from a team, Copilot and mho22 July 20, 2026 16:24
@adamziel
adamziel force-pushed the adamziel/detect-pr-repository branch from 0812ee7 to ae5a99b Compare July 20, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the PR preview experience to detect whether a bare PR number belongs to WordPress Core or Gutenberg, while also standardizing compact progress feedback and improving a few error-handling surfaces.

Changes:

  • Add inline repository detection for bare PR numbers (Core + Gutenberg checks in parallel) with a repository choice prompt when both match.
  • Introduce/reuse InlineProgress as the compact progress UI, and update styles/tests accordingly.
  • Improve error views/messages for incomplete WordPress downloads and OPFS worker failures; refine Dock pane UI states.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/playground/website/src/lib/state/opfs/opfs-site-storage.ts Improves worker and timeout errors during OPFS writes.
packages/playground/website/src/github/preview-pr/style.module.css Removes overlay/hint styles; adds progress + repository choice layout styles.
packages/playground/website/src/github/preview-pr/form.tsx Adds repository detection flow for bare PR numbers and inline progress messaging.
packages/playground/website/src/github/preview-pr/form.spec.tsx Adds a Vitest test covering dual-repo verification for bare PR numbers.
packages/playground/website/src/components/site-error-modal/get-site-error-view.tsx Adds a dedicated view for incomplete WordPress bundle downloads.
packages/playground/website/src/components/site-error-modal/get-site-error-view.spec.tsx Tests the new incomplete download error view.
packages/playground/website/src/components/saved-playgrounds-panel/style.module.css Adds styled “Blueprint gallery couldn’t load” alert UI.
packages/playground/website/src/components/saved-playgrounds-panel/index.tsx Makes panel headings optional and improves Blueprint gallery error presentation.
packages/playground/website/src/components/pane-loading/style.module.css Renames boot-notice classes to inline-progress classes.
packages/playground/website/src/components/pane-loading/pane-loading.spec.tsx Adds tests for InlineProgress rendering/ARIA behavior.
packages/playground/website/src/components/pane-loading/index.tsx Extracts InlineProgress and reuses it in PlaygroundBootNotice.
packages/playground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx Adjusts autosave decline handling and replaces prompt reopening with a dock notice.
packages/playground/website/playwright/e2e/website-ui.spec.ts Updates E2E assertions for the new PR field label (heading removed).
AGENTS.md Documents when to use PaneLoading vs InlineProgress.
Comments suppressed due to low confidence (1)

packages/playground/website/src/github/preview-pr/form.tsx:218

  • The set of verification error codes is now spread across multiple places (the preview error handling chain and isRepositoryMatch()’s allowlist). To reduce drift/typos over time, consider centralizing the error codes into a shared type/constant (e.g., a string-literal union plus const arrays for “matchable” vs “fatal” codes) and reusing those in both previewPr() and isRepositoryMatch().
			if (!verification.ok) {
				const { error } = verification;

				if (error === 'invalid_pr_number' || error === 'no_ci_runs') {
					setError(
						isBareWordPressPr
							? `Couldn’t find WordPress Core PR ${ref}. If this is a Gutenberg PR, paste its full GitHub URL instead.`
							: `The PR ${ref} does not exist.`
					);
				} else if (
					error === 'artifact_not_found' ||
					error === 'artifact_not_available'
				) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/website/src/github/preview-pr/form.tsx
Comment thread packages/playground/website/src/github/preview-pr/form.tsx
Comment thread packages/playground/website/src/github/preview-pr/form.tsx
Comment thread packages/playground/website/src/github/preview-pr/form.spec.tsx Outdated
Comment thread packages/playground/website/src/github/preview-pr/form.tsx
@adamziel
adamziel merged commit c3133f3 into trunk Jul 21, 2026
102 of 103 checks passed
@adamziel
adamziel deleted the adamziel/detect-pr-repository branch July 21, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment