IF Commons GitHub

assessor/host

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

What the Trust page and the assessor pack are made from, read once with real git (commons 0001-quality-evidence FR-052, FR-062): the evidence files of the quality branch in the order they were kept, the ledger's files, the notes on the tested commits, the specifications at the tested revisions, the proof judged on the ladder, the objectives and the records of Tier 2. collect reads them; trustInputOf and packSourceOf make the page's content and the pack's source from the same Collected, so that the two are made from the same evidence in one run.

Nothing here reads a clock: the day of a page is today where one is given and the day of the newest thing on the branch otherwise, so that the same repository gives the same page and the same pack. A pack is written as a folder, and as one deterministic tar beside it with its SHA-256 and a DCAT distribution (FR-063). readPackFolder and readPackTar read one back for quality verify-pack.

Source: commons/quality/src/assessor/host.ts

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

CollectErrortypeno test imports it
type CollectError =
  | { readonly kind: "gather"; readonly reason: string }
  | { readonly kind: "host"; readonly error: HostError }
  | { readonly kind: "refused"; readonly reason: string };

Why the evidence could not be collected.

formatCollectErrorfunctionno test imports it
function formatCollectError(e: CollectError): string

A collect error as one sentence.

CollectOptionstypeno test imports it
type CollectOptions = { readonly repo: string; /** The proof register; the repository's own where not given. */ re… (583 characters)
type CollectOptions = {
  readonly repo: string;
  /** The proof register; the repository's own where not given. */
  readonly register?: string;
  /** The day the page is as of: the day of the newest thing on the branch where not given (no clock). */
  readonly today?: string;
  /** The harness's declaration, where it has one: a regulated harness in production needs `E4` for every requirement (0001-quality-evidence FR-016). */
  readonly declaration?: Declaration;
  /** The revision the page and the pack are made at: `HEAD` where not given. */
  readonly revision?: string;
};

What collect is given.

Collectedtypeno test imports it
type Collected = { readonly repo: string; readonly revision: string; readonly today: string; readonly gathered: … (553 characters)
type Collected = {
  readonly repo: string;
  readonly revision: string;
  readonly today: string;
  readonly gathered: Gathered;
  /** The harness's declaration the judgements were made under, where it has one. */
  readonly declaration?: Declaration;
  readonly tier2: Tier2State;
  readonly evaluations: readonly Evaluation[];
  readonly strengths: ReadonlyMap<string, Strength>;
  readonly evidence: readonly SourceFile[];
  readonly records: readonly SourceFile[];
  readonly notes: readonly { readonly commit: string; readonly text: string }[];
};

What was read.

collectfunction
function collect(options: CollectOptions): Promise<Result<Collected, CollectError>>

Reads the repository once for the page and the pack (FR-062).

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

trustInputOffunctionno test imports it
function trustInputOf(c: Collected, options: { readonly harness: string; readonly scopeNote?: string | undefined; readonly notCovered?: readonly string[] | undefined; readonly agentRatePermille?: number | undefined; }): TrustInput

The page's content from what was collected (FR-053, FR-054, FR-056): before redaction, which trustViewOf does.

PackOptionstypeno test imports it
type PackOptions = {
  readonly harness: string;
  readonly span?: { readonly from?: string; readonly to?: string };
  readonly signing?: PackSource["signing"];
};

What a pack is made with besides the evidence.

VerifierFiletypeno test imports it
type VerifierFile = "verify-pack.ts" | "verify.ts";

The two source files of the verifier that every pack carries (FR-066).

VerifierErrortypeno test imports it
type VerifierError = { readonly kind: "verifier-missing"; readonly file: VerifierFile; readonly tried: readonly string[] };

A verifier file that is in none of the places it is looked for, with the places.

formatVerifierErrorfunction
function formatVerifierError(e: VerifierError): string

A verifier error as one sentence.

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

verifierCandidatesfunction
function verifierCandidates(here: string, file: VerifierFile): readonly string[]

Where a verifier file may be, from the folder of the module that asks, in the three layouts a module runs in: beside the module (the source layout, and Bun's bun condition on a published package), in the src/assessor/ of the package that the compiled module dist/assessor/ belongs to (the per-library package under Node, where only .js and .d.ts are compiled), and in the src/assessor/ of the library folder that the compiled module <library>/dist/src/assessor/ belongs to (the one package of commons under Node, @intellectual-frontiers/commons/quality, where the sources are shipped at the paths they have in the library's folder).

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

verifierSourcesfunction
function verifierSources(here: string): Promise<Result<{ readonly pack: string; readonly main: string; }, VerifierError>>

The verifier's two files read from the first place each is found, from the folder of the module that asks (FR-066, FR-069).

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

packSourceOffunction
function packSourceOf(c: Collected, options: PackOptions): Promise<Result<PackSource, CollectError>>

The pack's source from what was collected, with the verifier's own files read from where this program is (FR-066).

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

writePackfunction
function writePack(out: string, pack: BuiltPack, options: { readonly title: string; readonly revision: string; }): Promise<Result<{ readonly tar: string; readonly sha256: string; readonly dcat: string; }, string>>

Writes a pack as a folder (refused where the folder is not empty), and beside it one deterministic tar with its SHA-256 and DCAT distribution (FR-063).

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

readPackFolderfunction
function readPackFolder(root: string): Promise<PackFiles>

The files of a pack folder.

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

readPackTarfunction
function readPackTar(path: string): Promise<Result<PackFiles, string>>

The files of a pack tar.

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

loadSigningKeyfunctionno test imports it
function loadSigningKey(jwkText: string, principal: string): Promise<Result<{ readonly keys: readonly DsseKey[]; readonly allowedSigners: string; }, string>>

The key that signs a pack, from a JWK file ({"kty":"OKP","crv":"Ed25519","x":...,"d":...}), and the allowed-signers file that verifies it for principal: the key is imported for signing alone, and what is published of it is the public part.

packOffunction
function packOf(c: Collected, options: PackOptions): Promise<Result<BuiltPack, string>>

A pack from the evidence collected: the page and the pack are made from the same Collected (FR-062).

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

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