Migrate sync queue persistence to store adapters

This commit is contained in:
Rijad Zuzo
2026-02-15 19:38:46 +01:00
parent 1502360051
commit add0105e6b
13 changed files with 293 additions and 18 deletions
+3
View File
@@ -28,6 +28,9 @@ Default local store:
- `Hive` (`USE_HIVE_LOCAL_DB=true` by default)
- first-run migration imports legacy `shared_preferences` payload when present
- applies to both:
- local product state (`LocalRepository`)
- sync queue state (`SyncQueueRepository`)
Optional migration path:
+29
View File
@@ -2,6 +2,35 @@
Updated: 2026-02-15
## Latest Milestone (2026-02-15): Sync Queue Storage Adapter + Hive Migration
Extended the storage abstraction approach to sync queue persistence:
- Added sync storage abstraction:
- `lib/features/sync/storage/sync_state_store.dart`
- Added concrete sync stores:
- `lib/features/sync/storage/sync_state_store_shared_prefs.dart`
- `lib/features/sync/storage/sync_state_store_hive.dart`
- `lib/features/sync/storage/sync_state_store_in_memory.dart`
- provider wiring: `lib/features/sync/storage/sync_state_store_provider.dart`
- Refactored sync queue repository:
- `lib/features/sync/sync_queue_repository.dart`
- no direct `shared_preferences` dependency
- store-agnostic read/write path via `SyncStateStore`
- one-time migration path from legacy shared prefs sync payload into Hive
- Updated tests to use explicit in-memory store overrides where deterministic:
- `test/features/sync/sync_queue_repository_test.dart`
- `test/features/sync/sync_coordinator_test.dart`
- `test/features/local/local_repository_test.dart`
- `test/features/responsive/responsive_views_smoke_test.dart`
- Added migration coverage:
- `test/features/sync/storage/sync_queue_hive_migration_test.dart`
Validation for this milestone:
- `flutter analyze` -> pass
- `flutter test` -> pass
## Latest Milestone (2026-02-15): Local Store Adapter Layer (DB Migration Scaffold)
Implemented a persistence boundary so local app state is no longer tightly coupled to `shared_preferences` internals: