IF Commons GitHub

physical/checks

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-estate-query-checks FR-001, 0004-estate-query-checks FR-002, 0004-estate-query-checks FR-003

Policy as SQL: a check of the grc library whose question is a query over the estate (a check passes where its query gives no row, or whatever else it expects of the rows), run by the sql runner of grc over the estate as its connection. The connection only reads and says so, and the query is judged by the guard before it runs. A check is a document of grc like every other, so its result is a result of grc, with the controls the check answers to.

import { estateConnection } from "./checks.ts";
// const rows = await estateConnection(openEstateQuery(data)).query("select id from asset where state = 'managed'", []);

Source: commons/estate-query/src/physical/checks.ts

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

physical.checkOffunctionno test imports it
function checkOf(c: SavedCheck, now: string): Result<Document & { readonly ask: string; readonly expect: import("/home/r… (2130 characters)
function checkOf(c: SavedCheck, now: string): Result<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; }, string>

A check of grc from what a person wrote, or the reason it is not one.

physical.estateConnectionfunctionno test imports it
function estateConnection(q: EstateQuery): SqlConnection

The estate as a connection that only reads: a row is an object of its columns. A question the estate refuses or fails to answer is a failure of the check, with the reason.

physical.estateRunnersfunctionno test imports it
function estateRunners(q: EstateQuery): Runners

The runners a check over the estate needs: the sql runner over the estate.

physical.runEstateChecksfunctionno test imports it
function runEstateChecks(checks: readonly (Document & { readonly ask: string; readonly expect: import("/home/runner/work… (2793 characters)
function runEstateChecks(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; })[], q: EstateQuery, now: () => string, timeoutMs?: number): Promise<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; })[]>

The result of each check run over the estate at an instant: a check that cannot run is an error result with the reason, and never stops the others.

physical.SavedChecktypeno test imports it
type SavedCheck = { /** The identity of the check. */ readonly id: string; /** The question in words. */ readonl… (648 characters)
type SavedCheck = {
  /** The identity of the check. */
  readonly id: string;
  /** The question in words. */
  readonly ask: string;
  /** The statement: one read of the estate. */
  readonly sql: string;
  /** Values for `?`, in order. */
  readonly params?: readonly Json[];
  /** What is expected of the rows: none of them (`empty`, the default), some (`non-empty`), a count or a condition on every row. */
  readonly expect?: Json;
  /** The URNs of the controls it answers to. */
  readonly controls?: readonly string[];
  /** How long a result stays good (ISO 8601 duration; one day where none is said). */
  readonly freshness?: string;
};

What a person writes of a check over the estate.

checkOffunction
function checkOf(c: SavedCheck, now: string): Result<Document & { readonly ask: string; readonly expect: import("/home/r… (2130 characters)
function checkOf(c: SavedCheck, now: string): Result<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; }, string>

A check of grc from what a person wrote, or the reason it is not one.

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

estateConnectionfunction
function estateConnection(q: EstateQuery): SqlConnection

The estate as a connection that only reads: a row is an object of its columns. A question the estate refuses or fails to answer is a failure of the check, with the reason.

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

estateRunnersfunctionno test imports it
function estateRunners(q: EstateQuery): Runners

The runners a check over the estate needs: the sql runner over the estate.

runEstateChecksfunction
function runEstateChecks(checks: readonly (Document & { readonly ask: string; readonly expect: import("/home/runner/work… (2793 characters)
function runEstateChecks(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; })[], q: EstateQuery, now: () => string, timeoutMs?: number): Promise<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; })[]>

The result of each check run over the estate at an instant: a check that cannot run is an error result with the reason, and never stops the others.

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

SavedChecktypeno test imports it
type SavedCheck = { /** The identity of the check. */ readonly id: string; /** The question in words. */ readonl… (648 characters)
type SavedCheck = {
  /** The identity of the check. */
  readonly id: string;
  /** The question in words. */
  readonly ask: string;
  /** The statement: one read of the estate. */
  readonly sql: string;
  /** Values for `?`, in order. */
  readonly params?: readonly Json[];
  /** What is expected of the rows: none of them (`empty`, the default), some (`non-empty`), a count or a condition on every row. */
  readonly expect?: Json;
  /** The URNs of the controls it answers to. */
  readonly controls?: readonly string[];
  /** How long a result stays good (ISO 8601 duration; one day where none is said). */
  readonly freshness?: string;
};

What a person writes of a check over the estate.

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