IF Commons GitHub

changes/trace

The chain from a change request to the run that proved it (commons 0020-ifccm FR-014, FR-015): for each requirement a Done when names, the stages issue, requirement, ontology term, code, test and quality run, each linked by the annotation it already has (Done when, the specification's FR-nnn, mz:definedBy, // Spec:, proves, a run's case), and the first stage with no link.

Pure: the specifications, the ontology's citations, the source and test files and the cases of a run are arguments. It reuses the readers of kernel/trace.ts for the specifications, the // Spec: lines and the proves calls, so that no stage needs an annotation of its own. A citation of a whole specification (no requirement named) does not link a requirement to a term; for code and tests it does not either: a stage links a requirement only by naming it, alone or in a range.

import { firstBreak, traceOf } from "./trace.ts";
const t = traceOf("0020-ifccm FR-005", { specs: [], terms: [], sources: [], tests: [], cases: [] });
firstBreak(t); // "StageRequirement": the specification has no such requirement

Source: commons/mizan/src/changes/trace.ts

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

changes.firstBreakfunctionno test imports it
function firstBreak(t: Trace): "StageCode" | "StageIssue" | "StageRequirement" | "StageRun" | "StageTerm" | "StageTest" | undefined

The first stage with no link, or undefined where the chain is whole (0020-ifccm FR-015).

changes.STAGESconstno test imports it
const STAGES: readonly ["StageIssue", "StageRequirement", "StageTerm", "StageCode", "StageTest", "StageRun"]

The stages of the chain, in order (ifccm:TraceStage; a test holds the names equal to the ontology's).

changes.traceLinesfunctionno test imports it
function traceLines(traces: readonly Trace[]): readonly string[]

A chain as lines for a report: one line a requirement, ending where the chain breaks.

changes.traceOffunctionno test imports it
function traceOf(requirement: string, input: TraceInput): Trace

The chain of one requirement NNNN-slug FR-nnn: every stage, linked or not, so that a report ends where the chain breaks. The first stage, the change request, is linked by the caller's naming it.

changes.RunCasetypeno test imports it
type RunCase = { readonly requirements: readonly string[]; readonly outcome: "pass" | "fail" | "skip" | "todo" | "cancelled" };

The case of a run that the last stage reads: the requirements it names and its outcome.

changes.SpecSourcetypeno test imports it
type SpecSource = { readonly slug: string; readonly spec: string };

A specification as the chain reads it: its folder's name and the text of its spec.md.

changes.Stagetypeno test imports it
type Stage = (typeof STAGES)[number];

One stage of the chain.

changes.StageResulttypeno test imports it
type StageResult = { readonly stage: Stage; readonly linked: boolean; readonly by: readonly string[] };

One stage's result: whether it is linked, and what links it.

changes.Tracetypeno test imports it
type Trace = { readonly requirement: string; readonly stages: readonly StageResult[] };

The chain of one requirement.

changes.TraceInputtypeno test imports it
type TraceInput = { readonly specs: readonly SpecSource[]; /** The ontology's citations: each term and the requireme… (496 characters)
type TraceInput = {
  readonly specs: readonly SpecSource[];
  /** The ontology's citations: each term and the requirements it cites (`mz:definedBy`). */
  readonly terms: readonly OntologyCitation[];
  /** The source files, read for their `// Spec:` lines. */
  readonly sources: readonly SourceFile[];
  /** The test files, read for their `proves` calls. */
  readonly tests: readonly SourceFile[];
  /** The cases of the quality run at the revision. */
  readonly cases: readonly RunCase[];
};

What the chain reads.

firstBreakfunction
function firstBreak(t: Trace): "StageCode" | "StageIssue" | "StageRequirement" | "StageRun" | "StageTerm" | "StageTest" | undefined

The first stage with no link, or undefined where the chain is whole (0020-ifccm FR-015).

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

STAGESconst
const STAGES: readonly ["StageIssue", "StageRequirement", "StageTerm", "StageCode", "StageTest", "StageRun"]

The stages of the chain, in order (ifccm:TraceStage; a test holds the names equal to the ontology's).

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

traceLinesfunction
function traceLines(traces: readonly Trace[]): readonly string[]

A chain as lines for a report: one line a requirement, ending where the chain breaks.

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

traceOffunction
function traceOf(requirement: string, input: TraceInput): Trace

The chain of one requirement NNNN-slug FR-nnn: every stage, linked or not, so that a report ends where the chain breaks. The first stage, the change request, is linked by the caller's naming it.

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

RunCasetypeno test imports it
type RunCase = { readonly requirements: readonly string[]; readonly outcome: "pass" | "fail" | "skip" | "todo" | "cancelled" };

The case of a run that the last stage reads: the requirements it names and its outcome.

SpecSourcetypeno test imports it
type SpecSource = { readonly slug: string; readonly spec: string };

A specification as the chain reads it: its folder's name and the text of its spec.md.

Stagetypeno test imports it
type Stage = (typeof STAGES)[number];

One stage of the chain.

StageResulttypeno test imports it
type StageResult = { readonly stage: Stage; readonly linked: boolean; readonly by: readonly string[] };

One stage's result: whether it is linked, and what links it.

Tracetypeno test imports it
type Trace = { readonly requirement: string; readonly stages: readonly StageResult[] };

The chain of one requirement.

TraceInputtype
type TraceInput = { readonly specs: readonly SpecSource[]; /** The ontology's citations: each term and the requireme… (496 characters)
type TraceInput = {
  readonly specs: readonly SpecSource[];
  /** The ontology's citations: each term and the requirements it cites (`mz:definedBy`). */
  readonly terms: readonly OntologyCitation[];
  /** The source files, read for their `// Spec:` lines. */
  readonly sources: readonly SourceFile[];
  /** The test files, read for their `proves` calls. */
  readonly tests: readonly SourceFile[];
  /** The cases of the quality run at the revision. */
  readonly cases: readonly RunCase[];
};

What the chain reads.

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

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