automerge / automerge-swift-archived

Wrapper around Swift types that can be modified concurrently by different users, and merged again automatically (a CRDT).
MIT License
159 stars 14 forks source link

tests that illustrate actors listed in conflicts aren't matching #48

Closed heckj closed 2 years ago

heckj commented 2 years ago

Two tests - one that creates two independent documents from the same model, and another that clones an initial model. In both cases, conflicting changes are made, the two documents merged, and that's consistent.

However, the actors returned from the rootProxy.conflicts() don't match either of the original actors. The returned ActorId look like they're prepended with additional information, which the Swift API allows (related issue: https://github.com/automerge/automerge-swift/issues/45), but ultimately you can't really match the actors - which you should be able to do.

Opening issue #47 for this as well - this PR just includes the tests that illustrate the issue (and currently fail)

lightsprint09 commented 2 years ago

When you look at the original test in automerge-js (here) you can see that the 1@ is part of the result.

I guess what we are looking for is to replace the type definition withObjectId

heckj commented 2 years ago

That makes sense to me - I was struggling with sorting out what an ObjectID was and how to describe it as well. Seeing it used helps - but I wasn't sure if these were equivalent (and this really WAS an object ID) or if they happened to have the same string concatenation format.

Are the other instances of ObjectID something different - where the UUID's after the counter represent something other than actors? Or does an ObjectID always consist of the value of a counter and then an Actor's ID?

lightsprint09 commented 2 years ago

Are the other instances of ObjectID something different - where the UUID's after the counter represent something other than actors? Or does an ObjectID always consist of the value of a counter and then an Actor's ID?

This a good question to ask @ept.

ept commented 2 years ago

ObjectIDs are always of the form counter@actorId, where actorId is the ID of the actor that created the object. (With one exception: the root object has ObjectID _root, because it exists from the start without having to be created.) ActorIDs can be arbitrary byte strings and are represented in hexadecimal when they appear in a string. By default they are UUIDs without the hyphens, but you could define them differently if you wanted (e.g. you could use a cryptographic public key as actorId).

lightsprint09 commented 2 years ago

I close this. If still relevant just reopen.

heckj commented 2 years ago

works for me