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. GET /health
is an unauthenticated liveness probe, for an orchestrator that has no
credential to present.
Mount the router produced by WorkflowRunRouterBuilder::build.
§Deploying
This crate — not klieo-server — is the deployable run-service surface:
klieo-server is a publish = false reference demo, not meant to serve
real traffic. For container/orchestration topology (Docker Compose,
Helm, Terraform) fronting a service built on this router, use the
klieo-compliance repo’s deploy/ tree as the reference: swap its
compliance-server container image for a binary that mounts
WorkflowRunRouterBuilder::build’s router; the surrounding topology
(reverse proxy, secrets) carries over. klieo is pre-production —
deploy/ does not itself prescribe autoscaling or canary rollout; add
those only if your deployment needs them.
Structs§
- RunRecord
View - 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.
- Sweep
Summary - 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).
- Workflow
RunRouter Builder - Builds the run-service router (
POST /runs,GET /runs/{id}).
Enums§
- Claim
Outcome - Outcome of a CAS idempotency claim.
- Error
Code - Stable error codes returned in the JSON body of every non-2xx response.
- RunStatus
- Lifecycle status of a submitted run.
- Store
Error - Failure modes of the run store.
- Sweep
Error - 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. - Workflow
ApiError - Every failure the run-service surfaces to a client.
- Workflow
RunBuilder Error - Why
WorkflowRunRouterBuilder::buildcould 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 /runsbody 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 — seeWORKFLOW_READ_ALL_SCOPE. - WORKFLOW_
RUN_ SCOPE - Scope required to submit a run (
POST /runs).
Functions§
- sweep_
orphaned_ runs - Reclaim every orphaned (
RunningorPending) run, chain-first. Isolates per-orphan failures; only an inability to enumerate the store returnsErr. Call once at startup, before serving traffic.