The loop kept its promise. The read-out did not.
The common read: an object keeps things in the order I put them in, so an index built latest-first reads back latest-first
Insertion order is not a property of the object. It is a property of the keys. The loop did exactly what its name says: it sorted by openedAt descending and inserted 7, then 1042, then 310. The object handed those three keys back as 7, 310, 1042, which is ascending numeric order and is nobody's insertion order. The oldest incident surfaced above the second-newest one, and the titles print in that same rearranged order.
The rule is one clause of the specification, and this is the shape that hides it: own-property enumeration emits every key that is an array index first, in ascending numeric order, so a key that happens to look like an array index is placed by its numeric value at the moment it is written, not by the order it was written in. An id is a string. "7" and "1042" are strings shaped like array indices, and the object treats them as positions rather than as names.
The triage list on the on-call dashboard has been ordered by that function since it shipped. The retro after the missed page carried an action item to add a lint rule for unsorted output, and the output was sorted. The read-out is the one step nobody wrote down.
