Insider.Scenario (Insider Lab v0.1.0)

Copy Markdown View Source

A bounded, portable sequence of declared semantic contract operations.

Scenario documents contain data, never callbacks, module names, commands, or ambient authority. A live contract must be resolved from an explicit module allowlist before execution.

Summary

Functions

Resolves the pinned contract from an explicit bounded module allowlist.

Builds a canonical scenario from an ordered, nonempty subset of existing step IDs.

Types

t()

@type t() :: %Insider.Scenario{
  contract: term(),
  expected_incident_fingerprints: term(),
  id: term(),
  integrity: term(),
  limits: term(),
  reset: term(),
  schema: term(),
  seed: term(),
  steps: term()
}

Functions

canonical_binary(scenario)

@spec canonical_binary(term()) ::
  {:ok, binary()} | {:error, Insider.Protocol.Error.t()}

decode(binary)

@spec decode(binary()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}

decode_map(payload)

@spec decode_map(term()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}

descriptor(scenario)

@spec descriptor(term()) :: {:ok, map()} | {:error, Insider.Protocol.Error.t()}

new(contract_description, options)

@spec new(map(), keyword()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}

resolve(scenario, modules, environment)

@spec resolve(term(), term(), atom()) ::
  {:ok, module()} | {:error, Insider.Protocol.Error.t()}

Resolves the pinned contract from an explicit bounded module allowlist.

retain_steps(scenario, retained_step_ids)

@spec retain_steps(term(), term()) ::
  {:ok, t()} | {:error, Insider.Protocol.Error.t()}

Builds a canonical scenario from an ordered, nonempty subset of existing step IDs.

to_wire_map(scenario)

@spec to_wire_map(t()) :: map()

validate(scenario)

@spec validate(term()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}