Skip to content

fix: serialize the clamped node size - #60

Merged
mourner merged 1 commit into
mourner:mainfrom
feritcemkahraman:fix/serialized-node-size
Oct 16, 2026
Merged

mourner merged 1 commit into
mourner:mainfrom
feritcemkahraman:fix/serialized-node-size

Conversation

@feritcemkahraman

Copy link
Copy Markdown
Contributor

new KDBush(4, 65536) clamps its node size to 65535, but writes 65536 into the 16-bit buffer header. Reloading that buffer uses a different tree layout and can miss points that the original index finds.

Write the normalized node size into the header. The regression checks range/radius searches after reloading, with eight node sizes covering the normal values and both clamping boundaries.

The regression failed before the fix. Validation: npm test passes (ESLint, TypeScript declarations, 11 tests); both Rollup builds pass. The browser and multi-Node matrix were not run locally.

@mourner
mourner merged commit 1d0dd94 into mourner:main Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants