📚 Clarify plugin save failure recovery

Describe rejection while the error remains and refer to persistence
for recovery on file reopening or role changes.

AI-assisted-by: gpt-6.1-terra
This commit is contained in:
Andrey Antukh 2026-11-24 10:02:54 +00:00
parent 0ea9ed3297
commit 87a15a7d33

View File

@ -2,7 +2,7 @@
- Start at `app.plugins.persist` for `penpot.waitForSave` and `app.plugins.events` for `contentsave` and `contentrollback`. The runtime forwarder requires `content:read` for `waitForSave`; new event names must also be added to runtime `validEvents`, and a stale runtime build can reject them.
- `waitForSave(timeout?)` observes the shared persistence queue, not only the plugin's commits. Its default timeout is 60 seconds. It waits briefly for incoming commits, capped by the timeout; if work is pending it forces persistence and races settlement against rollback start or completion. A rollback must reject even if the status later becomes `:saved`. See `mem:frontend/workspace-persistence`.
- An earlier `:error` rejects even when no work is pending: a slow retry produces `save-retrying`, while a terminal failure keeps rejecting until the file is reopened. Other error codes include `save-timeout`, `rolled-back` and the stored failure code (default `save-failed`). Timeout validation accepts a positive finite number up to `u/max-timeout`; rejection must be an `Error`, not a string.
- An earlier `:error` rejects even when no work is pending: a slow retry produces `save-retrying`, while a terminal failure keeps rejecting while the error remains. Reopening a file or a role change can trigger recovery; see `mem:frontend/workspace-persistence` for its conditions. Other error codes include `save-timeout`, `rolled-back` and the stored failure code (default `save-failed`). Timeout validation accepts a positive finite number up to `u/max-timeout`; rejection must be an `Error`, not a string.
- `contentsave` is a debounced state watch for transitions to `:saved` and passes no value. It does not prove the buffer is empty.
- `contentrollback` subscribes to `::dps/rolled-back`, not the state watch. It is not debounced and is delivered asynchronously after reverted or reloaded data is in state. Its `{fileIds, pageIds, shapeIds}` payload comes from page-shape redo changes in reverted commits. Remove the stream subscription when the listener is removed.
- MCP forwards rollback notices with task responses and retains unsent notices in per-file plugin local storage when available. Delivery is not an end-to-end acknowledgment; for its storage permissions, handoff and failure limits see `mem:mcp/save-and-rollback`.