fix: code-point string collation in LSM SSTable, COW trees/refs, sorted queries

Replaces localeCompare / raw relational operators with compareCodePoints (UTF-8
byte order) in the remaining persisted or native-facing comparison sites:
- SSTable sourceId sort + zone-map range check + binary search (graph LSM)
- COW TreeObject + RefManager name sorts (reproducible content hashes and ref
  listings across environments)
- getSortedIdsForFilter (numeric-aware; code-point for strings) so the JS sort
  fallback matches the native column store exactly

Deterministic across OS/Node/ICU and byte-identical to the native engine. No
migration: COW serialize/deserialize preserve stored order, so existing trees
keep their hashes; only new writes adopt code-point order.
This commit is contained in:
David Snelling 2026-05-27 11:53:26 -07:00
parent 547721ae14
commit 7493d8e33f
4 changed files with 29 additions and 8 deletions

View file

@ -20,6 +20,7 @@
*/
import type { COWStorageAdapter } from './BlobStorage.js'
import { compareCodePoints } from '../../utils/collation.js'
/**
* Reference type
@ -226,7 +227,7 @@ export class RefManager {
// Mark cache as valid
this.cacheValid = true
return refs.sort((a, b) => a.name.localeCompare(b.name))
return refs.sort((a, b) => compareCodePoints(a.name, b.name))
}
/**