Skip to content

[Website] Preserve Playground records when OPFS deletion fails - #4128

Merged
adamziel merged 1 commit into
trunkfrom
preserve-opfs-delete-failures
Jul 21, 2026
Merged

[Website] Preserve Playground records when OPFS deletion fails#4128
adamziel merged 1 commit into
trunkfrom
preserve-opfs-delete-failures

Conversation

@adamziel

@adamziel adamziel commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Part of #4099.

Builds on #4127.

A failed OPFS deletion now leaves the Playground in Redux so the deletion can be retried.

Background

A stored Playground has files in OPFS and a record in Redux. removeSite() used to catch an OPFS error and then remove the Redux record anyway. It also treated missing browser storage as a successful deletion. In both cases, the Playground disappeared from the UI while its deletion had not succeeded.

This change

removeSite() now checks that browser storage is available and removes the Redux record only after OPFS deletion succeeds. Otherwise the error reaches the caller and the record remains.

Autosave pruning is allowed to skip a broken site and keep going. It catches each deletion failure in the pruning loop, logs it, and tries the next candidate. This is why the try/catch belongs there instead of in removeSite().

Testing

There is no practical UI control for forcing these storage failures. The focused tests cover unavailable browser storage, a rejected OPFS deletion, and a prune pass where one deletion fails while the next succeeds.

Base automatically changed from exclude-unfinished-blueprint-runs to trunk July 21, 2026 00:02
@adamziel
adamziel force-pushed the preserve-opfs-delete-failures branch from 4aa77f3 to 6e81dd0 Compare July 21, 2026 00:02
@adamziel
adamziel marked this pull request as ready for review July 21, 2026 00:16
@adamziel
adamziel requested review from a team, Copilot and zaerl July 21, 2026 00:16

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 site deletion flow so OPFS deletion failures no longer silently remove the Playground record from Redux, enabling retries and improving correctness during pruning.

Changes:

  • Make removeSite() only remove the Redux record after OPFS deletion succeeds (otherwise rethrow).
  • Make autosave pruning best-effort by catching per-site deletion failures, logging, and continuing.
  • Add focused tests for deletion failure and prune-pass continuation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/playground/website/src/lib/state/redux/slice-sites.ts Changes deletion semantics + best-effort autosave pruning behavior
packages/playground/website/src/lib/state/redux/slice-sites.spec.ts Adds tests for OPFS deletion failure and pruning continuation
packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts Updates API docs to reflect new throw conditions

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

Comment thread packages/playground/website/src/lib/state/redux/slice-sites.ts
Removing the Redux record after OPFS rejected the delete made the stored files inaccessible and left callers unable to retry. Let direct deletion report the storage error and keep the record intact. Autosave pruning remains best-effort by handling each failed deletion locally and moving on to the next candidate.
@adamziel
adamziel force-pushed the preserve-opfs-delete-failures branch from 6e81dd0 to 0b1ac83 Compare July 21, 2026 00:18
@adamziel
adamziel merged commit 4f53274 into trunk Jul 21, 2026
53 checks passed
@adamziel
adamziel deleted the preserve-opfs-delete-failures branch July 21, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment