IF Commons GitHub

pure/freshness

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0001-quality-evidence FR-030

The freshness of a proof (commons 0001-quality-evidence FR-030): Fresh, Due or Stale (ifqs:FreshnessState), judged by time, as 0007-grc FR-011 judges evidence against a cadence (kernel/assess.ts), and by change, being stale where a file in the requirement's trace chain (its text, term, code or test, 0020-ifccm FR-014) changed after the revision of the run, or where the run's revision is not at or after the last change of the chain. A stale proof does not count at its grade and opens a nonconformance (FR-015).

Pure: the day today and what changed are arguments. host/gather.ts finds what changed with real git; this file only judges. The cadences are the quality system's own defaults (FR-047): a run stays fresh for 30 days, a probe for 7, a statement for 90 and a review for a year; a harness passes its own.

import { DEFAULT_CADENCES, freshnessOf } from "./freshness.ts";
// freshnessOf({ kind: "run", at }, ["commons/quality/src/pure/ladder.ts"], now, DEFAULT_CADENCES).state === "Stale"

Source: commons/quality/src/pure/freshness.ts

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

FreshnessStatetypeno test imports it
type FreshnessState = "Fresh" | "Due" | "Stale";

The state of a proof's freshness, in the words of the ontology (ifqs:Fresh, ifqs:Due, ifqs:Stale).

EvidenceKindtypeno test imports it
type EvidenceKind = "run" | "statement" | "review" | "probe";

What kind of evidence is judged: each has its own cadence.

Cadencestypeno test imports it
type Cadences = { readonly [K in EvidenceKind]: Duration };

The cadence each kind of evidence is held to (FR-047).

DEFAULT_CADENCESconst
const DEFAULT_CADENCES: Cadences

The default cadences (FR-047): the run's 30 days, the probe's 7, the statement's 90 and the review's year.

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

FreshnessVerdicttypeno test imports it
type FreshnessVerdict = {
  readonly state: FreshnessState;
  /** `change` where something in the chain changed after the evidence, else `time`. */
  readonly by: "time" | "change";
  readonly why: string;
  /** When it falls due, where the cadence is a time. */
  readonly dueAt?: Instant;
};

How a proof was judged: its state, by which means, and what says so.

freshnessOffunction
function freshnessOf(evidence: { readonly kind: EvidenceKind; readonly at: Instant; }, changes: readonly string[], now: Instant, cadences?: Cadences): FreshnessVerdict

The freshness of one piece of evidence at now (FR-030). changes names what in the requirement's chain changed after the evidence's revision (files, or the requirement's text): where any did, the proof is Stale by change whatever its age; otherwise it is Fresh, Due (in the last tenth of its cadence) or Stale by time.

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

countsfunctionno test imports it
function counts(state: FreshnessState): boolean

Whether a proof counts at its grade: Fresh and Due do, Stale does not (FR-030).

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