Skip to main content

Crate klieo_workflow_api

Crate klieo_workflow_api 

Source
Expand description

klieo-workflow-api — embeddable Axum run-service fronting klieo_workflow.

A caller submits a WorkflowDef to POST /runs; the service compiles it against a klieo_workflow::Registry allow-list, runs it asynchronously, and returns a run id to poll at GET /runs/{id}. Auth-gated, with a server-stamped author and a bounded, supervised executor.

Mount the router produced by WorkflowRunRouterBuilder::build.

Structs§

RunRecordView
The client-visible snapshot of a run returned by GET /runs/{id}.
RunStore
Volatile run-status cache keyed by run id, with CAS-based idempotency.
SweepSummary
Outcome of a startup sweep: how many orphans were reclaimed, and the run ids of any that could not be (already logged, left for the next sweep).
WorkflowRunRouterBuilder
Builds the run-service router (POST /runs, GET /runs/{id}).

Enums§

ClaimOutcome
Outcome of a CAS idempotency claim.
ErrorCode
Stable error codes returned in the JSON body of every non-2xx response.
RunStatus
Lifecycle status of a submitted run.
StoreError
Failure modes of the run store.
SweepError
Failure that aborts the sweep before it can process any orphan (e.g. the run store could not be enumerated). Per-orphan failures do NOT surface here — they are isolated into SweepSummary::failed.
WorkflowApiError
Every failure the run-service surfaces to a client.
WorkflowRunBuilderError
Why WorkflowRunRouterBuilder::build could not assemble a router.

Constants§

MAX_CONCURRENT_RUNS
Maximum number of runs executing at once; excess submits get 429.
MAX_DEF_BYTES
Maximum accepted POST /runs body size, bounding the definition + input.
MAX_RUN_DURATION
Wall-clock cap on a single run; exceeding it aborts the run.
RUNS_BUCKET
KV bucket holding both idempotency claims and run records.
WORKFLOW_READ_ALL_SCOPE
Scope required to read a run authored by a DIFFERENT caller (operator / cross-author read). Held alongside WORKFLOW_READ_SCOPE, not instead of it — the route-level middleware still requires the base read scope.
WORKFLOW_READ_SCOPE
Scope required to read run state (GET /runs/{id}). Alone, this grants read access only to runs the caller itself authored — see WORKFLOW_READ_ALL_SCOPE.
WORKFLOW_RUN_SCOPE
Scope required to submit a run (POST /runs).

Functions§

sweep_orphaned_runs
Reclaim every orphaned (Running or Pending) run, chain-first. Isolates per-orphan failures; only an inability to enumerate the store returns Err. Call once at startup, before serving traffic.