symfonic.capabilities.human.ledger¶
ledger ¶
The authoritative token issuance/consumption ledger — operated platform only.
Four things live here that live nowhere else.
One linearization point. In operated mode the ledger both issues and consumes, so "exactly one winner" is a property of a single object rather than an agreement between two. That is why it satisfies the consumption port itself.
Authoritative in the strong sense. A jti the ledger never issued is not a
token that might be fine — it is refused. Without that inversion any token minted
outside it would be invisible to the count the retirement gate reads.
Bounded purposes. The drain proof and the retirement horizon are operated-only (LIB-TL-4, CUT-AIR-5). A library deployment does not get a degraded version of them; it does not get this object.
Derived durability, and derived reach. Two tables decide a redemption: the
issued set and the consumed set. The ledger is exactly as durable as the weaker
of them, and it reaches exactly as far. Handing in a store moves the winner
decision onto a shared atomic conditional write; handing in records moves the
issuance table and the retirement horizon onto the same backend. Neither is
inferred from the operated role: a ledger that forgets every issuance when the
process exits refuses every legitimate resume after a restart, cannot enforce one
node's horizon on the next, and can only count its own worker's rows — so it says
durable=False, deployment_wide=False, and declines to call a drain
drained.
DrainProof
dataclass
¶
DrainProof(drained: bool, outstanding: int, reason: str, horizon: float | None = None, deadline: float | None = None, scope: str = PROCESS)
Whether every legacy-pinned token has drained, and why not if not.
IssuedToken
dataclass
¶
IssuedToken(jti: str, scope_hash: str, name: str, issued_at: float, expires_at: float, legacy_pinned: bool = False, vector_hash: str = '')
One issuance row. Ids, times, and the one bit the drain gate reads.
RetirementHorizon
dataclass
¶
SCP-FRZ-2: the date, and the operator's reason for it.
TokenConsumption
dataclass
¶
One redemption row: who won, and when. Losers are not recorded here.
TokenIssuanceLedger ¶
TokenIssuanceLedger(*, maximum_ttl_seconds: float, clock: Callable[[], float] = time.time, store: Any = None, records: Any = None)
Issuance, consumption, the maximum-TTL bound, and the retirement horizon.
Source code in src/symfonic/capabilities/human/ledger.py
deployment_wide
property
¶
Whether both tables are shared, rather than this worker's memory.
drain_deadline
async
¶
The horizon plus the maximum TTL: the last moment anything can live.
Source code in src/symfonic/capabilities/human/ledger.py
outstanding
async
¶
Issued, unconsumed, and not yet expired.
Source code in src/symfonic/capabilities/human/ledger.py
record_retirement_horizon
async
¶
SCP-FRZ-2 — the date after which nothing legacy-pinned may outlive.