schedule

Run allocation rounds at parent until nothing more can be delegated: build the policy input from the active children, their EdgeSummarys, and the folded live demand, then apply each HeddlePolicy.pick grant to the ledger before the next round (design §7.3). A bad local decision only misplaces entitlement — it can never create any, so partitioned peers may schedule divergently and still converge on heal.

The rounds are FairShareAllocator.schedule's; this node supplies the replicated ledger, the live demand board, and this peer's earmark at parent. Units reserved at parent (as a leaf) via reserve must not be delegated down parent's children, or a later complete — which charges the captured path ungated, relying on the earmark to have kept the units — would overspend and drive holdings negative (the "one unforgivable failure", design §10.1/§10.7). This is the only holdings-reducing path the node exposes (there is no public delegate/transfer), so that subtraction closes the leak entirely. The earmark is read once, under lock, which reserve and complete also hold, so it cannot move during the rounds.

Nothing rebases a busy parent (#3472). Each child's position is stored wide and only ever counts up from the edge's start, and a pick orders it wide. The position ceiling is where the ledger's virtual-time reads stop being exact, and only those: a long-running parent passes it, and its picks are unaffected. boundMetrics reports the peak effective position as a fraction of its ceiling. A weight set so fine that one full lease could carry a child past its ceiling is refused before it is active (prepare, activate), and no grant is larger than LocalHeddle.MAX_RESERVATION, the lease that limit is sized for (#3353).

A long-idle child that comes back demanding to a node that never saw it idle, after a restart, is clamped as a waker, the restart rule (design §7.2): to the front, past it by what its edge still has outstanding, so the grants it holds unspent stay counted as its service (#3721). No position refuses a pick: a pick orders the full 128-bit position, however many schedulers granted it at once. A refused call writes nothing and leaves the wake clamps as they were, and a call with nothing to grant writes nothing either (FairShareAllocator.schedule).

Return

ScheduleOutcome.Delegated with the count of grants applied this call, ScheduleOutcome.NothingToDelegate when none was, ScheduleOutcome.WeightBudget when parent's children cannot be ordered, or ScheduleOutcome.LifetimeExhausted when the first grant would carry its edge's effective issuance past the lifetime watermark on this peer's view (#3475): nothing is published, and a refusal met after grants answers Delegated and keeps them, so the next call answers it. Never GateClosed: a static node has no write gate. complete charges at most what was reserved, so only a grant moves the lifetime counters, and this node checks each grant on its own view. Partitioned peers that grant one edge before their writes merge can carry the merged issuance past the watermark: their unmerged grants are absorbed while those on one edge total at most LocalHeddle.LIFETIME_HEADROOM, and past Long the merged sum throws when read, never wraps. A grant here is bounded by the quantum and the holdings it is drawn from, not by LocalHeddle.MAX_RESERVATION, so the headroom is a total, not a count of grants.

A parent that starts answering ScheduleOutcome.WeightBudget is also logged, once, at warn, naming its active edges and their weights, so a caller that discards the outcome still sees it. It logs again only after some call there answers anything else.