schedule
Run allocation rounds at parent until nothing more can be delegated: build the policy input from the active children, their EdgeSummarys and the current 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.
Before the first pick it seats the newborns and clamps the wakers against one front over the set neither of them is in (§7.2, §10.6, #1752), so a joiner meets the front it is rejoining rather than one it helped set.
Two states stop it, and neither throws. Active children whose weights fail weightsFitTheBudget stop it before the seat step, since the replicated ledger can merge such a set from writes that each fit (#3353). And a grant that would carry the effective issuance of the edge it picked past the lifetime watermark, Long.MAX_VALUE less LocalHeddle.LIFETIME_HEADROOM, stops it after the pick, on this peer's view (#3475). A full edge that is picked stalls its parent rather than being skipped for a sibling, as in LocalHeddle.acquire. No position stops it: a pick orders the full 128-bit position, and a position only ever counts up from the edge's start (#3472).
Peers that grant one edge before their writes merge each check their own view, so the merged issuance can pass the watermark: the headroom absorbs unmerged grants on one edge totalling at most LocalHeddle.LIFETIME_HEADROOM, 16,384 of LocalHeddle.MAX_RESERVATION. A grant is bounded by the quantum and holdings, not by that, so the bound is the total. Past Long the sum throws when read, never wraps.
A refused or empty call writes nothing
The seat step and the first pick run together, on a fork of this allocator, inside one LedgerCell.mutateOrSkip (#3353):
the first round refused at the weight budget or the lifetime limit: no patch, and the fork is dropped, so no seat, no clamp and no observation is kept;
the first pick found nothing to grant: no patch either, so the seats are dropped with it, but the fork's wake memory is kept, since it observed who was waiting. That is what LocalHeddle does, and it means an idle call writes nothing to a replicated ledger;
the first pick granted: the seats and the delegation land as one patch, and the fork is kept.
The fork is adopted only once the write step has returned, so a cell that throws while writing leaves this allocator as it was. Each later round is its own write, as before: a refusal there, or a throw from the cell or the policy in round k > 1, keeps rounds 1..k−1, which have already landed.
Return
AllocationOutcome.Delegated with the count of grants applied this call, even when a refusal stopped it after them; otherwise AllocationOutcome.WeightBudget when parent's children cannot be ordered, AllocationOutcome.LifetimeExhausted when the first grant would pass the lifetime watermark, and AllocationOutcome.NothingToDelegate when it simply had nothing to grant.
Parameters
units this peer has reserved at parent as a leaf. They are subtracted from the holdings it may delegate: a later completion charges its captured path without a gate, relying on the earmark to have kept the units, so delegating them would overspend (design §10.1, §10.7).
the current appetite of one child edge, Demand.NONE for an edge that wants nothing. Asked once per active child each time the policy input is built, so it should answer from live state rather than a copy taken before the call.
Throws
when this allocator was built from an AllocatorMemory no allocator wrote, one holding a child's shift remainder at a denominator other than its weight's (#3416 review), and that child returns: a remainder is always on its edge's own grid, since a reweight is a new edge.