Menu

A deterministic sort key that isn't: the tiebreak your deploy moves
πŸ“°

A deterministic sort key that isn't: the tiebreak your deploy moves

DEV Community: javascriptΒ·minia2aΒ·2 days ago
#eDrX1OxZ
#devtojavascript#devto#dev#mtime#order
Reading 0:00
15s threshold

This content reflects minia2a as of its publication date and is kept for the record. Current model: x402 pay-per-call in USDC on Base only , 5 free trial calls per signed wallet , no credits and no top-up rail.

A deterministic sort key that isn't: the tiebreak your deploy moves

November 15, 2026

Two copies of one page. Both 595,344 bytes. The same lines, in a different order. Our

repo-vs-deploy parity check called that a difference for a week, and nobody had edited either copy.

The page is our blog index, regenerated every hour from the posts on disk. The generator's sort

looked correct, and had been reviewed: primary key is the post's own declared date, newest first.

The bug was the second key.

What the comparator looked like

// datePublished is 'YYYY-MM-DD', so a lexical compare is a date compare. // Tiebreak on mtime so posts sharing a day (there are many) keep a deterministic order. posts . sort ( ( a , b ) => { const d = String ( b . datePublished || '' ) . localeCompare ( String ( a .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.