From 685cafa8f976fdd94168cfc933ad5389f8b4c617 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Tue, 29 Sep 2026 18:04:01 +0100 Subject: Hold an app uncertain whatever its save changed, not only a list A save whose tree commit may or may not be stored leaves the app apart from its store: no save may follow until it starts again from what the store has. The app was marked so only when the save also logged a list's change, so a save of numbers alone that came back uncertain let the next event (a list's alone) save on the state the memory had rolled back to: after a restart, count 1 and a row made from count 0 (review 004, F2). Now any uncertain tree commit marks it; a failed one still takes back the logged entry. test-module's uncertain_numbers does the review's case: the list's event is refused, and the store is the commit's. --- core/module-save.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'core/module-save.c') diff --git a/core/module-save.c b/core/module-save.c index dbf45a9..d38437f 100644 --- a/core/module-save.c +++ b/core/module-save.c @@ -895,12 +895,11 @@ PureResult pure_save_commit(PureApp *app, const double *values, void *const *doc free(payload); if (result == PURE_OK && tree) { result = app->data.save(app->data.context, documents, document_count, drafts, count, revisions); - /* The logged entry is on the device: taken back when the tree's commit - * failed, or, when that may yet be stored, no save follows. */ - if (result != PURE_OK && payload_size) { - if (result == PURE_UNCERTAIN) app->uncertain = true; - else pure_log_retract(app->log); - } + /* A commit that may yet be stored leaves the app apart from its store, + * whatever the save changed: no save follows until it starts again. + * One that failed takes back the logged entry, which is on the device. */ + if (result == PURE_UNCERTAIN) app->uncertain = true; + else if (result != PURE_OK && payload_size) pure_log_retract(app->log); } if (result == PURE_OK) { for (size_t k = 0; k < count; ++k) -- cgit v1.2.3