CMDCEval.Workflow (cmdc_eval v0.3.0)

Copy Markdown View Source

Workflow Eval adapter。

接收 cmdc_orchestrator 的 Run / NodeRun / RunEvent 账本快照,归一化为 CMDCEval 可消费的指标 map。该模块不依赖 cmdc_orchestrator,只读取公开 struct/map 字段,因此可以用于离线 fixture、Gateway 事件回放和发布门禁。

Summary

Functions

直接从 run / node_runs / events 构造 WorkflowEval context。

CMDCOrchestrator.status/2 快照或离线 fixture 构造 WorkflowEval context。

按门禁策略返回 :ok 或结构化 failures。

计算 workflow 指标。

Types

failure()

@type failure() :: %{metric: atom(), expected: term(), actual: term()}

metrics()

@type metrics() :: map()

source()

@type source() :: map()

Functions

from_ledger(run, node_runs, events, opts \\ [])

@spec from_ledger(term(), [term()], [term()], keyword()) :: map()

直接从 run / node_runs / events 构造 WorkflowEval context。

from_status(snapshot, opts \\ [])

@spec from_status(
  source(),
  keyword()
) :: map()

CMDCOrchestrator.status/2 快照或离线 fixture 构造 WorkflowEval context。

gate(source, policy)

@spec gate(source(), map() | keyword()) :: :ok | {:error, [failure()]}

按门禁策略返回 :ok 或结构化 failures。

metrics(source)

@spec metrics(source()) :: metrics()

计算 workflow 指标。