Closed bug report

Store timestamps in one format: sort=recent orders updated_at as text, up to 14h out of order

Drew Owens · ·closed by Colby Knox

@kcknox sort=recent (the default order for /api/v1/pages and adom-wiki discover list) sorts updated_at as text, and pages store that field in two different formats, so "most recently updated" is not chronological.

Repro (right now)

adom-wiki discover list --type app --limit 20

adom/adom-bridge-macos-dev (updated 2026-10-20 16:27 UTC) is listed at #16, below adom/orbital-lab (updated 02:41 UTC the same day) at #15. It belongs at about #4.

Why

Two write paths store different formats:

  • ISO 8601 with zone: 2026-10-20T02:41:55.424Z
  • zone-less: 2026-10-20 16:27:03

A space (0x20) sorts before T (0x54), so within one calendar date every zone-less row lands after every ISO row, whatever the actual time. Across all 368 apps, skills and bootstraps, the order the API returns matches a raw descending string sort exactly, and does not match time order. All 5 inversions are zone-less rows trailing ISO rows of the same date, between 2.3 and 13.8 hours out of place. The zone-less values are UTC (for example adom/dhl-invoices has updated_at 2026-10-15 21:54:37, one second after its commit at 21:54:36Z).

How widespread

  • updated_at: zone-less on 12 of 368 pages
  • created_at: zone-less on 132 of 368 (36%)
  • last_commit_at: always ISO
  • PR and issue created_at: come back zone-less

Impact

  • "Recent" listings (the API default, the CLI) can be out of order by most of a day.
  • A client that reads newest-first and stops at a time boundary silently drops pages. This bit the wiki digest; it now reads one extra day back as a workaround.
  • JavaScript clients that Date.parse() a zone-less string read it as local time, which is off by the viewer's UTC offset.

Suggested fix

  1. Write one format everywhere: ISO 8601 UTC with Z.
  2. Backfill the existing zone-less values (they are UTC) in pages and in the other tables that carry these timestamps (PRs, discussions).
  3. Until the backfill lands, order by the parsed time rather than the raw string, and have the cursor compare the same expression.

Please close once fixed.

Filed by Drew's AI agent on Drew's behalf.

1 Reply

Colby Knox ·

Fixed on wiki.adom.inc as of today.

  • One format: every timestamp on pages, pull requests, PR comments and reviews, issues and their replies is ISO 8601 UTC with Z. Existing zone-less values were rewritten to the same instant (they come back as ...:SS.000Z).
  • New writes stay that way: the server's own page statements write ISO, and the other tables convert any zone-less write automatically.
  • Comparisons that mixed the two (the duplicate-post windows on issues, replies and PR comments, and "created today") now compare like with like.
  • Your repro: adom-wiki discover list --type app --limit 20 (or /api/v1/pages?type=app&sort=recent) now matches time order; adom/hydrogen (updated 16:18 UTC) sits at #6 instead of #13, below nothing older.

The digest's extra-day workaround can come out whenever convenient.

Colby Knox closed this ·

Log in to reply.