ot-core

Two people typed in the same place

Operational Transform has one law worth the name. This page runs it against the real library — edit the boxes, watch both participants end up holding the same text, then check it yourself over a hundred thousand random pairs.

The law

Given two edits written against the same document, each participant applies its own first and the other's second. Convergence is the claim that they then hold identical text — and nothing else. It is checkable without knowing what the document should say, which is what makes it fuzzable: there is no expected output to write down, only two strings that must match.

apply(apply(doc, A), transform(B, A, 'right'))
        ===
apply(apply(doc, B), transform(A, B, 'left'))

Watch it happen

Change anything below. Try putting both edits at the same position — that is the case with no natural answer, where the two sides have to break the tie the same way or diverge.

Starting document

A applies its own edit

B applies its own edit

↓   each now receives the other's edit, rebased   ↓

B's edit, transformed for A

A's edit, transformed for B

A ends up with

B ends up with

Check it yourself

This runs checkConvergence from ot-core/fuzz — the same module the test suite runs, so the number here means what the number in CI means. The generator biases hard towards collisions: short documents, short edits, half of them deletes, so random pairs land on top of each other far more often than they would in prose.

pairs tested
divergent documents
elapsed
pairs / second

Is that zero worth anything? A passing property test is only evidence if it could have failed. Run the identical fuzzer against a transform that ignores the operation it is meant to rebase against — the thing an OT implementation does before anyone writes the hard part.

What this does not prove. TP1 is convergence for a pair of concurrent operations, and that is the whole of what is checked here. This library does not implement TP2, so it does not claim to converge for three or more operations that need to be transformed against each other in different orders — the case an undo of an old edit can reach. That limitation is documented rather than fuzzed around.