@sports-app/shared — the wire contract
    Preparing search index...

    Interface StateDoc

    interface StateDoc {
        schemaVersion: 5;
        username: string;
        cyclePosition: number;
        sessionsDone: Readonly<Record<Pattern, number>>;
        history: readonly SessionResult[];
        settings: Settings;
    }
    Index
    schemaVersion: 5
    username: string

    Keys the document. A password is accepted and discarded, never stored.

    cyclePosition: number

    Integer index into ROTATION. Advances on training, never on a date.

    sessionsDone: Readonly<Record<Pattern, number>>

    The whole of the mutable state. Rung index, target, name and cues are all derived from these five integers by client/src/domain/schedule.ts.

    Stored rather than derived from cyclePosition — which would be exact, since sessionsDone.push is ⌈cyclePosition / 3⌉ for the current rotation — because if the rotation ever changes, derived counters would silently reinterpret every existing user's position mid-programme. One integer per pattern is cheap insurance against a content change rewriting history.

    Since v5 a migrated counter can sit one rung (14 sessions) above the number of sessions actually trained: it is a position on the current ladder, and the v4 → v5 step moved it so the position names the same exercise.

    history: readonly SessionResult[]
    settings: Settings