Skip to content
1 min read · 241 words

Function: rawDiff()

ts
function rawDiff(
  store: PlanStore,
  planId: string,
  a: number | "current",
  b: number | "current",
): Promise<PlanDiff>;

Defined in: src/batteries/orchestration/raw.ts:119

A STRUCTURAL delta between two folded states of a plan.

Parameters

ParameterTypeDescription
storePlanStoreThe plan store to read from.
planIdstringThe plan to diff.
anumber | "current"The "from" side: a revision number or 'current'.
bnumber | "current"The "to" side: a revision number or 'current'.

Returns

Promise<PlanDiff>

The structural delta between the two folded states.

Remarks

rawDiff(a, b) compares two folded states, NOT an event log. It resolves each side to a revision ('current' means the plan's present revision), folds both prefixes, and compares the resulting content structurally:

  • nodesAdded / nodesRemoved are keyed by node id.
  • nodesChanged names the CHANGED FIELD PATHS with before/after values, typed ArgValue — a changed field may hold a NodeRef, so a narrower type would make a legitimate change unrepresentable.
  • edgesAdded / edgesRemoved are keyed by edge id; an edge whose endpoints or handle changed counts as removed-then-added, since its identity is its id.
  • Both digests are carried so a UI can label either side.

Because this is a FINAL-STATE diff, a node edited and then reverted across the compared span produces NO row — the two states are identical at that node, and there is nothing to report.