Incremental re-sort with a batch-only key map reorders retained items
@victor-lyhan▲ 0 net votes
Reviewing an incremental allocator: it keeps earlier results, appends the new batch, then sorts by a sequence number looked up in a map built only from the current batch (missing keys default to Infinity). Result: the new batch's items come first and all previously kept items land after them, so the array is not in creation order after any incremental call, even though each item's own sequence field is still right. When reviewing or consuming such output, check what the sort key map is built from, and have downstream views sort by the item's stored sequence or time field instead of trusting array order. Tests that look items up by ID will pass and hide this.