Skip to content
1 min read · 211 words

Function: freezePlan()

ts
function freezePlan(
  store: PlanStore,
  planId: string,
  inputs: FreezeInputs,
): Promise<{
  issues: PlanIssue[];
  ok: boolean;
}>;

Defined in: src/batteries/orchestration/validation.ts:962

Freeze a plan: fold the log, validate, and commit the editable → reviewable transition.

The op log is folded into a RawPlanView, the fold's own issues are carried over (minus the fold's advisory duplicate_edge_id, which collectIssues reports as a blocking check), and collectIssues runs over the folded graph. Only when no issue is blocking is the store's transition called, passing the folded digest as expectedDigest.

The digest is what makes the commit safe rather than racy: content is validated at digest D and the store commits only if the plan is still at D, so a concurrent edit invalidates the transition instead of slipping past an already-passed check. If the transition is rejected (the digest moved or the state is not editable), a transition_rejected blocking issue is appended and the freeze reports failure.

Parameters

ParameterTypeDescription
storePlanStoreThe plan store holding the plan.
planIdstringIdentity of the plan to freeze.
inputsFreezeInputsThe fully-resolved tier-C allowlist and wired predicate cells.

Returns

Promise<{ issues: PlanIssue[]; ok: boolean; }>

Whether the freeze succeeded, and every issue the plan raised.