Marmot-TS
    Preparing search index...

    A bounded ledger of StateNotifications derived from accepted commits, keyed by the producing commit's hex digest — NOT by the delivery state's confirmation tag as the internal DeliveredPayloadLedger is. CONV-03 attributes notifications to the commit that produced them, so the commit digest (rather than a branch/state tag) is the natural withdrawal key.

    Structural sibling of DeliveredPayloadLedger: entries are pruned only below the oldest state still named by either retained history or the fork tree. A finite, pruned tree can therefore bound this ledger; with an unpruned full-history tree (including maxRewindCommits: Infinity) the correctness horizon deliberately implies unbounded retention.

    Index
    • Whether a commit's notifications are already recorded for (digest, epoch).

      WR-14: invalidatedByRewind KEEPS entries whose digest is on the winning chain, so every prefix link that was already ledger-recorded when it was first applied in-order survives a rewind. Callers use this to avoid re-reporting those links to the application as freshly-applied.

      Parameters

      • digest: Uint8Array
      • epoch: number

      Returns boolean

    • Removes and returns the notifications withdrawn by a rewind to a canonical branch: those derived strictly after forkEpoch whose producing commit digest is not in canonicalDigests. Notifications produced on the canonical branch, and any at or below the fork epoch (shared history), are retained.

      Parameters

      • forkEpoch: number
      • canonicalDigests: ReadonlySet<string>

      Returns StateNotification[]

    • Drops entries below the caller's tree-aware correctness horizon. The engine supplies min(retained anchor, oldest tree-node epoch) so no commit still nameable by a fork candidate loses its withdrawal record.

      Parameters

      • epoch: number

      Returns void

    • Remembers the notifications derived from a commit at epoch. Empty derivations are retained: their digest identity is still needed to make a later rewind complete and idempotent even though there is nothing to emit.

      Idempotent on (digest, epoch) (WR-14): a rewind whose winning chain includes links that were already applied and recorded in-order would otherwise push a second entry with the same digest and epoch. A later rewind that superseded them then withdrew each of those notifications TWICE, breaking CONV-03's "withdraw exactly the notifications it derived" invariant from the other direction, and compounding the ledger's unbounded growth.

      Parameters

      Returns void