Scheduling Service — Sync Contract
Status: populated Owner: TBD Last updated: 2026-04-17 Companion: Service Template · 16 offline-first
1. Per-Aggregate Conflict Policy
| Aggregate | Conflict policy | Rationale |
|---|---|---|
AppointmentAggregate | server_authoritative + optimistic lock | Slot reservation requires server-side atomic check; offline booking is not safe |
ScheduleAggregate | server_authoritative | Availability patterns require server-side expansion; offline edits could invalidate active bookings |
SlotAggregate | server_authoritative | Slot free/busy state is safety-critical (double-booking prevention); client cannot merge |
WaitlistEntry | append_only (additions); server_authoritative (state changes) | New waitlist entries accumulate safely; fulfillment must be server-confirmed |
2. Offline-first Considerations
| Scenario | Handling |
|---|---|
| View appointment list offline | Clients may serve from local cache (read-only) |
| Book appointment offline | Prohibited — slot reservation requires atomic server check |
| Cancel appointment offline | Prohibited — slot release must be server-synchronized |
| View schedule/availability offline | Cached availability data permitted; staleness warning after 15 min |
| Check-in offline | arrived transition may be queued with timestamp; server validates on reconnect |
| Reminder preferences offline | Read-only cached; changes queued for sync |
3. Optimistic Lock Requirements
All appointment mutations (status update, cancel, reschedule) require version field matching current record. On mismatch: 409 OPTIMISTIC_LOCK_CONFLICT; client must reload and retry.