Two weeks on a sync bug that was a clock
What happens when two devices disagree about what time it is, and you ordered your edits by time.
My notes app syncs between a laptop and a phone. Edits are ordered by timestamp. Last write wins.
Users — all three of them, all me — reported that edits disappeared. Not always. Maybe one in twenty.
The two weeks
I looked at the network layer. I looked at the merge. I wrote a test harness that replayed 10,000 synthetic edit sequences and could not reproduce it once.
The phone's clock was 1.4 seconds behind the laptop's.
Edit on the phone at 10:00:03.0, edit on the laptop at 10:00:02.8 — the laptop edit is genuinely later in real time, but carries the earlier timestamp. Last write wins picks the phone's. The laptop edit vanishes.
Why the harness never caught it
Because I generated both sides from the same clock. My test assumed the thing that was broken.
The fix
Ordering no longer uses wall-clock time. Each device keeps a counter that only goes up, and an edit carries both counters. If neither counter is strictly greater, it is a genuine conflict and both versions are kept, visibly.
Any system that orders events by wall-clock time across two machines is wrong. It is only a question of how often you notice.
Edits lost since the change: zero in six weeks. Conflicts surfaced to me: four, all real.