Files
buzz/desktop/src-tauri
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 8ac991e0ef fix(b1-store): round-9 — single-owner file recovery, verifiable migration
Fix A: single-owner file recovery ordering and seam test.
- lib.rs: run_file_commit_recovery() now runs BEFORE spawn_boot_recovery()
  is spawned, establishing synchronous pre-admission file repair.
- txn.rs: run_boot_recovery_at() (the background publication task) no longer
  calls recover_interrupted_file_commits — it is publication-only. File repair
  has exactly one owner: the synchronous run_file_commit_recovery call.
- txn.rs: add file_commit_recovery_at_pub() (cfg(test)) for testing the sync
  path without AppHandle.
- Two seam tests in store_journal_fix_tests.rs:
  test_background_recovery_does_not_repair_files: proves run_boot_recovery_at
  leaves stage files and phase rows untouched.
  test_sync_file_recovery_repairs_dangling_intent_row: proves
  file_commit_recovery_at_pub renames stages and advances phase to committed.

Fix B: verifiable schema migration.
- schema.rs: replace let _ = conn.execute_batch() with PRAGMA table_info-based
  column inspection, ADD COLUMN only for missing columns, errors propagated,
  user_version stamped inside the same transaction as the migration. Post-commit
  verification ensures required columns are present.
- New table_column_names() helper for column introspection.
- Three migration tests in store_journal_fix_tests.rs:
  test_schema_migration_from_v2_adds_all_columns: v2 DB gets all three columns.
  test_schema_migration_from_partial_v3_adds_missing_d_tag: partial v3 gets d-tag.
  test_schema_migration_idempotent_on_v4: re-running on v4 is a no-op.

Also update existing file-commit tests to use file_commit_recovery_at_pub
(store_journal_tests.rs crash test, store_journal_fix_tests.rs hash-verify tests)
since run_boot_recovery_at no longer performs file repair.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-04 18:24:37 -04:00
..