[Website] Preserve Playground records when OPFS deletion fails - #4128
Merged
Conversation
adamziel
force-pushed
the
preserve-opfs-delete-failures
branch
from
July 21, 2026 00:02
4aa77f3 to
6e81dd0
Compare
adamziel
marked this pull request as ready for review
July 21, 2026 00:16
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 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.
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
force-pushed
the
preserve-opfs-delete-failures
branch
from
July 21, 2026 00:18
6e81dd0 to
0b1ac83
Compare
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.
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/catchbelongs there instead of inremoveSite().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.