`ChatMessageDao`'s two transcript queries ordered `createdAt DESC` and nothing
else. `MantraConverters` stores an `Instant` as epoch seconds, so lines written
inside one second tie -- a ceremony puts a dozen into a room faster than that,
and a request with the answer it triggers routinely lands inside one -- and with
no second key SQLite hands them back in scan order, which is rowid *ascending*.
Under a descending query drawn bottom-up by the feed's `reverseLayout`, that
draws a same-second burst backwards. Three lines written in one second, read
back through the old query:
expected:<[third, second, first]> but was:<[first, second, third]>
**The list and the room it opens already disagreed.** `ChatRoomDao` picks each
room's preview with `ORDER BY createdAt DESC, id DESC`, and 50feb6f justified
that key as "the order the transcript shows them in, so the list and the room it
opens agree about what was said last". The transcript never had the key, so that
was not true of it: under a tie the chat list quoted the last-written line while
the room put the first-written one above the composer.
`id DESC` on both reads settles it, and one constant now carries them both --
the snapshot a screen loads with and the flow it then follows are the same list,
and must not order it differently.
**The chronicle test was asserting the ascending order.** `an answered catch-up
leaves one line, whatever it took to deliver` expected [requested, received] out
of a newest-first query. It passed only by riding the tie's rowid order, and
failed whenever the two writes straddled a second boundary -- one run in eight on
a clean tree. Its expectation is now the newest-first order the DAO promises,
which the tie-break makes deterministic rather than a coin flip.
One new DAO test, covering the same-second burst through both the snapshot and
the flow the open room actually reads.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>