feat(service,database): chat writes answer the transaction they committed in

Merged
CH
7d ago
+156-56

The service half of the chat area of the txid rollout: each chat write a window makes returns its txid on the wire answer, as Neon's mutations guide describes, so the host (next PR) can wait for it on the followed chat before answering.

  • pg_current_xact_id()::text is read in the write's own RETURNING: a post, an ask answered, a resolve, a channel read to a place, a topic opened or edited. No extra transaction.
  • A write that changes no row answers no txid: a post repeated under its key, a read to where the cursor already stands (the cursor upsert now moves only forward via setWhere, so it writes nothing otherwise), a topic edit that leaves it as it stands, and a read of every channel (the window never sends it).
  • chatWriteAnswerSchema gains an optional txid on each variant.

Tests: the chat store's writes answer a txid and their no-ops none; the window's read-to answers one, then none read again.

Ported from #4251 (luke/chat-write-txid, ca8ef433a), closed when Realtime was switched off; its branch sat on a stack, so this is a fresh cherry-pick onto today's main rather than a reopen. The JSON Schema goldens it touched aren't on main anymore, so none change here.

Made with Luke


Devin Review