Appearance
ERD
This section documents the recommended persistence model for a durable orchestration platform and how it maps to workflow execution concerns.
Purpose
The ERD separates immutable workflow definition state from mutable run state, while preserving audit history for retries, approvals, and events.
Core entities
WORKFLOW_DEFINITION: stable workflow namespaceWORKFLOW_VERSION: immutable, published snapshot of the definitionSTEP_DEFINITION: step metadata per workflow versionWORKFLOW_RUN: one execution instance of a workflow versionSTEP_RUN: step materialization for a specific runTASK_EXECUTION: one concrete task attempt for a step runAPPROVAL_REQUEST: human/policy gate recordsARTIFACT: produced files, patches, logs, snapshotsEVENT_LOG: append-only run and step transitionsCOST_LEDGER_ENTRY: usage and cost records per task execution
ER diagram
mermaid
erDiagram
WORKFLOW_DEFINITION ||--o{ WORKFLOW_VERSION : has
WORKFLOW_VERSION ||--o{ STEP_DEFINITION : contains
WORKFLOW_VERSION ||--o{ WORKFLOW_RUN : launches
WORKFLOW_RUN ||--o{ STEP_RUN : executes
STEP_DEFINITION ||--o{ STEP_RUN : instantiates
STEP_RUN ||--o{ TASK_EXECUTION : delegates
STEP_RUN ||--o{ APPROVAL_REQUEST : requires
WORKFLOW_RUN ||--o{ EVENT_LOG : emits
TASK_EXECUTION ||--o{ ARTIFACT : produces
TASK_EXECUTION ||--o{ COST_LEDGER_ENTRY : incursDesign rules
- published workflow versions are immutable
- retries create a new
TASK_EXECUTIONattempt on the sameSTEP_RUN - event ordering is monotonic per run (
sequence_number) - large logs/artifacts can live in object storage, with relational metadata in DB
- approval history is explicit and queryable, not inferred from free-form comments
Mapping to current CLI
The current workflow-manager implementation is in-memory and does not persist these tables yet. It already models the same conceptual boundaries via WorkflowDefinition, StepRun, run statuses, and RunEvent, which keeps migration to durable persistence straightforward.