Skip to content

[Website] Queue Blueprint Run during OPFS synchronization - #4118

Merged
adamziel merged 1 commit into
trunkfrom
blueprint-run-opfs-sync-barrier
Jul 20, 2026
Merged

[Website] Queue Blueprint Run during OPFS synchronization#4118
adamziel merged 1 commit into
trunkfrom
blueprint-run-opfs-sync-barrier

Conversation

@adamziel

@adamziel adamziel commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Part of #4099.

Running a stored Blueprint creates and activates another Playground. If the source Playground is still making its first MEMFS-to-OPFS copy, activation unmounts the iframe that owns that copy before it can be recorded as complete. A later page load can then reject the source as interrupted.

This PR keeps Run available during synchronization without switching sites immediately. Clicking it queues one request, locks the editor, and shows a waiting state. When the live OPFS status clears, the normal Run guards are checked again before the new Playground is created and activated. A reported sync error cancels the request and leaves Run available for an explicit recovery click.

The persisted initialOpfsSyncPending flag is deliberately not used as the queue condition. A failed boot can leave it set when there is no active copy to wait for.

Testing

Open a stored Playground's Blueprint editor while it is saving. Click Run and confirm the editor waits without switching Playgrounds, then runs after saving completes. If saving fails, confirm the queued Run is cancelled and the button becomes available again.

@adamziel adamziel changed the title [Website] Disable Blueprint Run during OPFS synchronization Jul 20, 2026
@adamziel
adamziel force-pushed the blueprint-run-opfs-sync-barrier branch 2 times, most recently from 9d5c809 to 79413a5 Compare July 20, 2026 16:06
@adamziel
adamziel marked this pull request as ready for review July 20, 2026 16:07
@adamziel
adamziel requested review from a team, bgrgicak and Copilot July 20, 2026 16:07

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.

This PR prevents stored Blueprint “Run” from activating a new Playground while the source Playground is still synchronizing MEMFS → OPFS, by queuing the Run until the live sync finishes (or canceling on sync error).

Changes:

  • Queue Blueprint Run when OPFS sync is in progress; lock the editor and show a waiting state until sync completes.
  • Resume queued Run when sync clears; cancel queued Run on sync error or site change.
  • Add tests covering queued Run behavior, cancellation on sync error, and ignoring stale metadata flags.

Reviewed changes

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

File Description
packages/playground/website/src/components/blueprint-editor/BlueprintBundleEditor.tsx Adds OPFS-sync-aware Run queuing, editor lockout while queued, and UI messaging updates.
packages/playground/website/src/components/blueprint-editor/BlueprintBundleEditor.spec.tsx Adds unit tests for queued Run during sync, cancellation on sync error, and ensures metadata alone doesn’t block Run.

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

@adamziel
adamziel force-pushed the blueprint-run-opfs-sync-barrier branch from 79413a5 to 0f818aa Compare July 20, 2026 16:30
Running a stored Blueprint activates another site and unmounts the source
iframe. Doing that while its initial MEMFS-to-OPFS copy is active can leave
the source unbootable.

Accept Run while the copy is active, lock the editor, and resume after the
live sync clears. A reported sync error cancels the request and leaves Run
available for explicit recovery. Do not wait on initialOpfsSyncPending; failed
boots can leave it set without a live copy.
@adamziel
adamziel force-pushed the blueprint-run-opfs-sync-barrier branch from 0f818aa to 8c7566a Compare July 20, 2026 16:55
@adamziel
adamziel merged commit b374830 into trunk Jul 20, 2026
53 checks passed
@adamziel
adamziel deleted the blueprint-run-opfs-sync-barrier branch July 20, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment