IF Commons GitHub

policy

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-workspace-model FR-032

What the workspace requires of itself (commons 0002-workspace-model FR-032, FR-033, 0003-host FR-015): the policy the manifest names, and the judgements that follow from it as pure functions: a regulated domain requires signed commits, a commit that is not signed and verified is an error there and a warning elsewhere, a hook that cannot run its checker fails there and says so elsewhere, and a Git host the policy does not allow is told.

Source: commons/ergonex/src/policy.ts

4 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.

hookFailsWhenUnableToCheckfunction
function hookFailsWhenUnableToCheck(policy: Policy): boolean

Whether a Git hook that cannot run its checker fails (exits non-zero) or only says so on standard error: it fails where a regulated domain is named (0003-host FR-015).

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

hostAllowedfunction
function hostAllowed(policy: Policy, host: string): boolean

Whether a Git host is allowed: any, where the policy lists none.

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

isRegulatedfunctionno test imports it
function isRegulated(policy: Policy): boolean

Whether the workspace names a regulated domain.

Policytypeno test imports it
type Policy = { /** Whether a commit must be signed (OpenPGP or SSH) and verified; always true where a regulated domai… (620 characters)
type Policy = {
  /** Whether a commit must be signed (OpenPGP or SSH) and verified; always true where a regulated domain is named. */
  readonly requiresSignedCommits: boolean;
  /** The regulated domains the manifest names (the keys of `ifccm:RegulatedDomain`); none means an unregulated workspace. */
  readonly regulatedDomain: readonly string[];
  /** How many days a tool or module outside the catalog is informational before it is a warning. */
  readonly unapprovedGraceDays: number;
  /** The Git hosts a repository of the manifest may be on; empty means any. */
  readonly allowedGitHost: readonly string[];
};

The workspace's policy (ergonex:WorkspacePolicy).

policyOffunction
function policyOf(input?: PolicyInput): Policy

The policy from what the manifest says: signed commits are required wherever a regulated domain is named, whatever else it says (FR-032).

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

PolicyInputtypeno test imports it
type PolicyInput = {
  readonly requiresSignedCommits?: boolean | undefined;
  readonly regulatedDomain?: readonly string[] | undefined;
  readonly unapprovedGraceDays?: number | undefined;
  readonly allowedGitHost?: readonly string[] | undefined;
};

What the manifest says of the policy, each part optional.

unsignedCommitSeverityfunction
function unsignedCommitSeverity(policy: Policy, signedAndVerified: boolean): Severity | undefined

The severity of a commit in a managed repository: nothing where the commit is signed and verified; an error where a regulated domain is named; a warning elsewhere (FR-032: "elsewhere the same commit MUST be a warning").

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

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