Metakit / @doeixd/metakit/prove

machine

function · packages/metakit/src/prove/machine.ts:93

function machine<State, Transitions extends Readonly<Record<string, unknown>>>(
  m: Machine<State, Transitions>,
  options?: ProveOptions & {
    readonly pin?: ReadonlyArray<NoInfer<ArmOf<Transitions>>>
    readonly allowUnknown?: ReadonlyArray<
      readonly [NoInfer<ArmOf<Transitions>>, string]
    >
    readonly strict?: boolean
  },
): Effect.Effect<
  MachineProofReport<keyof Transitions & string>,
  SolverUnavailableError
>

Verify every transition in a Machine under strict/pinned CI discipline:

  • strict (default true): fails if any transition is refuted, or undecided without a non-empty reason in allowUnknown.
  • pin: arms of m that must remain proved (degrading to undecided or refuted fails the report with pinBroken: true).
  • allowUnknown: [arm, reason] pairs, each an arm of m left undecided for that reason.

An arm of another machine throws. The report is keyed by tag.

With an Artifact.EvidenceStore provided, an arm whose proof is kept under its key (the arm's contract hash, the state Schema, the solver's name, encoding and version, the prover's version and timeoutMs) is not proved again (reused), and a new proof is kept. Only a proof is kept: an arm left undecided or refuted is asked again on every run.