Skip to content
Cleft
Download

Founder dev log

Rebuilding sync so your notes just show up

People asked us for a black hole they could dump a thought into and trust it was captured and synced everywhere. Sync had drifted from that, so for 1.10.1 we rebuilt the sync layer.

Filed
Author
Jonathan Cosgrove
Read
2 min
Updated

The thing people asked us for, in their own words, was a black hole. Dump a thought in, trust it is captured, trust it shows up on every device, no babysitting. That is what a notes app you talk to is supposed to do.

Our sync had drifted away from that. It worked most of the time. But most of the time is not enough for the app where you keep the things you do not want to lose, so for 1.10.1 we stopped patching it and rebuilt the sync layer.

What was actually wrong

The failures fell into a few shapes:

  • Race conditions when you created notes back to back. Finish one, start the next quickly, and the second could step on the first.
  • "Got interrupted" errors when background sync was cut off mid-flight.
  • Offline recordings that did not always upload once you were back online.
  • No honest signal for what was still pending, so you could not tell whether the app was working or stuck.
  • Small papercuts, like language settings quietly resetting.

None of these were exotic. They were the ordinary edge cases that pile up when sync grows feature by feature instead of being designed once as a whole.

How we rebuilt it

Audio stays on your device. Sync moves your notes between your phone and your Mac, and the app works without a connection and uses one to catch up when it is there. You can record on a train with no signal, and the moment you reconnect the note is on your other devices. Pull down to grab the latest from anywhere.

  iPhone (local)  ◄────►  server  ◄────►  Mac (local)
                        (catch-up)

Treating the local copy as the source of truth let us delete a lot of special-case code. Once the server is just a way of catching up, "what happens if the upload fails" stops being a special case and becomes the normal path that retries later.

Then we made it fast

Getting it correct came first. Speed came next, in 1.11, with delta sync: only the notes that actually changed sync, instead of reloading everything. On a small library you would not notice. On a large one it is the difference between instant and watching a spinner.

That is what 1.10.1 and 1.11 went into, getting Cleft back to a notes app that just works, which is where it started.