aion/workflow/entrypoint
workflow.entrypoint: the engine-facing run adapter, assembled from a
WorkflowDefinition’s codecs and typed entry function.
The engine spawns entry_module:entry_function/1 with one argument: a
BEAM binary holding the start input’s JSON text. Every workflow used to
hand-write the same adapter — decode the binary to a string, decode the
string with the input codec, call the typed entry function, encode the
output or error back to JSON text. entrypoint is that adapter, built
purely from the definition’s own accessors, so a workflow module’s engine
entry collapses to one line:
pub fn run(raw_input: Dynamic) -> Result(String, String) {
workflow.entrypoint(definition(), raw_input)
}
Success and typed failure are byte-identical to the hand-written adapter:
Ok encodes with the definition’s output codec, Error with its error
codec, so an awaiting parent decodes both with the same codecs it already
holds. Only the garbage-input edge has a fixed shape: when the raw payload
is not a string or the input codec rejects it, the failure payload is the
documented JSON envelope
{"aion_error":"input_decode","reason":...,"path":[...]} — the engine
records it as failure details, and a parent awaiting the child surfaces it
as typed error-decode data, never a crash.
Values
pub fn entrypoint(
definition: define.WorkflowDefinition(
input,
output,
workflow_error,
),
raw_input: dynamic.Dynamic,
) -> Result(String, String)
Drive a workflow’s typed entry from the engine’s raw spawn argument.
Decodes raw_input (a BEAM binary of JSON text) with the definition’s
input codec, invokes the typed entry function, and encodes the outcome
with the definition’s output or error codec. An undecodable input yields
Error of the documented aion_error: input_decode JSON envelope.