Files
buzz/desktop/src-tauri
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 d79b86a3d9 fix(store-journal): run_recovery_gate enforces pre-migration ordering
GAP 1: Add store_recovery_failed guard at top of mutate_store — returns
Err immediately if the boot recovery flag is set, blocking all journaled
mutations after a recovery failure.

GAP 2: recover_interrupted_file_commits now returns usize (unresolved
commit count) instead of (). Every skip branch increments the counter;
lib.rs sets store_recovery_failed and early-returns when count > 0 OR Err
— unresolved commits are no longer log-and-proceed.

GAP 3: Extract run_recovery_gate(anchor, store_work_closure) — runs
file-commit recovery, fails closed on Err or unresolved count > 0, and
only then invokes the closure. lib.rs calls it with the migrations entry
inside the closure; tests drive the same function. The ordering invariant
lives in one place and cannot drift.

Tests: test_setup_order_recovery_completes_before_migration_reads_canonical
drives run_recovery_gate and asserts the closure sees the repaired
canonical; test_recovery_gate_failure_skips_closure_and_returns_err asserts
the closure never runs on unresolved recovery; GAP 2 tests assert
hash-mismatch and rename-failure scenarios return unresolved count > 0.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-04 21:34:15 -04:00
..