Skip to content

fix(saver): propagate save failures to callers - #3033

Merged
neSpecc merged 4 commits into
codex-team:nextfrom
Sion612:fix/saver-reject-3030
Nov 28, 2026
Merged

neSpecc merged 4 commits into
codex-team:nextfrom
Sion612:fix/saver-reject-3030

Conversation

@Sion612

@Sion612 Sion612 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Saver.save() currently logs caught errors without rethrowing them,
allowing a failed save to resolve with undefined.

Rethrow the original error after logging so callers can handle the rejection.
Normal invalid-block filtering and the existing Tune error-handling behavior
remain unchanged.

Add regression coverage for synchronous Tool.save() throws, asynchronous
rejections, invalid-block filtering, and the existing rejection when saving
in read-only mode.

Fixes #3030.

Verification

Local validation of the reviewed candidate:

  • Base implementation with the same regression tests:
    4 passing / 2 expected failures because save resolved with undefined.
  • Fixed Saver spec: 6/6 passing in Chrome.
  • Five related specs: 30/30 passing in Chrome.
  • Separate production-build review: 5/5 Chrome checks covering retry,
    multi-block data preservation, validation rejection, existing Tune behavior,
    and awaited read-only transitions.
  • Test and production builds, lint, and whitespace checks passed.
    Existing warnings were retained.

Full Cypress, Firefox, Edge, and a standalone TypeScript check were not run.
The separate review probes are validation evidence and are not included
in this PR.

This change does not implement automatic rollback of the read-only state
after a failed transition.

Implementation and local verification were AI-assisted.

@neSpecc neSpecc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the fix is right: Saver.save() now rethrows, so await editor.save() rejects with the original error instead of resolving to undefined.

A few things before merge:

  1. readOnly.toggle(true) sets the read-only flag before calling Saver.save() (readonly.ts, ~70-115). If saving fails, the editor stays flagged as read-only while blocks are still editable, and later editor.save() calls fail with "can not be saved in read-only mode". Now that the error is propagated, please set the flag only after a successful save (or roll it back on error) and add a test for it.

  2. Please add a CHANGELOG entry under 2.32.0 and rebase onto current next. 2.32.0-rc.5 is already taken by #3048, so either bump to rc.6 or leave the bump to the Bump version job.

@neSpecc
neSpecc merged commit 2b94988 into codex-team:next Nov 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silent Data Loss & Broken Error Contract in Saver.save()

2 participants