Repository navigation
Conversation
… that fill the limit
chubes4
added a commit
that referenced
this pull request
Nov 19, 2026
…hat WordPress.com reports (#6084) ## Related issues - Related to #5980 and #6083. Follows wpcom #262449, which makes WordPress.com report each preview's `title` and `origin_id`. ## How AI was used in this PR Claude, at Chris Huber's direction, traced which preview details only Studio's saved records still knew. It then wrote the WordPress.com change that reports them, and this change, which uses them. ## Proposed Changes WordPress.com already decides which previews exist, their address, share link, expiry, linked live site, count and limit. Studio re-syncs its saved previews with `/wow-funnel/pending` on every list. Two things only Studio's saved record still knew: - **The local site the preview belongs to.** A preview whose record went missing was listed with no local site. That includes ones whose first build failed, and ones from before a reinstall. In the Share panel it only counted toward the limit and was never shown. - **Its name.** A preview made elsewhere showed only its address. Studio already sends both when it creates a preview, as `origin_id` and `blog_title`. With wpcom #262449, `/wow-funnel/pending` returns them. `origin_id` goes only to the app that created the preview. - **Provider:** `previews.list()` passes on `title` and `originId`. - **`reconcilePreviews()`:** a preview with no local site here is put back with the local site WordPress.com names, if that site is on this computer. A preview Studio hasn't saved takes its name from its title. Saved previews keep their local site and name, because renaming a preview is local. This removes the last reason the saved records are needed to show a site's previews. What Studio still stores locally is its own sync state (`versionId`, `syncedAt`), as it does for any connected site. Until #262449 deploys, the fields are absent and nothing changes. ## Testing Instructions - `npx vitest run packages/providers/wpcom/sites/tests/previews.test.ts apps/cli/lib/tests/snapshots.test.ts`. The 2 new tests fail without the change: - The list passes on `title` and `originId`, and leaves out empty ones. - Reconcile puts an unsaved or unlinked preview back with a local site that's here. It keeps a saved preview's site, leaves an unknown origin unlinked, and names unsaved previews from their title. - After wpcom #262449 deploys: 1. Remove a preview from `~/.studio/cli.json` `snapshots`. 2. Run `studio preview list --path <site>`. 3. Check that the preview is listed under its site again, with its name. ## Pre-merge Checklist - [x] ESLint and Prettier are clean. `tsc` for `packages/providers` is clean, and `apps/cli` has no new errors. - [x] Providers and CLI tests pass (`packages/providers`, `apps/cli/lib`, `apps/cli/commands/preview`). One timing test, `run-wp-cli-command`, failed in the full run and passed on its own.
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
Claude, at Chris Huber's direction, traced the count against the list against WordPress.com's
/wow-funnel/pendingand the backup import logs, then implemented and tested the change.Proposed Changes
Studio takes the preview count and the limit from WordPress.com, but builds the list it shows from the previews saved for the local site. Two gaps let them drift apart:
createPreviewthrew and stopped. Nothing discarded the funnel site, so it stayed pending and counted toward the limit until it expired, but Studio had never saved it. Now Studio discards the site on an import failure, then reports the error. A timeout still keeps the site, since its import may still finish. If the discard itself fails, the user still sees the import error.studio preview listalready brings them in from WordPress.com. At the limit, the Share panel now lists them under the limit notice, each with Delete, so the user can make room.Testing Instructions
npx vitest run packages/providers/wpcom/sites/tests/previews.test.ts apps/ui/src/features/sharing.Pre-merge Checklist
tscforapps/uiandpackages/providersare clean.