automerge / automerge-classic

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
http://automerge.org/
MIT License
14.75k stars 466 forks source link

Is it possible to detect and/or resolve delete-edit conflicts? #413

Closed cclauson closed 1 year ago

cclauson commented 3 years ago

Hi,

I'm new to automerge and am experimenting with it. Based on trying the examples on the doc page, concurrent changes to the value of a map key will result in conflicts that can be queried via Automerge.getConflicts() and resolved.

Consider this conflict scenario--a list of maps exists. One site edits a value in one of the maps, while another site deletes that map. Is there any way to query and discover this conflict?

Based on experimenting with this--it looks like the element is deleted, but I'm unclear on whether a parameter can be passed to Automerge.getConflicts() to detect and/or resolve this.

Thanks so much for any clarification here :)

ept commented 3 years ago

Hi @cclauson, thanks for trying Automerge. I'm afraid the scenario you describe is not treated as a conflict by Automerge. That's because every Automerge object is independent, and when you delete an object from a list of objects, you're actually only deleting a reference to the nested object.

We did previously consider alternatives whereby an update inside a deleted object causes that object to become un-deleted again. However, this can lead to some quite strange situations, as illustrated in figure 6 of this paper. For Automerge we decided to go a different path and not try to merge updates to different objects.

Please let me know if you have any further questions.

ept commented 1 year ago

Closing this issue as it has been quiet for a long time; please re-open if there is still something to do here.