Squidie.ReadModel.Inspection.Snapshot (squidie v0.1.2)

Copy Markdown View Source

Projection-backed inspection snapshot for one Jido-native workflow run.

This struct is a compact read model built from the workflow and dispatch durable journals so callers can inspect a stable public shape without parsing raw journal entries.

Terminal runs keep both terminal? and terminal_status so operator-facing surfaces can suppress recovery actions while still distinguishing completed, failed, and cancelled histories.

Future-visible attempts are kept separate from currently visible attempts. This lets operator-facing surfaces explain delayed retry or deferred dispatch state without treating the run as idle or recoverable.

Summary

Types

attempt()

@type attempt() :: %{
  :runnable_key => String.t(),
  :status => atom(),
  :attempt_number => pos_integer(),
  :step => String.t(),
  :input => map(),
  :visible_at => DateTime.t(),
  :idempotency_key => String.t(),
  optional(:claim_id) => String.t(),
  optional(:owner_id) => String.t(),
  optional(:lease_until) => DateTime.t(),
  optional(:result) => map(),
  optional(:transition) => map(),
  optional(:error) => map(),
  optional(:recovery) => map(),
  optional(:deferred) => map(),
  wakeup_emitted?: boolean(),
  applied?: boolean()
}

reason()

@type reason() ::
  :terminal
  | :completed_result_pending_apply
  | :planned_dispatch_pending_schedule
  | :expired_claim
  | :attempt_claimed
  | :attempt_visible
  | :deferred_continuation
  | :attempt_scheduled_for_later
  | :manual_intervention_required
  | :run_started
  | :idle
  | :waiting_for_dispatch

t()

@type t() :: %Squidie.ReadModel.Inspection.Snapshot{
  anomalies: [map()],
  applied_runnable_keys: [String.t()],
  attempts: [attempt()],
  child_runs: [map()],
  command_history: [map()],
  context: map(),
  deadline: map() | nil,
  definition_version: String.t() | nil,
  dynamic_work: [map()],
  expired_claims: [attempt()],
  input: map() | nil,
  manual_state: map() | nil,
  next_visible_at: DateTime.t() | nil,
  parent_run: map() | nil,
  pending_dispatches: [map()],
  pending_results: [attempt()],
  planned_runnable_keys: [String.t()],
  planned_runnables: [map()],
  queue: String.t(),
  reason: reason(),
  replayed_from_run_id: String.t() | nil,
  run_id: String.t(),
  scheduled_attempts: [attempt()],
  status: atom(),
  terminal?: boolean(),
  terminal_status: atom() | nil,
  thread_revisions: %{run: non_neg_integer(), dispatch: non_neg_integer()},
  trigger: String.t() | nil,
  visible_attempts: [attempt()],
  workflow: String.t() | nil
}