IF Commons GitHub

harness

The Mizan check of one harness (commons 0003-mizan FR-015, FR-019, FR-020, 0018-standards-first FR-003 to FR-005): the rules of a folder of specifications, the rules about the terms of the harness's ontology (a basis on every term, the 90 days of a Decision, deprecation), and a specification naming only defined terms, held against one baseline that only shrinks. A decision overdue and a term with no record of its basis fail whatever the baseline holds. Commons runs it on itself (check.ts); a harness runs it with its own audit.

import { holdHarness } from "./harness.ts";
// process.exitCode = holdHarness({ root: ".", baselineFile: "tools/mizan.baseline.txt", today: "2026-11-17", terms: [], termsFile: "ontology/audit.ts", completeness: [] });

Source: commons/mizan/src/harness.ts

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

holdHarnessfunction
function holdHarness(i: HarnessInput): number

Run the check: print every new finding and every stale baseline line on standard error; returns 0, or 1 where a finding is new or a baseline line is stale.

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

HarnessInputtypeno test imports it
type HarnessInput = { /** The folder that holds `specs/`. */ readonly root: string; /** The baseline file: finding… (2726 characters)
type HarnessInput = {
  /** The folder that holds `specs/`. */
  readonly root: string;
  /** The baseline file: findings held, which only shrinks. */
  readonly baselineFile: string;
  /** The day the 90 days of a decision are counted to (`YYYY-MM-DD`). */
  readonly today: string;
  /** The rules for a specification, Mizan's by default; a harness may add its own. */
  readonly plugins?: readonly RulePlugin[];
  /** Write the baseline from today's findings, to start it or to shrink it, and not check. */
  readonly writeBaseline?: boolean;
  /** The records of the basis of the harness's terms (the audit), and the file they are in. */
  readonly terms?: readonly TermRecord[];
  readonly termsFile?: string;
  /** For each ontology: its terms' IRIs and the IRIs the audit has a record of; a term with no record fails the check. */
  readonly completeness?: readonly { readonly file: string; readonly ontology: readonly string[]; readonly recorded: readonly string[] }[];
  /** The terms a specification may name by prefix, and the deprecated ones with what replaces each. */
  readonly specTerms?: {
    readonly known: KnownTerms;
    readonly deprecated?: ReadonlyMap<string, string>;
    /**
     * What each term's `mz:definedBy` says, by CURIE (`definitionsOf`): where it is given, a requirement that names a term the term does not cite back is a finding (0003-mizan FR-044), a
     * warning the baseline holds. Where it is not, the stage is not run.
     */
    readonly definitions?: TermDefinitions;
  };
  /** The name the report is headed with. */
  readonly name?: string;
  /**
   * The harness's declaration for the `changes` check (commons 0020-ifccm FR-010, FR-032) and the file it is read from, `undefined` for a harness that declares nothing: the rule that a regulated
   * domain needs a production day. The rules that need a range of commits are the command's (`changes.ts`).
   */
  readonly declaration?: { readonly declaration: Declaration | undefined; readonly file: string };
  /**
   * The records of the works under the root (`release.ts`, commons 0026-works-versioning FR-032), read as text with their paths from the root: that each decodes, that its version matches the pattern
   * of its kind's scheme and that a controlled document's revision has its approval. The comparison with a base is the command's (`versions.ts`).
   */
  readonly works?: readonly WorkFile[];
  /**
   * The conformance level the harness declares (commons 0028-conformance-levels FR-008): the check runs only the rules the level entails. `L3`, which entails every rule, where it is not given, so that a
   * harness that declares none sees what it saw before levels existed.
   */
  readonly level?: LevelKey;
};

What a harness gives the check.

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