Are Object Ids conflict safe across branches?

I’ve been looking at the ReferenceId mechanism for lists of objects and wondering if an object could reference child objects within the same stream but across branches.

As the ReferenceId mechanism doesn’t include any branch in that reference it prompted the thought about ID conflicts.

heya, an object can and does exist across multiple commits / branches within a stream! this happens already and you can probably see this for yourself if you inspect similar commits across one of your own streams.

object ids are only tied to a stream. an object of the same id could exist in two streams, but this would not cause any conflicts and they would be two separate objects uploaded to each respective stream (and tied to that stream id).

the only word of caution here is that an object could possibly have different ids even if the data is the same depending on where the object was created. this is because json does not preserve key order and the id is a hash of the serialised json string of the object. so if you create exactly the same object in two different places and generate the ids separately, if the json key order is different then you would get different ids for those two objects

So to confirm the original thought experiment, a Base object with a list of children referenced by Id can therefore reference objects on a different branch. And, by implication, the viewer would render said object and children?

Sorry, I should just test this.

yes, you’ve probably seen this in action already. objects are only tied to streams, so the same object easily exists on different commits and branches.

base objects themselves have no awareness of commits or branches

1 Like

to put it a different way, you can think of a stream as a bucket of base objects while commits / branches are just referencing obj ids from this bucket

3 Likes

Of course.

I feel a hackathon proposal brewing.

3 Likes