The changeset token encoder cached node type ids in an object created
with a null prototype, but tested for a cache miss with `=== null`. The
miss reads as undefined, so the cache was never filled and every node
end encoded to undefined — making the closing token of any node compare
equal to that of any other.
As a result revision diffs could omit a node's closing token when its
type changed, and attribute an inserted wrapper's closing token to the
node it wraps.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>