[Website] Run edited Blueprints in fresh Playgrounds - #4067
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Blueprint “Run” behavior so edited Blueprints for stored Playgrounds (autosaved + explicitly saved) execute in a newly created autosaved Playground instead of mutating the existing one, preserving the source for comparison.
Changes:
- Adjust stored site creation to persist Blueprint bundles within the same failure-handling scope as site creation, cleaning up partial bundle copies on error.
- Update Blueprint editor run flow to create/activate a fresh autosaved Playground for stored sites, with a run guard to prevent duplicate creation and a UI hint reflecting the new behavior.
- Expand unit + e2e coverage to validate bundle-copy cleanup, duplicate-run guarding, and preserved source Playground behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/playground/website/src/lib/state/redux/slice-sites.ts | Moves bundle persistence into try/catch with site creation to ensure partial bundle cleanup on failure. |
| packages/playground/website/src/lib/state/redux/slice-sites.spec.ts | Adds a regression test ensuring failed bundle copy triggers bundle deletion and blocks site creation. |
| packages/playground/website/src/lib/state/opfs/opfs-site-storage.ts | Clarifies documentation for WordPress-files cleanup behavior used by autosave recreation APIs. |
| packages/playground/website/src/lib/state/opfs/opfs-autosave-reset.ts | Updates/clarifies docs around the autosave reset helper and when it should be used. |
| packages/playground/website/src/components/blueprint-editor/blueprint-bundle-editor.module.css | Adds styling for a new “run hint” message in the Blueprint editor UI. |
| packages/playground/website/src/components/blueprint-editor/BlueprintBundleEditor.tsx | Changes run behavior: stored sites run into a new autosaved Playground; adds run guard + updates UI text and dispatch flow. |
| packages/playground/website/src/components/blueprint-editor/BlueprintBundleEditor.spec.tsx | Adds/updates unit tests for the new run behavior, guarding, and messaging. |
| packages/playground/website/playwright/e2e/website-ui.spec.ts | Updates e2e expectations and asserts source autosave remains intact after running the edited Blueprint into a new Playground. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
adamziel
added a commit
that referenced
this pull request
Jul 15, 2026
Removes `window.playgroundSites.recreateAutosavedSite()` and the same-slug autosave reset path. Stacked on #4067, which makes edited Blueprints open in a fresh Playground. ## Background `recreateAutosavedSite()` replaced an autosave in place: it wrote new setup metadata under the existing slug, deleted that site's WordPress files, and booted the replacement under the same identity. The Dock no longer does that. It creates a fresh Playground and leaves the current site intact. No repository caller still needs the destructive compatibility path. ## This change The public method, `resetAutosavedSiteSpec()`, and `resetAutosavedSiteFilesWithPendingMarker()` are removed together with their dedicated tests. This is a breaking change for external callers of `window.playgroundSites.recreateAutosavedSite()`. FWIW, I didn't find any via a SourceGraph lookup. Boot still recognizes `opfsSiteRemovalPending`. Older builds may have persisted that marker before an interrupted reset. Removing the reader would let those sites mount WordPress files that do not match their metadata. ## Testing Test with: ``` npm exec nx -- test playground-website --runInBand npm exec nx -- run playground-website:lint npm exec nx -- run playground-website:typecheck npm exec nx -- run playground-website:build:standalone npm exec nx -- run playground-website:e2e:playwright -- sites-api.spec.ts --project=chromium git diff --check ```
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.
Running an edited Blueprint now creates a new autosaved Playground instead of deleting the source site's WordPress files.
Background
Before this PR, running a Blueprint from an autosaved Playground did three things:
That destroyed the site used to author the Blueprint. Explicitly saved Playgrounds already ran edited Blueprints in a new Playground, so the same button had different consequences depending on how the source was stored.
This change
All stored Playgrounds now copy the edited Blueprint bundle into a fresh autosave and activate it. The source Playground, its WordPress files, and its identity remain available. Autosaved Blueprint drafts also remain attached to their source. Temporary Playgrounds still reuse the current site because there is no stored source to preserve. Their action says
Discard current Playground & run Blueprint.Screenshots
Before
An autosaved Playground was reset in place
After
When editing a stored Playground's Blueprint, offer to run the updated Blueprint in a dedicated new Playground
When editing an unsaved Playground's Blueprint – explicitly explain the unsaved Playground will be discarded
The Run action waits for the pending editor write before copying the bundle. A synchronous guard ignores repeated clicks while creation is in progress. Autosave pruning excludes both the source and destination. A pruning failure is logged after the new Playground is committed; reporting the run as failed would invite a retry and create a duplicate. If copying the bundle or writing site metadata fails,
createStoredSite()removes the partial bundle.Testing
The unit tests cover temporary and stored runs, the save barrier, repeated clicks, retry after creation failure, pruning failure, the text shown for preserved sources, and partial-bundle cleanup. The browser tests verify that autosaved and explicitly saved sources survive while the edited Blueprint boots in a new autosave.
Test with: