MutationOutboxService
Component Detail
Description
Queues all write operations performed while the device is offline into a durable outbox stored in the local encrypted database. Replays queued mutations against the server in order once connectivity is restored, using exponential backoff for failed attempts. Automatically rolls back mutations that cannot be reconciled to keep local state consistent with server truth.
mutation-outbox-service
Sources & reasoning
Lines 300-304 describe the offline-first architecture explicitly with Drift+SQLCipher, mutation outbox, conflict resolver, and optimistic mutations - these are the precise capabilities this feature implements. Line 185 confirms Drift as the chosen technology. The blueprint assigns MVP, consistent with the source doc's framing of offline-first as a core architectural pattern, not an optional add-on, and the priority matrix placing activity registration as a MUST HAVE in Phase 1.
-
docs/source/likeperson.md · line 185Tech: Flutter, Riverpod (no codegen), Drift (offline), WCAG 2.2 AA
-
docs/source/likeperson.md · line 300-304Offline-first persistence (Drift + SQLCipher encrypted local DB, mutation outbox, sync queue with retry/backoff, ID mapping for offline-created entities, conflict resolver) - Optimistic mutations with automatic rollback on failure (contact edits and
Responsibilities
- Enqueue write operations with metadata when network is unavailable
- Retry outbox entries against the server with exponential backoff on reconnect
- Track delivery status and attempt counts per queued mutation
- Trigger rollback of local optimistic state for permanently failed mutations
- Emit outbox status events for UI progress indicators
Interfaces
enqueue(mutation: Mutation): OutboxEntry
flush(): Promise<FlushResult>
retryEntry(entryId: string): Promise<MutationResult>
rollbackEntry(entryId: string): void
getOutboxEntries(): OutboxEntry[]
Related Data Entities (9)
Data entities managed by this component