authorclover caruso <git@paperclover.net> 2026-10-10 20:43:55-07:00
committerclover caruso <git@paperclover.net> 2026-10-10 22:56:06-07:00
log3f1c99c5f250c54828fc1ae415f4e8bd27db8a97
tree3a249209d94049e2a803ca7411845f84bffa20ce
parent568f5f7053dedb5040949c5833f1d2b0023d1f57
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU (~clover)

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

1 files changed, 8 insertions(+), 5 deletions(-)

crates/snowbound/src/protection.rs+8-5
......@@ -738,11 +738,14 @@ impl State {
738738 .is_some_and(|session| Arc::ptr_eq(session.section.replica(), &replica));
739739 if open {
740740 state.persist()?;
741 let pending = replica.pending()?.last().map_or(0, |edit| edit.id);
742 if pending > through {
743 state.set_password(library, path, key, password);
744 return Ok(());
745 }
741 }
742 let pending = replica.pending()?.last().map_or(0, |edit| edit.id);
743 if open && pending > through {
744 state.set_password(library, path, key, password);
745 return Ok(());
746 }
747 if pending > 0 {
748 return Err("Edits to the section wait to be published".into());
746749 }
747750 let stopping = state
748751 .session