Add sync queue orchestration and local mutation envelopes

This commit is contained in:
Rijad Zuzo
2026-02-15 16:56:55 +01:00
parent aaabc51d2d
commit d711f270dd
8 changed files with 1411 additions and 101 deletions
+32 -4
View File
@@ -2,6 +2,34 @@
Updated: 2026-02-15
## Latest Milestone (2026-02-15): Sync Queue + Orchestrator
Implemented the next sync phase so local mutations are now queued and synced through a real coordinator flow:
- Added persisted sync queue state:
- `lib/features/sync/sync_state.dart`
- `lib/features/sync/sync_queue_repository.dart`
- stores pending `ChangeEnvelope`s, cursor, last attempt/sync, and rejection info
- Added sync orchestration service:
- `lib/features/sync/sync_coordinator.dart`
- supports `pushPending`, `pullRemote`, and `syncNow`
- keeps offline-first behavior by recording failures without blocking local usage
- Wired local CRUD to sync envelopes:
- `lib/features/local/local_repository.dart`
- all person/moment/idea/reminder mutations now enqueue typed change envelopes
- added `applyRemoteChanges(...)` to apply pulled backend envelopes into local state
- Upgraded Sync UI:
- `lib/features/sync/sync_view.dart`
- now shows queue/cursor/error status and provides real sync actions (sync/push/pull/clear)
- Added sync tests:
- `test/features/sync/sync_queue_repository_test.dart`
- `test/features/sync/sync_coordinator_test.dart`
Validation for this milestone:
- `flutter analyze` -> pass
- `flutter test` -> pass
## Latest Milestone (2026-02-15): Auth Session UX
Implemented app-level authentication/session flow so navigation is now session-aware:
@@ -149,7 +177,7 @@ Validation status after UI milestone:
- Local database persistence and repository wiring (currently demo in-memory data).
- Full CRUD flows (create/edit/delete) for people, captures, reminder rules, gift/event ideas.
- Auth UX flows (sign-in, session-expired recovery, sign-out confirmation).
- Real sync orchestration layer (queue, cursor lifecycle, conflict policy UI).
- Conflict policy UI and merge/resolution UX for rejected remote/local mutations.
- Notifications/reminders delivery and scheduling integration.
- End-to-end and integration tests for app flows beyond unit/widget basics.
@@ -169,9 +197,9 @@ Validation status after UI milestone:
### Phase 3: Sync + Auth UX
1. Add sync queue service and cursor management use cases.
2. Add conflict handling strategy and UI states.
3. Implement sign-in/session lifecycle screens and provider state.
1. Add background sync scheduling/triggers (app start, manual retry, connectivity hooks).
2. Add conflict handling strategy and user-facing UI states for rejected mutations.
3. Add session-expired recovery UX and guarded routes for protected actions.
### Phase 4: Quality + Release Readiness