Skip to content

Commit b8d9c6d

Browse files
grypezclaude
andcommitted
fix(kernel-utils): handle -0 in encodeMetadataEntry
JSON.stringify(-0) produces "0", so -0 and +0 were serialised to the same metadataKey and incorrectly collapsed into one germ by collapseEquivalent. Object.is(0, -0) is false, so decomposeMetadata already treated them as distinct — making the two functions inconsistent. Add -0 as an explicit special case alongside NaN, +Infinity, -Infinity. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 073bca7 commit b8d9c6d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

packages/kernel-utils/src/sheaf/sheafify.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ const encodeMetadataEntry = (key: string, value: unknown): EncodedEntry => {
5151
if (value === -Infinity) {
5252
return [key, '-Infinity', null];
5353
}
54+
if (Object.is(value, -0)) {
55+
return [key, '-0', null];
56+
}
5457
}
5558
return [key, typeof value, value];
5659
};

0 commit comments

Comments
 (0)