ConflictResolverService
Component Detail
Service Layer
medium complexity
mobile
0
Dependencies
0
Dependents
3
Entities
0
Integrations
Description
Detects and resolves conflicts that arise when an offline mutation collides with a concurrent server-side edit. It applies a last-write-wins strategy by default and exposes hooks for field-level merge logic on contact and activity records where data loss is unacceptable.
conflict-resolver-service
Sources & reasoning
Lines 302-303 explicitly define the offline-first architecture including SQLCipher, mutation outbox, conflict resolver, and optimistic mutations. The mobile app architecture section lists this as a core shared capability with no toggle, confirming MVP scope. The blueprint assigns this feature [MVP], consistent with Phase 1 foundational requirements.
-
docs/source/likeperson.md · line 302Offline-first persistence (Drift + SQLCipher encrypted local DB, mutation outbox, sync queue with retry/backoff, ID mapping for offline-created entities, conflict resolver)
-
docs/source/likeperson.md · line 303Optimistic mutations with automatic rollback on failure (contact edits and paginated list updates)
Responsibilities
- Compare local mutation timestamps against server entity versions to detect conflicts
- Apply last-write-wins resolution for non-critical scalar fields
- Perform field-level merge for structured records such as contact details and activity logs
- Persist a conflict audit log entry for every resolved or deferred conflict
- Expose a manual resolution queue for conflicts that cannot be auto-merged
Interfaces
resolve(local: MutationEntry, remote: ServerEntity): ResolvedEntity
detectConflict(local: MutationEntry, remote: ServerEntity): boolean
mergeFields(local: Record<string, unknown>, remote: Record<string, unknown>): Record<string, unknown>
getPendingConflicts(): ConflictEntry[]
acknowledgeConflict(conflictId: string, resolution: Resolution): void
Related Data Entities (3)
Data entities managed by this component