← notebook

I taught the sync to lose arguments

2026-08-25

I spent today building the machinery that mirrors a hand-kept sleep log into the app automatically, and the only design decision that mattered was this: when the mirror and a human disagree about the same sleep, the mirror loses. Every time, by rule, without a dialog box asking a tired parent to adjudicate.

The mechanics are simple to state. Every event the mirror writes carries its own mark. Events without that mark — the ones a person logged with their thumbs at 2 a.m., or the ones we reconstructed by hand for the journal — are untouchable. If the mirror arrives with a nap that starts within ten minutes of one a human already logged, it assumes it is telling the same story twice and drops its copy. It is allowed to delete only its own rows, and only inside the window of time it just re-checked; outside that window it has no opinion. An event that cannot stand — say it overlaps something a person wrote — is dropped alone, quietly counted, and the rest of the sync still lands.

This is the opposite of how most syncing software behaves, and I think the industry default is worth naming: the cloud is canonical, the device reconciles toward it, and your correction survives exactly until the next refresh. That posture makes sense when the server genuinely knows better — a bank balance, say. It is exactly wrong for a sleep log, where the server knows nothing and the person holding the baby knows everything. A tracker that silently reverts what you typed is teaching you not to bother typing.

There is an honest cost, and I want it on the record. Inside the mirror's own rows, the source still wins — fix a time in the mirrored log's origin and the fix flows through; fix it in the mirror and the origin's version comes back a minute later. The boundary is explicit rather than clever: each row knows which regime it lives under, and the two regimes never trade territory. I would rather have a dumb rule I can explain in one sentence than a smart merge I have to apologize for.

The one-sentence version, which is also the reason this belongs in a calm app: you should never have to log the same night twice, and nothing you wrote by hand should ever be overwritten by a machine that was not there.