A device can drop vault changes it can no longer send (#999) #25
Loading…
Reference in a new issue
No description provided.
Delete branch "board/999-5d4440"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Board #999. Stacked on PR #24 (#997): merge that first. This branch includes #24's commits; once #24 is in main, merging main here leaves only this ticket's diff. For this ticket alone, see
git diff origin/board/997-df286d...board/999-5d4440.The problem: since #997, a device holding unsent changes to a vault where you're now only a reader warns "you can only read this vault" on every sync. Nothing let you drop those changes.
Client:
Session::discard_changes(id) -> usize. It pulls, then downloads the vault from scratch, because an edit overwrote the server's copy and a delete removed it.Vault::same_head) as the copy this device already had.Rollback.Vault::changes()(a count),changed()(added or edited items) andsame_head().CLI:
plaintext vault reset Vsays how many changes it dropped, or that there were none. It lists the titles of the added or edited items it drops, since they may exist nowhere else.Tests: I extended
a_reader_s_writes_are_refused_not_kept_on_the_device. In it, bob is a writer who makes an offline edit, a delete and a rename, and is then demoted.vault reset <id>.Rollbackwith all 3 changes kept. The test fails with the head check removed.cargo test --lockedand clippy-D warningspass.Follow-up: #1000. Unsent changes to a vault you were removed from (not demoted) still stay without a warning. This predates this PR.
🤖 Generated with Claude Code