Files
pad/docs
xarmian c87587cad2 fix(store): PG migration 054 breaks same-second version ties by id, not ctid (BUG-3751) (#2183)
* fix(store): PG migration 054 breaks same-second version ties by id, not ctid (BUG-3751)

ctid is a physical row locator, and an UPDATE moves the row, so the
backfill could rank two same-second versions by where they happened to
sit. Rows from before 054 have no sub-second chronology (second-precision
created_at, random UUIDv4 id), so id is the honest tiebreak: arbitrary but
stable. The Postgres runner records migrations by filename only
(migratePostgres skips on applied[name]), so editing 054 in place changes
nothing for databases that already ran it. Production measured 0 tie
groups (diagnose-version-ties, 10-13).

docs/api.md: the version list's order, and the diagnostic for self-hosted
Postgres operators.

Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS

* test(store): PG migration 054 numbers same-second versions by id, not physical order (BUG-3751)

The test reruns 054's backfill on same-second rows whose ctid order differs
from their id order (an UPDATE moved the lowest id to the physical end, and
a precondition asserts it). The numbering must follow id. Red control: 054
with ORDER BY created_at, ctid fails this test ("054 numbered [5674404c...
04a41fc3]; want id order [04a41fc3 ... 5674404c]").

Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS

* docs: the version-tie diagnostic's "nothing to do" covers the groups it judged; 054 prose says "as first shipped" (BUG-3751 codex r1)

A zero misordered count says nothing about groups the run never judged:
a deadline (truncated), groups over the permutation bound (skipped_large),
and a broken chain (chain_broken). docs/api.md now names all three.
version_tie_diagnostic.go described 054 as ordering by ctid; that is now
true only of databases that ran it as first shipped (CONVE-23 sweep).

Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS

* docs(api): with_snapshot and ambiguous tie groups are not judged either (BUG-3751 codex r1)

Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS
2026-10-14 22:53:53 -04:00
..