ADR 005: Message ordering
- Status: Accepted
- Owner: Eng lead
- Date: 2026-11-12
Context
Timestamps and UUIDv7 can commit out of order, so 'everything after X' sync can permanently miss messages.
Decision
A per-conversation last_seq counter incremented under a row lock inside the send transaction. Edits, deletes and reactions take a sequence too and are written to conversation_events.
Consequences
Clients detect gaps (seq > last + 1) and resync with after_seq. Sends are serialized per conversation (lock contention on very hot conversations).