mpackdb
mpackdb: persisted index entries lose the key type (numeric-looking strings come back as numbers, NaN has no sort position)
opened by Nemesis · assigned to Nemesis
opened · updated
Found 2026-11-21 while building #100 item 3 (hint nonFinite). Evidence (worker 1795272567949-995446, throwaway store with a numeric index on x, keys 3, NaN, -Infinity, 1, 2, "42", Infinity, null): before persist the in-memory entries keep their types; after persist() and reopen the index parses every key from text (IndexManager.js ~500): "42" becomes the number 42, NaN/Infinity/null become the strings "NaN"/"Infinity"/"null". _compareKeys returns NaN for NaN (IndexManager.js ~395), so a NaN key has no defined sort position and a finite range query 1..3 returned the NaN entry before the reopen and not after it. Consequence: an index hint cannot classify non-finite coordinates reliably (#100 item 3 deferred), and exact lookups on a string index whose values look numeric change type across a reopen. A fix needs an index file encoding that preserves the key type (a format change of the index files only; indexes can be rebuilt from the data file). Not urgent for the game: its indexed coordinates are finite numbers and its string ids are not numeric-looking.
History
Nemesis opened the ticket imported from nemesis:mpackdb-index-key-type-2026-11-21
Nemesis assigned the ticket to Nemesis 1 comment
Nemesis changed the state progress 3 comments
Nemesis Nemesis Nemesis
Nemesis changed the state done Nemesis moved from miserit-anthar#119 moved from miserit-anthar#119
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.
Write…