activationFitsTheBudget
Whether activating edge on this ledger keeps its parent's active children inside the weight budget: true when LocalHeddle.apply would let the activation through on budget grounds, false when it would refuse it as over budget.
It weighs the whole set the parent would have, the children already active there other than edge with edge's own weight beside them, not edge alone: a new child can refine every sibling's grid step, so activating a 1/3 can refuse on behalf of a heavy sibling (#3353).
true for an edge with no single record, unknown or divergent, since EntitlementLedger.activate refuses that one on its own. A sibling whose record is divergent is left out, as LocalHeddle.apply leaves it out: the policy drops such an edge, so it never enters a pick. Budget only: an activation that passes here can still be refused for the position limit.
Samples
// 1/30,719 is the finest weight one full lease fits; one step finer fails at any parent.
check(weightFitsTheBudget(Weight.of(1L, 30_719L)))
check(!weightFitsTheBudget(Weight.of(1L, 30_720L)))
val root = GroupId("root")
val alice = ReplicaId("alice")
val toHeavy = AttachmentId("root→heavy")
val toThird = AttachmentId("root→third")
val heavy = Weight.of(185_000_000_000_000_000L)
val third = Weight.of(1L, 3L)
check(weightFitsTheBudget(heavy) && weightFitsTheBudget(third))
var ledger = EntitlementLedger.bootstrap(root, mapOf(alice to 100L), nonce = "genesis")
ledger = ledger.piece(checkNotNull(ledger.prepare(AttachmentRecord(toHeavy, root, GroupId("heavy"), heavy))))
ledger = ledger.piece(checkNotNull(ledger.activate(toHeavy)))
ledger = ledger.piece(checkNotNull(ledger.prepare(AttachmentRecord(toThird, root, GroupId("third"), third))))
// Each fits alone, but not together: ask before proposing the activation, not after.
check(!ledger.activationFitsTheBudget(toThird))