A sync overwrite found by the model
The server remembered only the number of the last write it had applied. The model found a sequence in which this overwrites a record.
A phone sent a record, and the server saved it. But the phone never got the answer. Not knowing whether it was saved, the phone sends the same write again. If the server remembers the last write number, it can tell this is a duplicate. So far this looks like the right structure.
But what if, before the first write is resent, another device saves a new value? The server's last number changes to the new write. When the first write arrives again, we can't tell whether it was already applied, and the old value can overwrite the new one. We had only thought as far as the moment an answer is lost. We'd missed the moment, in between, when another device saves.
Why we didn't write the model by looking at the code
To find a problem like this, the model can't imitate today's code. An idea missing from the code would be missing from the model too. So we first wrote down the promises the engine has to keep: whether the app gets killed, answers get lost or two devices write at once, no write may be lost or applied twice.
There were 15 conditions that must always hold. We ran the model 500,000 times with random orders of up to 40 steps, and this order came out. With only 20,000 runs we sometimes missed problems that take 12 to 21 steps to appear. So we also broke the rules on purpose and checked that the checks really catch the problem.
The server now remembers the numbers of all the writes it has applied, not just the last one. We applied this change to production today. The orders the model generates are replayed on the real engine too.
The number 500,000 doesn't prove every case. When we connected the model to the real engine, we fitted some rules, where the model had been looser than the engine, to the code.
Written from that day’s point of view, using the documents and change history of the time. Published 2026.12.01.
