IF Commons GitHub

trust/audience

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

Audiences and redaction (commons 0001-quality-evidence FR-057 to FR-059): each rendering of evidence is for one audience (ifqs:Audience), and what it leaves out follows from who reads it.

  • Public: a figure, an identifier, a grade and a failure's requirement and reason. Left out: what 0006-signals FR-006 redacts (secrets), the names of people, customers and hosts, the paths and names of private repositories, and any value a failure message holds beyond its requirement and reason. The rendering says how many values it redacted.
  • Assessor: the full records, with secrets and personal data (an e-mail address) redacted only.
  • Internal: the harness's own people through its console: secrets only.

Redaction is deterministic and changes no figure: the same text and the same rules give the same bytes and the same count, and the count of a grade, a digest or a total of a narrower audience is the wider audience's (withheld is how a value dropped whole is counted).

terms are the names the harness knows must never be public: its customers, its people, its hosts and its private repositories. A pattern cannot tell a person's name from a word, so a name is removed where the harness lists it; the patterns find what has a shape (an address, a URL, an IP address, an absolute path, a secret). The audience words are the keys of ifqs:Audience (ifqs-ontology.test.ts asserts it).

import { redactFor } from "./audience.ts";
redactFor("Public", { terms: ["Acme Ltd"] }, "failed for Acme Ltd at https://db.acme.example/x").text;
// "failed for REDACTED at REDACTED"

Source: commons/quality/src/trust/audience.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.

Audiencetypeno test imports it
type Audience = "Public" | "Assessor" | "Internal";

Who a rendering is for (ifqs:Public, ifqs:Assessor, ifqs:Internal).

AUDIENCESconst
const AUDIENCES: readonly Audience[]

Every audience, widest first.

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

isAudiencefunctionno test imports it
function isAudience(text: string): text is Audience

Whether a text is an audience.

RedactionRulestypeno test imports it
type RedactionRules = { readonly terms: readonly string[] };

What a harness lists besides the patterns: names that must never reach the public (customers, people, hosts, private repositories).

Redactedtypeno test imports it
type Redacted = { readonly text: string; readonly count: number };

A text redacted for an audience, and how many values were redacted.

redactForfunction
function redactFor(audience: Audience, rules: RedactionRules, text: string): Redacted

A text redacted for an audience (FR-058, FR-059): see the module's account of what each audience leaves out.

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

showsMessagesfunctionno test imports it
function showsMessages(audience: Audience): boolean

Whether a rendering for this audience carries the words of a failure's message (FR-058: the public does not).

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