ReactiveDag.Verdict (reactive_dag v0.16.0)

Copy Markdown View Source

The generic READ layer over the coordination-tuple spine — a cell's live verdict and its failing-sample, rolled up from the tuple status histogram. This is the engine piece a host used to hand-write (the portal's ModelEval.Verdict); it's domain-neutral, so it lives here and the host keeps only its own addressing sugar (for_guarantee, for_control, typed detail joins) on top.

A verdict is:

%{status: :green | :findings | :pending | :unknown,
  failing: non_neg_integer(), pending: non_neg_integer(), sample: [key]}

computed from the cell's status_histogram + a failing-key sample, both over the shared ReactiveDag.Tuple spine (so it honors the configured tuple_table and the :key_scope selector — a host scopes to an app/tenant with the same selector shapes the tuple reads accept).

Summary

Functions

The live verdict for cell_id. Options

Roll a MAP of per-cell verdicts into a single status (e.g. a control over its guarantees): findings if any has findings, else pending if any pending, else green if any is green, else unknown. The dual of for_cell at the group level.

Roll a %{status => count} histogram + a failing sample into a verdict — the status decision, exposed so a host can roll up counts it gathered another way.

Types

verdict()

@type verdict() :: %{
  status: :green | :findings | :pending | :unknown,
  failing: non_neg_integer(),
  pending: non_neg_integer(),
  sample: [String.t()]
}

Functions

for_cell(cell_id, opts \\ [])

@spec for_cell(
  String.t(),
  keyword()
) :: verdict()

The live verdict for cell_id. Options:

  • :key_scope — a ReactiveDag.Tuple.key_scope/0 narrowing to a subset of the cell's keys (e.g. one app/tenant); nil = the whole cell.
  • :sample_limit — cap on the failing-key sample (default 5).

total == 0:unknown (nothing evaluated — distinct from green). Any failing → :findings; else any pending/stale → :pending; else :green.

roll_group(verdicts)

@spec roll_group([verdict()]) :: :green | :findings | :pending | :unknown

Roll a MAP of per-cell verdicts into a single status (e.g. a control over its guarantees): findings if any has findings, else pending if any pending, else green if any is green, else unknown. The dual of for_cell at the group level.

rollup(counts, sample)

@spec rollup(%{required(String.t()) => non_neg_integer()}, [String.t()]) :: verdict()

Roll a %{status => count} histogram + a failing sample into a verdict — the status decision, exposed so a host can roll up counts it gathered another way.