Skip to content

[Website] Track Blueprint runs until their first OPFS copy succeeds - #4126

Merged
adamziel merged 1 commit into
trunkfrom
blueprint-run-source-lifecycle
Jul 20, 2026
Merged

[Website] Track Blueprint runs until their first OPFS copy succeeds#4126
adamziel merged 1 commit into
trunkfrom
blueprint-run-source-lifecycle

Conversation

@adamziel

@adamziel adamziel commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Part of #4099.

Running a stored Blueprint creates another OPFS-backed Playground before
WordPress boots. Until its first MEMFS-to-OPFS copy succeeds, a failed run
needs to know which stored Playground it should return to.

This records that return target when the run is created, carries it through
retries, and clears it in the same metadata write that completes the first
OPFS copy. Failed and interrupted copies keep the target. Abandoned runs
remain eligible for normal autosave cleanup.

There is no UI change here. Follow-up work uses the return target to keep
unfinished runs out of Recent and offer explicit recovery.

Testing

Run a Blueprint from a stored Playground and confirm the new Playground boots
and saves normally. Retry before its first save finishes and confirm the same
stored Playground remains the return target.

@adamziel
adamziel force-pushed the error-recovery-preserve-shell-parameters branch from e4d16c0 to 75d54e8 Compare July 20, 2026 19:34
@adamziel
adamziel force-pushed the blueprint-run-source-lifecycle branch from e0b0fe3 to 13c0f07 Compare July 20, 2026 19:34
Base automatically changed from error-recovery-preserve-shell-parameters to trunk July 20, 2026 20:30
@adamziel
adamziel force-pushed the blueprint-run-source-lifecycle branch from 13c0f07 to 214ac91 Compare July 20, 2026 20:30
A failed Blueprint run needs a stored Playground it can return to. Record
that target when the run is created and carry it through retries.

Clear the return target in the same metadata write that completes the first
OPFS copy. Failed and interrupted copies keep it.
@adamziel
adamziel force-pushed the blueprint-run-source-lifecycle branch from 214ac91 to 45489f0 Compare July 20, 2026 21:06
@adamziel
adamziel marked this pull request as ready for review July 20, 2026 22:51
@adamziel
adamziel requested review from a team, brandonpayton and Copilot July 20, 2026 22:51

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.

Adds persistent “return target” metadata for Blueprint runs so retries/failures can recover back to the original stored Playground until the first MEMFS→OPFS copy succeeds.

Changes:

  • Extends stored site metadata with siteSlugToReturnToIfBlueprintFails and threads it through stored-site creation.
  • Clears the return target on successful initial OPFS sync (in the same metadata write that marks initialOpfsSyncPending: false).
  • Updates Blueprint editor + tests to preserve the original return target across reruns and cleanup behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/playground/website/src/lib/state/redux/slice-sites.ts Adds the return-target field to stored site creation options and SiteMetadata.
packages/playground/website/src/lib/state/redux/slice-sites.spec.ts Updates stored-site-creation expectations to include the new metadata field.
packages/playground/website/src/lib/state/redux/boot-site-client.ts Passes the return target into initial OPFS sync and clears it after first successful sync.
packages/playground/website/src/lib/state/redux/boot-site-client.spec.ts Adds a test asserting the return target is cleared after initial OPFS copy completes.
packages/playground/website/src/components/blueprint-editor/BlueprintBundleEditor.tsx Persists/propagates the return target when rerunning unfinished Blueprint runs; adjusts autosave pruning exclusions.
packages/playground/website/src/components/blueprint-editor/BlueprintBundleEditor.spec.tsx Updates run behavior tests to assert the original return target is preserved.

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

Comment on lines +482 to +485
excludeSlugs: [
siteSlugToReturnToIfBlueprintFails,
newSite.slug,
],
},
});
const state = createState(site);
const dispatch = createDispatch(state);
Comment on lines +604 to +606
...(siteSlugToReturnToIfBlueprintFails
? { siteSlugToReturnToIfBlueprintFails: undefined }
: {}),
@adamziel
adamziel merged commit 7baa582 into trunk Jul 20, 2026
104 of 105 checks passed
@adamziel
adamziel deleted the blueprint-run-source-lifecycle branch July 20, 2026 23:15
adamziel added a commit that referenced this pull request Jul 21, 2026
…ggestions (#4127)

Part of #4099.

Builds on #4126.

An unfinished stored Blueprint run is recovery state, not a normal
autosave. Keep it out of Recent and setup-URL restore suggestions until
its first OPFS sync succeeds and clears the return target.

Both comparisons use the same stored Playground and the same failed run,
created with unavailable WordPress version `999.9`. Before this change,
reloading lists the failed run under Recent autosaves. After this
change, only the Playground that launched it remains visible.

### Desktop

| Before | After |
| --- | --- |
| <img width="440" alt="Failed Blueprint run listed under Recent
autosaves on desktop"
src="https://raw.githubusercontent.com/WordPress/wordpress-playground/dfe5d4913c/before-recent-desktop.png">
| <img width="440" alt="Failed Blueprint run omitted from Recent
autosaves on desktop"
src="https://raw.githubusercontent.com/WordPress/wordpress-playground/dfe5d4913c/after-recent-desktop.png">
|

### Mobile

| Before | After |
| --- | --- |
| <img width="260" alt="Failed Blueprint run listed under Recent
autosaves on mobile"
src="https://raw.githubusercontent.com/WordPress/wordpress-playground/dfe5d4913c/before-recent-narrow.png">
| <img width="260" alt="Failed Blueprint run omitted from Recent
autosaves on mobile"
src="https://raw.githubusercontent.com/WordPress/wordpress-playground/dfe5d4913c/after-recent-narrow.png">
|

## Testing

Run a stored Playground's Blueprint with an unavailable WordPress
version. Reload and confirm the unfinished run is not offered in Recent
or as an autosave to restore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment