Offline Sync Debugging

Start with the local queue. If you cannot explain what is pending, you cannot debug sync.

SymptomCheckFix
mutation stuck pendingnext_attempt_at, last_error, auth stateretry after auth refresh or surface user action
duplicate server rowsidempotency key missing or regeneratedpersist stable key per local action
local state flips backserver rejected optimistic mutationshow correction and reason
conflict loopclient keeps replaying stale base versionrequire rebase or user conflict resolution
queue drains only in foregroundbackground sync unavailable/throttledretry on app open and network regain
stale readspull cursor/version not advancinglog server version and local applied version

Debug View

Every sync-capable app should have an internal debug view with:

  • pending mutation count
  • oldest pending mutation age
  • last successful push/pull
  • last error
  • current local schema version
  • current remote cursor/version

Retry Gate

Retries must be safe. Before enabling automatic retry, prove duplicate sends do not duplicate server state.