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

Mismatched heads when deserializing #302

Closed rongoro closed 3 years ago

rongoro commented 3 years ago

In the performance branch I'm able to construct an automerge object that serializes successfully but deserializes with a "mismatched heads" error.

Here is a gist that reproduces the error: https://gist.github.com/rongoro/6e3993651394e36d66cb419a7b79d4e5

Note: the last change in the list triggers the exception.

ept commented 3 years ago

Hi @rongoro, thanks for this bug report, and sorry that it's taken me so long to get round to it. I have fixed the issue in 7087c2c5f894ea764ed80648254f1da3c2c51c9b.

Note that your original script no longer runs against this commit because we changed the encoding format in #296, and the new code throws an exception when parsing this data in the old format. Also, any changes generated prior to 7087c2c5f894ea764ed80648254f1da3c2c51c9b may still result in this exception when loaded, because the bug was in the encoding of changes. However, any changes generated after this commit should be encoded correctly and should no longer trigger this exception.

If you do see this exception again, please file another bug report. Thanks again for your help! :)