{"operations":["A: map meta set title \"Draft\"","B: map meta set title \"Final\""],"sample":false,"replicas":[{"label":"A","clientId":1,"updates":[{"operation":"map meta set title \"Draft\"","bytes":26}],"before":{"meta":{"title":"Draft"}},"deltaBytes":26},{"label":"B","clientId":2,"updates":[{"operation":"map meta set title \"Final\"","bytes":26}],"before":{"meta":{"title":"Final"}},"deltaBytes":26}],"converged":true,"schedules":3,"merged":{"meta":{"title":"Final"}},"mergedBytes":47,"decisions":[{"target":"map 'meta', key 'title'","replicas":["A","B"],"outcome":"one value wins","detail":"A set it to \"Draft\" and B set it to \"Final\" while apart. One value wins: \"Final\" (B's write) - every replica now holds that, and A's write is gone. A map key holds one value, picked deterministically but arbitrarily - by client id here, by random session ids in an app - and never by time. If both edits must survive, make the value a nested BcrdtText (or map) created once before people edit it, or give each writer a key of its own."}],"notes":["Each replica made its edits with no connection to the others - one transaction, and so one update, per line - and then received every other replica's updates. 3 delivery orders were tried: every order the replicas could be heard in, and every update newest first, which leaves updates waiting in the pending queue for the ones they depend on. Every replica ended identical under every one of them: replicas that have seen the same updates hold the same document, whatever the order.","The replicas were given client ids 1 (A), 2 (B) so the run is repeatable. An application's are random per session, so which concurrent write wins varies between sessions - treat it as arbitrary, never as \"the last one\".","BcrdtMap: a key written concurrently keeps one value and loses the other. Fields a person types prose into belong in a nested BcrdtText - created once, before people edit it - where both edits merge.","deltaBytes is what each replica sends a peer holding only the starting state - its whole session as one delta, however many updates it made; mergedBytes is the whole document encoded, what a new peer is sent. Decode any update with InspectBcrdtUpdate."]}