Self-claims (base === here) are dropped as no-ops.
A here claimed by two different bases yields nothing at all for that
key. validateIdentityMapSidecar already refuses such a document, so
this cannot arrive from parseIdentityMapSidecar; it is the same rule
restated for a caller that hand-built the object, and it is restated rather
than assumed because "first claim wins" would silently pick an arbitrary
identity — the one thing this whole path exists to never do. Dropping the key
costs that entity its alias and leaves it as the add/delete a human can act
on, which is precisely the fallback resolveKeyAliases takes on a
collision.
The conflict is detected before self-claims are dropped: { base: 'x', here: 'x' } alongside { base: 'b', here: 'x' } is two different claims
about x, and treating the self-claim as invisible would let the other one
through as the arbitrary winner.
A repeated base is left alone, because that collision is precisely what
resolveKeyAliases refuses against the actual models (it would put two head
entities on one base entity), and resolving it here would hide a fault the
consumer can judge with evidence this function does not have.
Convert a sidecar into the head-key → base-key map DiffOptions.keyAliases takes.
Self-claims (
base === here) are dropped as no-ops.A
hereclaimed by two differentbases yields nothing at all for that key. validateIdentityMapSidecar already refuses such a document, so this cannot arrive from parseIdentityMapSidecar; it is the same rule restated for a caller that hand-built the object, and it is restated rather than assumed because "first claim wins" would silently pick an arbitrary identity — the one thing this whole path exists to never do. Dropping the key costs that entity its alias and leaves it as the add/delete a human can act on, which is precisely the fallback resolveKeyAliases takes on a collision.The conflict is detected before self-claims are dropped:
{ base: 'x', here: 'x' }alongside{ base: 'b', here: 'x' }is two different claims aboutx, and treating the self-claim as invisible would let the other one through as the arbitrary winner.A repeated
baseis left alone, because that collision is precisely whatresolveKeyAliasesrefuses against the actual models (it would put two head entities on one base entity), and resolving it here would hide a fault the consumer can judge with evidence this function does not have.