Metakit / API

@doeixd/metakit/temporal

What a single-step proof cannot cover (@doeixd/metakit/temporal).

Prove.transition shows one step keeps a rule, from any valid state. Two things lie outside it:

  1. What the store must do. A rule holds across concurrent writers only if the store runs them as the proof assumes. requirements reads which capability each declared rule needs, and @doeixd/metakit/store's mount throws where a store that cannot give one is asked to hold the rule.
  2. What the order of events must not change. Two transitions that touch the same state can be answered in either order. obligations names each such pair as an obligation of kind walk, walk runs a scenario's steps in seeded orders and checks a property after every step, and undischarged lists the obligations no passing walk covers.

Functions

dischargeWalk scenario for obligation. Throws when the scenario has no step for one of the obligation's over (a pair of one transition needs two steps of it). An…
dischargedA Discharge of obligation written by hand, for a walk run some other way (@doeixd/metakit/pairs makes its own).
evidenceOne owner's account of its obligations, as a value: what it owed, the walks that ran for them (discharges, any number per obligation) and the pairs it…
generatorA small seeded generator (mulberry32): the same seed gives the same orders everywhere.
obligationA walk obligation a check of your own emits.
obligationsOne walk obligation for each pair of machine's transitions whose order matters: one writes what the other reads or writes (a transition that writes pairs…
protocolDefine a protocol from its obligations (obligation(...)), so discharge accepts only those: another obligation is a type error, and throws when it is passed…
reportWhat evidence shows, together: each obligation is open while a walk of it broke or none closes it, whatever order the walks ran in, and a decided pair whose…
requirementsThe capability each declared rule needs, by the rule's key.
undischargedThe obligations no walk that held covers: assert it is empty in a test. A discharge naming no obligation of the list is a type error.
walkRun scenario's steps in runs seeded orders, each respecting every step's after, asking holds after every step. The first broken order stops the walk.
walkAsyncwalk for steps that must be awaited (an exchange, an IndexedDB transaction): the same seeded orders, each step after the ones it waits on, the property…
walkEffectEffect-native walk: runs seeded valid interleavings inside Effect.scoped, checks holds after every step, and shrinks any failing interleaving to a minimal…

Values

WalkResultWhat a walk found. Broken carries the seed whose order broke the property (walk(scenario, { seed, runs: 1 }) runs it again), that order up to the failing…

Interfaces

AsyncScenarioScenario for steps that must be awaited: each order runs on a world of its own.
AsyncStepOne step of an AsyncScenario: a send, an exchange, a transaction, awaited.
DecidedPairA pair decided without a test, why, and the walk that checked the decision, if one ran.
DischargeA walk run for one obligation, and what it found. answer is set only by a walk that was asked what the order does rather than to show it never matters…
DischargedObligationAn obligation a walk covers, and what the walk found.
EffectScenarioScenario for Effect-native steps: each order runs inside its own Scope for automatic teardown.
EffectStepOne step of an EffectScenario: an effectful send, exchange, or transaction.
EvidenceOne owner's account of its obligations, as plain data: what it owes, the walks that ran for them, and the pairs it decided without a test. Made by evidence;…
ObligationReportWhat some evidence shows: open and discharged obligations, and the pairs decided without a test.
OpenObligationAn obligation no walk that held covers, and why it is open.
PairCoverageThe matched scenario occurrences and which directions the walk exercised.
Protocoldischarge for the obligations of one application-defined protocol.
ScenarioSteps a walk orders, and what must hold after each.
ScopeWhere an obligation belongs: owner names the machine or protocol, where the place that declared it.
StepOne step of a scenario: a send, an answer, a reconnect.
WalkObligationSomething to show by running steps in several orders: detail says what, over names the Messages or transitions whose order is in question.
WalkOptions

Types