Atomic saves and failures
How page, title, SEO, draft, and part changes are committed or restored together.
Reference#
Every write of one save (the page, its title and SEO, its drafts and the shared header/footer parts), AI edit-page/save-draft/publish-page/discard-draft and the editor's Discard run inside cantata_edit_atomic() in includes/rest.php. On core wpdb/MySQL-compatible storage with transactional posts/postmeta tables this is a transaction (or, inside a caller's own transaction, a uniquely named savepoint). Elsewhere (MyISAM, SQLite or multi-connection drop-ins, a lost savepoint) the rows read at the start are put back, but only the columns and meta this save itself wrote and only while they still hold what it wrote: a value another request stored meanwhile is kept and the undo reports itself incomplete. Failures answer cantata_edit_not_saved (undone: true), cantata_edit_save_incomplete (undone: false: part may be live) or cantata_edit_transaction_lost (stored, but a hook's implicit commit ended the caller's transaction); the editor shows the site's own message and offers a reload, never a blind retry, for the last two. Side effects outside these posts (emails, remote calls, other tables in snapshot mode) are the hooks' own.