v3 (2026-07-29): the fixed schedule. ladders (four numbers per pattern)
collapsed to sessionsDone (one), sessionsCompleted became derivable from
history.length, ExerciseResult.sets became a count, day became
position, and variant appeared. Persistence v3 owns the v1/v2 → v3 migration.
v4 (2026-09-04): ExerciseRecord.logged, from the logging reversal
(corpus/wiki/reversals.md). The change is additive and the field is optional, so
every v3 document is already structurally a valid v4 one — the version still
bumps because the service indexes schema_version, and "written by a build that
could not have recorded logs" is a fact worth being able to ask about. Persistence v4
owns the v3 → v4 migration; nothing in this file performs one.
v5 (2026-10-07): no field changed. What changed is what a sessionsDone
counter means. The in-between rungs inserted a rung into each of the push, hinge and squat
ladders, and a counter is turned into a rung by array index, so the same count
names a different exercise on the new ladders. The v4 → v5 step in
client/src/persistence/codec.ts moves each counter past an insertion forward
by one rung's worth of sessions, once, so nobody changes exercise. The version
bumps because that step must run exactly once per document: a v5 counter is
already on the new ladders and must never be moved again.
It lives here rather than in the codec because the service writes it into an
indexed column: schema_version on every snapshot row. Two runtimes agreeing
on the current version is exactly what a shared contract is for.
v3 (2026-07-29): the fixed schedule.
ladders(four numbers per pattern) collapsed tosessionsDone(one),sessionsCompletedbecame derivable fromhistory.length,ExerciseResult.setsbecame a count,daybecameposition, andvariantappeared. Persistence v3 owns the v1/v2 → v3 migration.v4 (2026-09-04):
ExerciseRecord.logged, from the logging reversal (corpus/wiki/reversals.md). The change is additive and the field is optional, so every v3 document is already structurally a valid v4 one — the version still bumps because the service indexesschema_version, and "written by a build that could not have recorded logs" is a fact worth being able to ask about. Persistence v4 owns the v3 → v4 migration; nothing in this file performs one.v5 (2026-10-07): no field changed. What changed is what a
sessionsDonecounter means. The in-between rungs inserted a rung into each of the push, hinge and squat ladders, and a counter is turned into a rung by array index, so the same count names a different exercise on the new ladders. The v4 → v5 step inclient/src/persistence/codec.tsmoves each counter past an insertion forward by one rung's worth of sessions, once, so nobody changes exercise. The version bumps because that step must run exactly once per document: a v5 counter is already on the new ladders and must never be moved again.It lives here rather than in the codec because the service writes it into an indexed column:
schema_versionon every snapshot row. Two runtimes agreeing on the current version is exactly what a shared contract is for.