From 3f1c99c5f250c54828fc1ae415f4e8bd27db8a97 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Sat, 10 Oct 2026 20:43:55 -0700 Subject: [PATCH] fix: keep pages open when password changes need sync Refuse password changes with unpublished edits before stopping the worker or removing the current session. Keep the specific queue reason visible instead of handing the refusal to the generic section-open error path. Fixes #116 Assisted-by: gpt-6.1-sol --- crates/snowbound/src/protection.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/snowbound/src/protection.rs b/crates/snowbound/src/protection.rs index 28f6dd93fe9112d9bc1781cefe0718119bce527a..87c93cf06142b838243b8dfd5da7e1b78ff651a6 100644 --- a/crates/snowbound/src/protection.rs +++ b/crates/snowbound/src/protection.rs @@ -738,11 +738,14 @@ impl State { .is_some_and(|session| Arc::ptr_eq(session.section.replica(), &replica)); if open { state.persist()?; - let pending = replica.pending()?.last().map_or(0, |edit| edit.id); - if pending > through { - state.set_password(library, path, key, password); - return Ok(()); - } + } + let pending = replica.pending()?.last().map_or(0, |edit| edit.id); + if open && pending > through { + state.set_password(library, path, key, password); + return Ok(()); + } + if pending > 0 { + return Err("Edits to the section wait to be published".into()); } let stopping = state .session -- 2.54.0