IF Commons GitHub

logical/plan

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-archon-logical FR-004, 0003-archon-logical FR-005

The plan: what differs between what is observed of a subject and its order. One entry for each requirement of the order says whether its resource is already as it must be, must be made, must be changed or must be removed. A plan has a canonical text and a digest (the SHA-256 of it), so that a person can approve exactly one plan and any change of any entry changes the digest.

import { planOrder } from "./plan.ts";
// planOrder(order, new Map()) gives an entry `create` for each requirement that must be present

Source: commons/archon/src/logical/plan.ts

6 of 9 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Observationtypeno test imports it
type Observation = { readonly state: "absent" } | { readonly state: "present"; readonly value: JsonValue };

What is observed of one resource: not there, or there with this state.

Observedtype
type Observed = ReadonlyMap<RequirementId, JsonValue>;

The observed state of the resources of a subject, by requirement; a requirement with no entry is observed absent.

Imported by 12 tests of the run (12 passed, 0 failed): the library's results

PlanActiontypeno test imports it
type PlanAction = "none" | "create" | "update" | "remove";

What a plan does to a resource.

PlanEntrytypeno test imports it
type PlanEntry = {
  readonly id: RequirementId;
  readonly kind: ResourceKindId;
  readonly action: PlanAction;
  readonly change: ChangeClass;
  readonly tier: string;
  readonly observed: Observation;
  readonly desired: Observation;
};

One entry of a plan.

Plantype
type Plan = {
  readonly format: "archon-plan/1";
  readonly subject: Subject;
  readonly entries: readonly PlanEntry[];
};

A plan.

Imported by 5 tests of the run (5 passed, 0 failed): the library's results

planOrderfunction
function planOrder(order: Order, observed: Observed): Plan

The plan that brings what is observed to the order: one entry for each requirement, in the order of the sequence.

Imported by 12 tests of the run (12 passed, 0 failed): the library's results

changesOffunction
function changesOf(plan: Plan): readonly PlanEntry[]

The entries of a plan that change something.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

canonicalPlanfunction
function canonicalPlan(plan: Plan): string

The canonical text of a plan: the same plan is the same text on every machine whatever the order its keys were made in.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

planDigestfunction
function planDigest(plan: Plan): Promise<Sha256>

The digest of a plan: the SHA-256 of its canonical text.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.