Skip to content
1 min read · 239 words

Function: computeAuthoritySet()

ts
function computeAuthoritySet(
  view: RawPlanView,
  alreadyLive?: (claim: AuthorityClaim) => boolean,
): AuthorityClaim[];

Defined in: src/batteries/orchestration/approval.ts:93

Computes the canonical authority set for a frozen plan.

The set is the union of every reachable call node's claims, de-duplicated to exact triples and sorted lexicographically by capability, then scope, then verb. Reachability is from the entry node(s) via reachableFrom; a claim living on an unreachable node is excluded, because the operator must see exactly what can actually run. Because the result is ordered and de-duplicated, comparing two plans' sets is a plain set comparison with no expansion step.

Parameters

ParameterTypeDescription
viewRawPlanViewThe frozen plan to summarise.
alreadyLive?(claim: AuthorityClaim) => booleanOptional predicate; a claim it returns true for is omitted (already live).

Returns

AuthorityClaim[]

The sorted, de-duplicated, reachable-only authority claims.

Remarks

The set is DERIVED as that union, so "every reachable call's claims are in the result" can never fail and is not a meaningful check. The two non-vacuous gates are freeze-time reachability (a separate work package) and approvePlan's set-equality check.

The optional alreadyLive predicate is the redundant-request short-circuit: a consumer whose authority layer reports a claim already live can pass it so only the claims still needing a gate are reported. It only shapes what THIS function returns for display/ask purposes; it does not weaken approvePlan's gate, which always compares the full reachable set.