ConflictResolverService
Component Detail
Description
Detects and resolves conflicts that arise when offline mutations reach the server and collide with concurrent edits made by other users. Applies a last-write-wins strategy by default and exposes hooks for domain-specific merge logic where field-level resolution is required. Logs all resolved conflicts for audit purposes.
conflict-resolver-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
- Compare server entity versions against locally queued mutation payloads
- Apply last-write-wins resolution for scalar field conflicts
- Invoke domain-specific merge handlers for complex entity types
- Persist conflict resolution outcomes to the local audit log
- Notify MutationOutboxService of resolution decisions for outbox entry finalization
Interfaces
resolve(local: Entity, server: Entity): ResolvedEntity
registerMergeHandler(entityType: string, handler: MergeHandler): void
detectConflict(mutation: Mutation, serverVersion: Entity): boolean
getConflictLog(entityType: string): ConflictRecord[]
Related Data Entities (4)
Data entities managed by this component