IF Commons GitHub

logical/plan

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-toolchain-logical FR-005

The plan of tools: for each resolved tool and what is observed of it, whether it is as pinned (none), absent (install) or different (replace). A copy found on the path counts only where the policy allows a system copy and the fleet does not ask for exact, hashed tools, and then at the least version the tool states (the version of its pin where it states none); a copy of the store or of a manager counts at the pinned version only, and any version counts where nothing pins one.

import { planTools } from "./plan.ts";
// planTools(resolution, new Map(), context) gives an entry `install` for each resolved tool

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

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

Foundtypeno test imports it
type Found = "path" | "store" | "manager";

Where an installed copy of a tool was found.

ObservedTooltypeno test imports it
type ObservedTool = { readonly version: string; readonly from: Found };

What is observed of one tool.

ObservedToolstypeno test imports it
type ObservedTools = ReadonlyMap<ToolName, ObservedTool>;

What is observed of the tools of a computer, by name; a tool with no entry is absent.

ToolActiontypeno test imports it
type ToolAction = "none" | "install" | "replace";

What must be done about a tool.

ToolPlanEntrytypeno test imports it
type ToolPlanEntry = {
  readonly tool: ToolName;
  /** The version it is carried out at; none where nothing pins one. */
  readonly version: string | undefined;
  readonly dialect: DialectId;
  readonly action: ToolAction;
  readonly observed: ObservedTool | undefined;
};

One entry of the plan.

ToolPlantypeno test imports it
type ToolPlan = { readonly platform: string; readonly entries: readonly ToolPlanEntry[] };

The plan of tools.

ActionInputtypeno test imports it
type ActionInput = {
  readonly seen: ObservedTool | undefined;
  /** The version the tool is carried out at; none where nothing pins one. */
  readonly version: string | undefined;
  /** The least version of a copy found on the path that may be taken. */
  readonly minimum: string | undefined;
  readonly systemCopy: Context["systemCopy"];
  readonly integrity: Context["integrity"];
};

What the rule that decides an action reads.

actionForfunction
function actionFor(i: ActionInput): ToolAction

The action for one tool: absent is install; a copy on the path counts only where the policy allows a system copy and the fleet does not ask for exact, hashed tools, and then at the least version (the pinned version where none is stated); a copy of the store or of a manager counts at the pinned version only, and any version counts where nothing pins one. The one rule, used by the plan and by the dialects.

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

planToolsfunction
function planTools(resolution: Resolution, observed: ObservedTools, ctx: Context): ToolPlan

The plan for a resolution and what is observed.

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

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