staleFindingsfunctionfunction staleFindings(fetched: readonly Fetched[]): readonly MizanFinding[]The findings: one sentence for each manifest whose latest source serves other bytes than the pin (0018-standards-first FR-014).
Report the standards whose newest version is not the one pinned (commons 0018-standards-first FR-006, FR-014, FR-017).
bun commons/libraries/src/newer.ts read commons/libraries/src/imports/*.import.ts, fetch each latest source and hold the findings against commons/spec-kit/mizan.newer.baseline.txt bun commons/libraries/src/newer.ts --imports DIR read the manifests of DIR bun commons/libraries/src/newer.ts --root DIR hold the findings against DIR/mizan.newer.baseline.txt (DIR holds mizan.baseline.txt too, as for check.ts) bun commons/libraries/src/newer.ts --write-baseline write the baseline from today's findings (to start it, or to shrink it: never to add a line to pass)
A manifest of an import (0019-mizan-integrations FR-014) may name, beside its versioned source, a latest source: an URL that always serves the newest version of the standard (schema.org's .../version/latest/..., a repository's latest tag). This command fetches each one and gives one finding, mizan/standard-newer, where the SHA-256 of what it serves differs from the pin. It is opt-in and the only part of Mizan that needs the network: check.ts and import.ts --check never do, so the network never fails the offline check. Its exit status is 0 (nothing new), 1 (a finding the baseline does not hold, or a baseline line that no longer occurs) or 2 (a latest source that cannot be fetched, or a manifest that cannot be read, named with its reason).
import { staleFindings } from "./newer.ts";
staleFindings([{ file: "imports/x.import.ts", id: "x", version: "1", pin: "a".repeat(64), latest: "https://example.org/latest", sha256: "b".repeat(64) }]).length; // 1Spec: 0001-libraries FR-008
staleFindingsfunctionfunction staleFindings(fetched: readonly Fetched[]): readonly MizanFinding[]The findings: one sentence for each manifest whose latest source serves other bytes than the pin (0018-standards-first FR-014).
Fetchedtypeno test imports ittype Fetched = LatestManifest & { readonly sha256: string };A manifest with the SHA-256 of what its latest source serves.
LatestManifesttypeno test imports ittype LatestManifest = {
readonly file: string;
readonly id: string;
readonly version: string;
readonly pin: string;
readonly latest: string;
};A manifest that names a latest source: its file, the standard it pins (id, version, SHA-256) and the URL that always serves the newest.
NEWER_BASELINE_COMMENTSconstno test imports itconst NEWER_BASELINE_COMMENTS: readonly ["The standards whose latest source served other bytes than the pin when each was first held (commons 0018-standards-first FR-017).", "A new finding fails the check, and so does a line below that no longer occurs: when you repin an import, delete its line.", "Never add a line to make a check pass."]The comment lines a baseline of this command begins with.
readLatestManifestsfunctionno test imports itfunction readLatestManifests(dir: string): Promise<{ readonly manifests: readonly LatestManifest[]; readonly problems: readonly string[]; }>The manifests of a folder (NAME.import.ts, in the order of their names) that name a latest source, and a sentence for each that cannot be read.
latestHashfunctionno test imports itfunction latestHash(url: string): Promise<Result<string, string>>The SHA-256 of what a URL serves, with its line ends normalised as an import's are (0019-mizan-integrations FR-014), or the sentence that says why it could not be fetched.