IF Commons GitHub

logical/approvals

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

What a plan needs before it may be carried out, by the assurance of the fleet: a confirmation typed by a person for each destructive entry, a second approver where the control asks for one, and the digest of the plan named by the approval where the control requires it. destructiveGate lets a plan through only when all of it is given.

import { approvalsNeeded } from "./approvals.ts";
// approvalsNeeded(plan, assurance).typedConfirmations lists the requirement ids a person must type

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

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

ApprovalsNeededtypeno test imports it
type ApprovalsNeeded = {
  /** The requirement ids a person must type, one for each destructive entry that changes something. */
  readonly typedConfirmations: readonly RequirementId[];
  readonly secondApprover: boolean;
  readonly planDigestRequired: boolean;
};

What a plan needs.

approvalsNeededfunction
function approvalsNeeded(plan: Plan, assurance: Assurance): ApprovalsNeeded

What a plan needs before it may be carried out, by the assurance of the fleet.

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

Giventypeno test imports it
type Given = {
  /** The texts a person typed to confirm. */
  readonly confirmations: readonly string[];
  readonly secondApprover: boolean;
  /** The digest the approval names, if it names one. */
  readonly planDigest: string | undefined;
};

What a person has given.

Missingtypeno test imports it
type Missing =
  | { readonly kind: "confirmation"; readonly id: RequirementId }
  | { readonly kind: "second-approver" }
  | { readonly kind: "plan-digest" }
  | { readonly kind: "plan-changed" };

Something a plan still needs.

Gatetypeno test imports it
type Gate = { readonly kind: "open" } | { readonly kind: "blocked"; readonly missing: readonly Missing[] };

The gate: open, or what is missing.

destructiveGatefunction
function destructiveGate(plan: Plan, assurance: Assurance, given: Given, digest: string): Gate

Whether a plan may be carried out: each destructive entry is confirmed by its exact id, a second approver is present where one is needed, and the digest the approval names is the digest of this plan where one is required. digest is the digest of the plan as it is now.

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

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