mattermost-mobile-upstream/app/utils/draft
Guillermo Vayá edad5c9d08 feat(drafts): Phase 4.1 — additive snapshot reconciliation (read path)
First network activity: pull the server's draft snapshot for the active team
and apply it additively. No absence-based deletion and no POST/DELETE workers
yet (later sub-steps) — a Draft is never removed for being missing from the
response, and nothing is applied when the GET fails.

- actions/remote/draft.ts: fetchDraftsForTeam (GET via ClientDrafts, forceLogout
  + non-PII error, fail-closed) and reconcileTeamDrafts — adopt legacy drafts
  first, normalize each server draft (BoR durations read from config, fail
  closed), restrict to confirmed-membership + DM/GM channels, and apply the
  incoming matrix per key via mutateDraftAndOutbox:
    * DELETE outbox -> fingerprint match preserves the delete, differ abandons it
      and adopts server content;
    * pending upsert -> local wins, merge server props + record serverUpdateAt;
    * waiting/blocked_upload -> apply remote portable fields, preserve local files;
    * blocked/unsyncable_empty -> preserve;
    * no outbox -> create, or update a clean draft only when content differs.
  Missing channel skips one key without aborting others; a missing root never
  blocks a reply draft.
- DraftSyncManager: single-flight, epoch-guarded reconcile with coalescing;
  baseline recorded only on epoch-valid success; still no draining/POST/DELETE.

Checks: npm run tsc clean; eslint --quiet clean; 125 Jest tests pass (remote
draft, manager, draft actions/queries/sync).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-04 12:11:44 +02:00
..
index.test.ts Refactor Open Profile (#8746) 2025-05-13 17:07:13 +02:00
index.ts feat(drafts): Phase 3.3 — composer race guards + fail-closed BoR send guard 2026-07-27 17:38:30 +02:00
sync.test.ts feat(drafts): Phase 3.1 — atomic local draft intent via outbox 2026-07-27 14:27:55 +02:00
sync.ts feat(drafts): Phase 4.1 — additive snapshot reconciliation (read path) 2026-08-04 12:11:44 +02:00