IF Commons GitHub

governance/problems

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-cli-governance FR-004

The problem codes of the anyfs program and what each means (commons anyfs-cli 0002-anyfs-cli-governance FR-004; commons headless 0003-headless-output FR-008): every problem a run can raise is one of a closed union of codes, and each code has one explanation (a title, what happened, the likely cause and the fix) that anyfs explain <code> prints and the documentation renders. The registry holds one entry for every code, which the compiler checks.

import { CATALOGUE, isProblemCode } from "./problems.ts";
isProblemCode("E-FILESYSTEM"); // true
CATALOGUE["E-STRICT"].fix; // "run it again without --strict, or give the store the capability it lacks"

Source: commons/anyfs-cli/src/governance/problems.ts

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

Explainedtypeno test imports it
type Explained = { readonly title: string; readonly what: string; readonly why: string; readonly fix: string };

What anyfs explain says of a code: the shape of Headless' explanation, held here so that the governance imports no more than it needs.

ProblemCodetypeno test imports it
type ProblemCode = | "E-USAGE" | "E-ENVIRONMENT" | "E-CONFIG-LOAD" | "E-CONFIG-INVALID" | "E-LOCATION" | "E-… (406 characters)
type ProblemCode =
  | "E-USAGE"
  | "E-ENVIRONMENT"
  | "E-CONFIG-LOAD"
  | "E-CONFIG-INVALID"
  | "E-LOCATION"
  | "E-MOUNT-UNKNOWN"
  | "E-PLACE-UNAVAILABLE"
  | "E-OPEN"
  | "E-FILESYSTEM"
  | "E-STRICT"
  | "E-DIFFERENT"
  | "E-PLAN-REFUSED"
  | "E-PLAN-STALE"
  | "E-MERGE-REFUSED"
  | "E-SYNC-FAILED"
  | "E-FILES-ASIDE"
  | "E-CONFLICTS"
  | "E-APPLY-FAILED"
  | "E-REPLICA-DIVERGED"
  | "E-TRUST";

The code of every problem: a closed union.

PROBLEM_CODESconst
const PROBLEM_CODES: readonly ProblemCode[]

Every code, in the order the union lists them.

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

isProblemCodefunction
function isProblemCode(word: string): word is ProblemCode

Whether a word is a code of the program.

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

CATALOGUEconst
const CATALOGUE: Readonly<Record<ProblemCode, Explained>>

The explanation of every code.

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

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