I made good progress on the Cursor Continuity TLA+ spec. Reads and writes done. Next compaction. The visualizations in Cursor's blog post are helpful, but it's still not quite enough to fully describe the protocol.
For example, as far as I can figure, a rebase is not only needed after a write conflict. Two replicas can write their pack file concurrently but then update the WAL index serially (without a CAS conflict):
1. r1 writes pack file p1
2. r2 writes pack file p2
3. r1 reads the wal index
4. r1 appends p1 to the index, CAS writes it and commits locally
5. r2 reads the wal index
6. r2 see's that a new entry was added and must now rebase
7. r2 appends p2 to the wal index, CAS writes it and commits locally
Ultimately, very similar to OSWALD which is also multi-writer. If a replica sees that it is behind, it must catch up before appending its own op.