IF Commons GitHub

plan-file

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-native-pinned-dialect FR-003

The plan file: the generated list of tools the program of the dialect checks or applies. It says it is generated, holds for each tool what the program needs (its name, version, program, other names, scope, minimum and source) and the policy it decides by, and holds no secret. The program reads it back and refuses what is not one.

import { readPlanFile } from "./plan-file.ts";
readPlanFile("{}").kind; // "err"

Source: commons/archon-dialect-native-pinned/src/plan-file.ts

5 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.

JobSourcetypeno test imports it
type JobSource =
  | { readonly kind: "download"; readonly pin: string; readonly version: string; readonly downloadUrl: string; readonly sha256: string; readonly archiveFormat: "zip" | "tar" | "file"; readonly binPath: string }
  | { readonly kind: "unpinned"; readonly pin: string; readonly reason: string };

Where a tool comes from, as the plan file says: a download a pin gave, or a pin with no download and the reason.

ToolJobtype
type ToolJob = {
  readonly tool: string;
  /** The version it is carried out at; none where nothing pins one. */
  readonly version: string | null;
  readonly program: string;
  readonly alsoNamed: readonly string[];
  readonly versionArgs: readonly string[];
  readonly minimum: string | null;
  readonly source: JobSource;
};

One tool of a plan file.

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

Policytype
type Policy = { readonly systemCopy: "minimum" | "never"; readonly integrity: "rolling" | "release-line" | "exact-hashed" };

What the program decides by.

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

PlanFiletype
type PlanFile = { readonly format: "native-pinned-plan/1"; readonly platform: string; readonly policy: Policy; readonly jobs: readonly ToolJob[] };

A plan file.

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

planFileTextfunction
function planFileText(p: PlanFile): string

The text of a plan file: JSON that says it is generated, with its keys in a fixed order.

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

readPlanFilefunction
function readPlanFile(text: string): Result<PlanFile, string>

A plan file from its text, or why it is not one.

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

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