ce-net
Demos / Offline merge / In your browser

Edit offline. Merge on reconnect.

A laptop and a phone share a parts list. Pull the virtual cable, change both sides, plug it back in. Both sides show the same list, the page shows how each conflict was decided, and both state hashes match. Both replicas run here in your browser; the recorded runs below use two separate processes, in Rust and in TypeScript.

Connected
syncing every 100 ms
State hashes
equal
Last merge
-
plug the cable back in to see it
Dropped while apart
0
sync messages the cable threw away
How each conflict was resolved
  1. Nothing to resolve yet. Pull the cable, edit the same part on both sides, plug it in.

The rules

Field by field

Each field of a part is decided on its own. A quantity changed on the laptop and a name changed on the phone are both kept.

Later hybrid clock wins

When both sides wrote the same field, the write with the higher hybrid logical clock wins: wall time, then a counter, then the device name. A slow clock cannot make an edit lose to the write it has already seen.

Delete beats edit

A part deleted on one side stays deleted, whatever was edited on the other side and whenever. Edits it overrode are listed, not silently lost.

Recorded: five partitions, two processes, two languages

ScenarioWhat happensGolden state hashRust + RustRust + TSTS + TS

Run it yourself

git clone https://github.com/ce-net/demo-offline-merge && cd demo-offline-merge
cargo run -- scenario partition-1                 # two replica processes and the cable
(cd ts && npm ci && npm run build)
cargo run -- scenario all --phone ts              # the phone is the TypeScript replica