mattermost-mobile-upstream/app/managers/draft_sync_manager
Guillermo Vayá b31a9b4976 feat(drafts): Phase 3.4 — DraftSyncManager shell (no draining)
Per-server coordinator scaffolding with NO network activity. Owns lifecycle
state, a lifecycle epoch to reject stale async continuations, a bounded inbound
WebSocket event buffer, and a single durable retry timer per server that
reconstructs itself from the DraftOutbox — its fire callback sends nothing
(self-rescheduling heartbeat; Phase 4 adds draining at the marked call sites).

- Add draft sync timing constants (retry base/max/jitter, absence-confirmation
  delay, reconciliation deadline, snapshot-stale TTL, max event buffer).
- New app/managers/draft_sync_manager: narrow API (initialize, wake,
  requestReconcile, enqueueWebSocketEvent, handleCapabilityChange, invalidate).
  invalidate is synchronous (epoch++, cancel timer, clear buffer, disable).
  Retry-eligible = Pending/ConfirmingDelete. Missing/destroyed DB never throws.
  handleCapabilityChange suspends/resumes without deleting durable rows.

Checks: npm run tsc clean; eslint --quiet clean; 10 manager tests pass. Verified
no network/client imports.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-27 14:49:31 +02:00
..
index.test.ts feat(drafts): Phase 3.4 — DraftSyncManager shell (no draining) 2026-07-27 14:49:31 +02:00
index.ts feat(drafts): Phase 3.4 — DraftSyncManager shell (no draining) 2026-07-27 14:49:31 +02:00