ReqManagedAgents.OutcomeResult (ReqManagedAgents v0.16.0)

Copy Markdown View Source

What a session's accepted events show for one outcome.

evaluations holds only completed OutcomeEvaluation values for this outcome. new/1 is the only place that derives status and the order of evaluations, and it recomputes both for an existing struct, so neither is accepted as input. Evaluations are ordered by iteration (nil iterations last, input order for ties). status is :unknown when an iteration is nil or shared or issues holds a poisoning issue (see poisoning_issues/0); otherwise :pending with no evaluations; otherwise the verdict at the greatest iteration. :pending is not an active-evaluation state.

Summary

Types

The provider's first definition echo, verbatim; its keys and values are not interpreted here.

t()

Functions

The closed set of diagnostic atoms an outcome may carry.

Validates a closed atom-keyed attribute map or an existing struct, then derives status and the order of evaluations.

The issues that make status :unknown whatever the evaluations say.

Types

definition()

@type definition() :: map()

The provider's first definition echo, verbatim; its keys and values are not interpreted here.

issue()

@type issue() ::
  :unknown_result
  | :missing_event_id
  | :invalid_iteration
  | :invalid_description
  | :invalid_explanation
  | :invalid_processed_at
  | :invalid_start_event_id
  | :invalid_evaluation
  | :invalid_outcome
  | :conflicting_event_id
  | :conflicting_evaluation
  | :conflicting_definition

status()

@type status() :: :pending | ReqManagedAgents.OutcomeEvaluation.result()

t()

@type t() :: %ReqManagedAgents.OutcomeResult{
  definition: definition() | nil,
  description: String.t() | nil,
  evaluations: [ReqManagedAgents.OutcomeEvaluation.t()],
  issues: [issue()],
  outcome_id: String.t(),
  status: status()
}

Functions

issues()

@spec issues() :: [issue()]

The closed set of diagnostic atoms an outcome may carry.

new(outcome)

@spec new(map() | t()) :: {:ok, t()} | {:error, {:invalid_outcome_result, atom()}}

Validates a closed atom-keyed attribute map or an existing struct, then derives status and the order of evaluations.

Nested evaluations must be OutcomeEvaluation structs for this outcome; each is re-validated.

poisoning_issues()

@spec poisoning_issues() :: [issue()]

The issues that make status :unknown whatever the evaluations say.