Failuretypeno test imports ittype Failure = { readonly suite: string; readonly name: string; readonly message: string };One failed expectation.
The conformance suites of the ports (0001-grc-layers FR-009; 0004-grc-documents FR-011, 0005-grc-runners FR-010, 0006-grc-evidence FR-008, 0009-grc-groups FR-011, 0012-grc-subtenants FR-012): functions a third party runs against its own runner, store, signer or serializer, each returning every failed expectation as data (an empty list is a pass) and never throwing. This library runs them on every extension it ships.
import { storeConformance } from "@intellectual-frontiers/grc/conformance";
// const failures = await storeConformance(() => myStore());Failuretypeno test imports ittype Failure = { readonly suite: string; readonly name: string; readonly message: string };One failed expectation.
RunnerCasetypeno test imports ittype RunnerCase = { readonly name: string; readonly check: Check; readonly subject: Subject; readonly expect: Json };A fixture for a runner: a check, the subject, and the value the runner must observe.
runnerConformancefunctionfunction runnerConformance(runner: Runner, cases: readonly RunnerCase[], now?: () => string): Promise<readonly Failure[]>A runner given the fixtures its author gives gives the value each expects, the same twice, and never throws.
storeConformancefunctionfunction storeConformance(make: () => EvidenceStore | Promise<EvidenceStore>, tamper?: ((store: EvidenceStore, digest: string) => Promise<void>) | undefined): Promise<readonly Failure[]>A store: content addressing, an idempotent put, a missing digest, the list with its filter, and, where tamper is given, a tampered object.
SignerKeystypeno test imports ittype SignerKeys = { readonly signing: readonly unknown[]; readonly verifying: readonly unknown[]; readonly otherVerifying: readonly unknown[] };The keys a signer is tried with: to sign, to verify, and a pair that is not the same.
signerConformancefunctionfunction signerConformance(signer: Signer, keys: SignerKeys): Promise<readonly Failure[]>A signer: sign then verify, verify with a wrong key, and a tampered payload.
serializerConformancefunctionfunction serializerConformance(serializer: Serializer, sample: Document & { readonly title: string; readonly frameworks:… (11914 characters)function serializerConformance(serializer: Serializer, sample: Document & { readonly title: string; readonly frameworks: readonly (Document & { readonly version: string; readonly title: string; readonly controls: readonly ObjectOf<{ id: Decoder<string>; title: Decoder<string>; statement: Decoder<string>; }, { family: Decoder<string>; }>[]; } & { readonly publisher?: string | undefined; readonly source?: string | undefined; })[]; readonly results: readonly (Document & { readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly reason: string; readonly observedAt: string; } & { readonly value?: Json | undefined; readonly via?: string | undefined; readonly policy?: string | undefined; readonly exception?: string | undefined; readonly was?: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn" | undefined; })[]; readonly findings: readonly (Document & { readonly result: string; readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly title: string; readonly detail: string; readonly evidence: readonly string[]; } & { readonly remediation?: string | undefined; readonly exception?: string | undefined; })[]; readonly evidence: readonly (Document & { readonly subject: string; readonly type: string; readonly digest: string; readonly mediaType: string; readonly size: number; readonly observedAt: string; } & { readonly store?: string | undefined; readonly producer?: string | undefined; })[]; readonly attestations: readonly (Document & { readonly subject: string; readonly check: string; readonly claim: "fail" | "pass"; readonly statement: string; readonly attester: string; readonly role: string; readonly evidence: readonly string[]; } & { readonly signature?: string | undefined; readonly signer?: string | undefined; })[]; readonly exceptions: readonly (Document & { readonly excuses: ObjectOf<{ type: Decoder<"check" | "control" | "policy">; ref: Decoder<string>; }, Record<never, never>>; readonly subjects: readonly string[]; readonly reason: string; readonly approvedBy: string; readonly grantedAt: string; readonly expiresAt: string; } & { readonly acceptedRisk?: ObjectOf<{ owner: Decoder<string>; level: Decoder<"high" | "low" | "moderate" | "very-high" | "very-low">; reviewBy: Decoder<string>; }, Record<never, never>> | undefined; readonly inheritable?: boolean | undefined; })[]; readonly risks: readonly (Document & { readonly title: string; readonly description: string; readonly likelihood: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly impact: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly level: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly treatment: "accept" | "avoid" | "mitigate" | "transfer"; readonly owner: string; readonly reviewBy: string; readonly controls: readonly string[]; } & {})[]; } & { readonly policies?: readonly (Document & { readonly title: string; readonly scope: ObjectOf<{ platforms: Decoder<readonly string[]>; tags: Decoder<readonly string[]>; }, Record<never, never>>; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly rationale: string; readonly controls: readonly string[]; readonly checks: readonly string[]; readonly owner: string; readonly review: ObjectOf<{ cadence: Decoder<string>; }, { lastReviewed: Decoder<string>; }>; } & { readonly exceptions?: readonly string[] | undefined; })[] | undefined; readonly checks?: readonly (Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; })[] | undefined; }, empty: Document & { readonly title: string; readonly frameworks: readonly (Document & { readonly version: string; readonly title: string; readonly controls: readonly ObjectOf<{ id: Decoder<string>; title: Decoder<string>; statement: Decoder<string>; }, { family: Decoder<string>; }>[]; } & { readonly publisher?: string | undefined; readonly source?: string | undefined; })[]; readonly results: readonly (Document & { readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly reason: string; readonly observedAt: string; } & { readonly value?: Json | undefined; readonly via?: string | undefined; readonly policy?: string | undefined; readonly exception?: string | undefined; readonly was?: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn" | undefined; })[]; readonly findings: readonly (Document & { readonly result: string; readonly check: string; readonly controls: readonly string[]; readonly subject: string; readonly status: "accepted" | "error" | "fail" | "gap" | "not-applicable" | "pass" | "pending" | "warn"; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly title: string; readonly detail: string; readonly evidence: readonly string[]; } & { readonly remediation?: string | undefined; readonly exception?: string | undefined; })[]; readonly evidence: readonly (Document & { readonly subject: string; readonly type: string; readonly digest: string; readonly mediaType: string; readonly size: number; readonly observedAt: string; } & { readonly store?: string | undefined; readonly producer?: string | undefined; })[]; readonly attestations: readonly (Document & { readonly subject: string; readonly check: string; readonly claim: "fail" | "pass"; readonly statement: string; readonly attester: string; readonly role: string; readonly evidence: readonly string[]; } & { readonly signature?: string | undefined; readonly signer?: string | undefined; })[]; readonly exceptions: readonly (Document & { readonly excuses: ObjectOf<{ type: Decoder<"check" | "control" | "policy">; ref: Decoder<string>; }, Record<never, never>>; readonly subjects: readonly string[]; readonly reason: string; readonly approvedBy: string; readonly grantedAt: string; readonly expiresAt: string; } & { readonly acceptedRisk?: ObjectOf<{ owner: Decoder<string>; level: Decoder<"high" | "low" | "moderate" | "very-high" | "very-low">; reviewBy: Decoder<string>; }, Record<never, never>> | undefined; readonly inheritable?: boolean | undefined; })[]; readonly risks: readonly (Document & { readonly title: string; readonly description: string; readonly likelihood: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly impact: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly level: "high" | "low" | "moderate" | "very-high" | "very-low"; readonly treatment: "accept" | "avoid" | "mitigate" | "transfer"; readonly owner: string; readonly reviewBy: string; readonly controls: readonly string[]; } & {})[]; } & { readonly policies?: readonly (Document & { readonly title: string; readonly scope: ObjectOf<{ platforms: Decoder<readonly string[]>; tags: Decoder<readonly string[]>; }, Record<never, never>>; readonly severity: "critical" | "high" | "info" | "low" | "medium"; readonly rationale: string; readonly controls: readonly string[]; readonly checks: readonly string[]; readonly owner: string; readonly review: ObjectOf<{ cadence: Decoder<string>; }, { lastReviewed: Decoder<string>; }>; } & { readonly exceptions?: readonly string[] | undefined; })[] | undefined; readonly checks?: readonly (Document & { readonly ask: string; readonly expect: import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"non-empty">; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"equals">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"count">; }, { min: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; max: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<number>; }> | import("/home/runner/work/.github/.github/commons/core/src/decode").ObjectOf<{ kind: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"every">; field: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<string>; op: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<"eq" | "ge" | "gt" | "in" | "le" | "lt" | "matches" | "ne">; value: import("/home/runner/work/.github/.github/commons/core/src/decode").Decoder<import("/home/runner/work/.github/.github/commons/grc/src/governance/kinds").Json>; }, Record<never, never>>; readonly platforms: readonly string[]; readonly freshness: string; readonly controls: readonly string[]; readonly runner: ObjectOf<{ kind: Decoder<string>; input: Decoder<Json>; }, Record<never, never>>; } & { readonly severity?: "critical" | "high" | "info" | "low" | "medium" | undefined; })[] | undefined; }, context?: SerializeContext, accepts?: ((text: string) => string | undefined) | undefined): Promise<readonly Failure[]>A serializer: it names its format and version, is deterministic, gives a value and not an exception for an assessment with no results, and, where accepts is given, its output is accepted.
EntityDatatypetype EntityData = {
readonly ledger: readonly LedgerEntry[];
readonly results: readonly Outcome[];
readonly exceptions: readonly Exception[];
readonly store: EvidenceStore;
};What one entity holds, which only its own ports reach.
GroupCasetypetype GroupCase = {
readonly group: EntityGroup;
readonly scope: ControlScope;
readonly material: GroupMaterial;
readonly data: ReadonlyMap<EntityId, EntityData>;
readonly exceptions: readonly Exception[];
readonly at: string;
};The case a group's way of making readers is tried with: the group, its scope and material, what each entity holds, and the instant.
groupConformancefunctionfunction groupConformance(c: GroupCase, make?: (ports: EntityPorts, material: GroupMaterial) => EntityReader): Promise<readonly Failure[]>A group's readers over per-entity ports that cannot see each other: while an entity's reader runs, the ports of every other entity throw. It checks that every entity is read, that the view is the same as the one made from the snapshots alone, that an entity that cannot be read is pending and the others are unchanged, and that no reader touches another entity's ports.
// const failures = await groupConformance({ group, scope, material, data, exceptions: [], at }); // [] is a pass