LemonCore. RunOutcome
(lemon_core v0.1.0)
View Source
Outcome labels for finalized runs.
Provides heuristics for inferring :success | :partial | :failure | :aborted | :unknown
from a run summary, plus support for explicit overrides.
Outcome semantics
| Outcome | Meaning |
|---|---|
:success | Run completed with ok: true and a non-empty answer. |
:partial | Run completed with ok: true but produced no substantive answer (e.g. tool-only run). |
:failure | Run completed with ok: false for a non-abort reason. |
:aborted | Run was cancelled by the user or watchdog. |
:unknown | Outcome cannot be determined from available data. |
Heuristics
infer/1 checks the summary in order:
- Explicit
:outcomefield on the summary (operator/explicit override). completed.okboolean with answer content →:successor:partial.completed.ok == falsewith error text →:abortedor:failure.- Top-level
:okfallback for summaries without a:completedsub-map. - Default:
:unknown.
Explicit overrides
The caller may embed an explicit :outcome field in the summary map to bypass
heuristics entirely. This is the primary escape hatch for engines or external
integrations that know the true outcome.
summary = %{..., outcome: :aborted}
RunOutcome.infer(summary) # => :aborted
Summary
Functions
Cast a raw value (atom or string) to an outcome atom.
Infer the run outcome from a finalized run summary map.
Returns true if outcome is a valid outcome atom.
Returns the list of valid outcome atoms.
Types
Functions
Cast a raw value (atom or string) to an outcome atom.
Returns {:ok, outcome} if valid, :error otherwise.
Infer the run outcome from a finalized run summary map.
Checks for an explicit :outcome override first, then applies heuristics
based on the completed.ok boolean and answer/error content.
Safe against malformed or partial summaries — always returns a valid outcome.
Returns true if outcome is a valid outcome atom.
@spec valid_outcomes() :: [t()]
Returns the list of valid outcome atoms.