Service Layer high complexity mobile
2
Dependencies
1
Dependents
6
Entities
0
Integrations

Description

Resolves write conflicts that occur when the same entity is modified both locally and remotely during an offline period. Applies last-write-wins by default using authoritative server-side timestamps, and exposes extension hooks for future per-entity resolution strategies without redesigning the service.

Feature: Background Sync

conflict-resolver-service

Sources & reasoning

Required to prevent silent data corruption in proxy-reporting scenarios where coordinators and peer mentors can independently edit the same activity record while one party is offline. Last-write-wins via server timestamp is safe for the current workflow; the hook pattern allows future per-entity strategies (e.g. field-level merge for activities) without a service redesign.

No source references — this artifact was included based on reasoning alone (see above).

Responsibilities

  • Compare server-side entity timestamps against local mutation timestamps to detect conflicts
  • Apply last-write-wins resolution using the server timestamp as the authoritative source
  • Roll back optimistic local mutations when the server version takes precedence
  • Provide a strategy registry for future per-entity override policies
  • Emit conflict resolution events for audit and debug logging

Interfaces

resolve(localMutation: Mutation, serverEntity: Entity): ConflictResolution
registerStrategy(entityType: String, strategy: ConflictStrategy): void
onConflictResolved: Stream<ConflictEvent>
getResolutionHistory(): Future<List<ConflictEvent>>

Relationships

Dependencies (2)

Components this component depends on

Dependents (1)

Components that depend on this component