← Tous les modèles

Modifications locales d’abord, synchronisation en arrière-plan, règles de résolution des conflits.

Spec — Offline sync

Status: draft · Created: 2026-11-10

1. Context and goal

People keep working in the app without a connection; their edits are saved on the device first and reach the server and their other devices when the network returns.

2. Functional requirements (EARS)

  • FR-1: WHEN a user edits a record, THE SYSTEM SHALL save it on the device within 100 ms, whether the device is online or not.
  • FR-2: WHILE the device is offline, THE SYSTEM SHALL keep every pending change in a local queue that survives an app restart.
  • FR-3: WHEN the connection returns, THE SYSTEM SHALL send the queued changes in the order they were made within 10 seconds, in the background.
  • FR-4: THE SYSTEM SHALL apply each change on the server at most once, using a change id generated on the device.
  • FR-5: WHEN a sync completes, THE SYSTEM SHALL pull the changes made on other devices since the last sync and apply them locally.
  • FR-6: IF the same field was changed on two devices since the last sync, THEN THE SYSTEM SHALL keep the change with the later server timestamp and keep the other in the record history.
  • FR-7: IF one device deletes a record that another device edited, THEN THE SYSTEM SHALL keep the edit and restore the record, telling the user who deleted it.
  • FR-8: THE SYSTEM SHALL show the sync state of the app as synced, pending with a count of changes, or failed.
  • FR-9: IF a change is rejected by the server, THEN THE SYSTEM SHALL keep it on the device, mark the record, and let the user retry or discard it.

3. Out of scope

  • Real-time collaborative editing of the same text.
  • Syncing files larger than 10 MB.