operations tier

operations-workflow

Workflow and state machines for Rust applications

Workflow and state machines for Rust applications

Tieroperations
Roleunclassified (baselined)
Pathcrates/operations/workflow
Edition2021
Targetsoperations_workflow, pg_transition
Public items116 across 1 module
Tests46

What it is for

Workflow and state machine library crates for Rust applications.

Provides state machines, approval workflows, and process automation.

Capabilities

Action

Workflow and state machine library crates for Rust applications.

Item
pub struct Action
Action :: fn new(name : impl Into <String>) -> Self
Action :: fn with_param(mut self, key : impl Into <String>, value : serde_json::Value) -> Self

Approval

Workflow and state machine library crates for Rust applications.

Item
pub struct Approval

ApprovalDecision

Workflow and state machine library crates for Rust applications.

Item
pub enum ApprovalDecision

ApprovalRequest

Workflow and state machine library crates for Rust applications.

Item
pub struct ApprovalRequest
ApprovalRequest :: fn new(workflow_instance_id : Uuid, transition_name : impl Into <String>, created_by : Uuid,) -> Self
ApprovalRequest :: fn with_approvers(mut self, approvers : Vec <Uuid>) -> Self
ApprovalRequest :: fn with_min_approvals(mut self, min : usize) -> Self
ApprovalRequest :: fn with_expiration(mut self, expires_at : DateTime <Utc>) -> Self
ApprovalRequest :: fn approve(& mut self, approver : Uuid, comment : Option <String>) -> Result <()>
ApprovalRequest :: fn reject(& mut self, rejector : Uuid, comment : Option <String>) -> Result <()>
ApprovalRequest :: fn cancel(& mut self) -> Result <()>
ApprovalRequest :: fn is_expired(& self) -> bool
ApprovalRequest :: fn is_approved(& self) -> bool

ApprovalStatus

Workflow and state machine library crates for Rust applications.

Item
pub enum ApprovalStatus
ApprovalStatus :: fn is_terminal(& self) -> bool

EntityRef

Workflow and state machine library crates for Rust applications.

Item
pub struct EntityRef
EntityRef :: fn new(entity_type : impl Into <String>, entity_id : Uuid) -> Self

Guard

Workflow and state machine library crates for Rust applications.

Item
pub struct Guard
Guard :: fn expression(expr : impl Into <String>) -> Self
Guard :: fn service_call(service : impl Into <String>) -> Self

GuardType

Workflow and state machine library crates for Rust applications.

Item
pub enum GuardType

Result

Workflow and state machine library crates for Rust applications.

Item
pub type Result<T>: std::result::Result <T, WorkflowError>

State

Workflow and state machine library crates for Rust applications.

Item
pub struct State
State :: fn new(name : impl Into <String>) -> Self
State :: fn initial(mut self) -> Self
State :: fn final_state(mut self) -> Self
State :: fn blocking(mut self) -> Self
State :: fn waiting(mut self) -> Self
State :: fn with_label(mut self, label : impl Into <String>) -> Self
State :: fn with_description(mut self, description : impl Into <String>) -> Self
State :: fn with_kanban_column(mut self, column : i32) -> Self
State :: fn with_color(mut self, color : impl Into <String>) -> Self
State :: fn with_metadata(mut self, key : impl Into <String>, value : serde_json::Value) -> Self
State :: fn display_name(& self) -> & str

StateMachineDefinition:StateMachineDefinition

Workflow and state machine library crates for Rust applications.

Item
pub struct StateMachineDefinition

StateMachineDefinition:available

Workflow and state machine library crates for Rust applications.

Item
StateMachineDefinition :: fn available_transitions(& self, from_state : & str) -> Vec <& Transition>
StateMachineDefinition :: fn available_transitions_for_role(& self, from_state : & str, role : & str) -> Vec <& Transition>

StateMachineDefinition:find

Workflow and state machine library crates for Rust applications.

Item
StateMachineDefinition :: fn find_transition(& self, from_state : & str, transition_name : & str) -> Option <& Transition>

StateMachineDefinition:get

Workflow and state machine library crates for Rust applications.

Item
StateMachineDefinition :: fn get_initial_state(& self) -> Option <& State>

StateMachineDefinition:is

Workflow and state machine library crates for Rust applications.

Item
StateMachineDefinition :: fn is_valid_transition(& self, from : & str, to : & str) -> bool
StateMachineDefinition :: fn is_final_state(& self, state : & str) -> bool
StateMachineDefinition :: fn is_blocking_state(& self, state : & str) -> bool

StateMachineDefinition:new

Workflow and state machine library crates for Rust applications.

Item
StateMachineDefinition :: fn new(name : impl Into <String>) -> Self

StateMachineDefinition:states

Workflow and state machine library crates for Rust applications.

Item
StateMachineDefinition :: fn states_by_kanban_order(& self) -> Vec <& State>

StateMachineDefinition:with

Workflow and state machine library crates for Rust applications.

Item
StateMachineDefinition :: fn with_description(mut self, description : impl Into <String>) -> Self
StateMachineDefinition :: fn with_version(mut self, version : u32) -> Self
StateMachineDefinition :: fn with_context_schema(mut self, schema : serde_json::Value) -> Self
StateMachineDefinition :: fn with_state(mut self, state : State) -> Result <Self>
StateMachineDefinition :: fn with_transition(mut self, transition : Transition) -> Result <Self>

StateMachineInstance:StateMachineInstance

Workflow and state machine library crates for Rust applications.

Item
pub struct StateMachineInstance

StateMachineInstance:cancel

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn cancel(& mut self, reason : Option <String>)

StateMachineInstance:fail

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn fail(& mut self, error : String)

StateMachineInstance:for

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn for_entity(mut self, entity_type : impl Into <String>, entity_id : Uuid) -> Self

StateMachineInstance:force

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn force_state(& mut self, state : impl Into <String>, actor : Uuid, reason : String)

StateMachineInstance:get

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn get_context(& self, key : & str) -> Option <& serde_json::Value>

StateMachineInstance:initiated

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn initiated_by(mut self, actor : Uuid) -> Self

StateMachineInstance:is

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn is_complete(& self) -> bool
StateMachineInstance :: fn is_active(& self) -> bool

StateMachineInstance:new

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn new(definition : & StateMachineDefinition) -> Self

StateMachineInstance:resume

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn resume(& mut self) -> Result <()>

StateMachineInstance:set

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn set_context(& mut self, key : impl Into <String>, value : serde_json::Value)

StateMachineInstance:state

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn state(& self) -> & str

StateMachineInstance:suspend

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn suspend(& mut self, reason : Option <String>)

StateMachineInstance:transition

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn transition(& mut self, definition : & StateMachineDefinition, transition_name : & str, actor : Option <Uuid>, comment : Option <String>,) -> Result <()>
StateMachineInstance :: fn transition_with_role(& mut self, definition : & StateMachineDefinition, transition_name : & str, actor : Uuid, role : & str, comment : Option <String>,) -> Result <()>

StateMachineInstance:wait

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn wait(& mut self)

StateMachineInstance:with

Workflow and state machine library crates for Rust applications.

Item
StateMachineInstance :: fn with_context(mut self, key : impl Into <String>, value : serde_json::Value) -> Self
StateMachineInstance :: fn with_context_data(mut self, data : HashMap <String, serde_json::Value>) -> Self

StateTransitionRecord

Workflow and state machine library crates for Rust applications.

Item
pub struct StateTransitionRecord

StateType

Workflow and state machine library crates for Rust applications.

Item
pub enum StateType

Transition:Transition

Workflow and state machine library crates for Rust applications.

Item
pub struct Transition

Transition:can

Workflow and state machine library crates for Rust applications.

Item
Transition :: fn can_trigger_from(& self, state : & str) -> bool

Transition:from

Workflow and state machine library crates for Rust applications.

Item
Transition :: fn from_many(name : impl Into <String>, from_states : Vec <String>, to : impl Into <String>,) -> Self
Transition :: fn from(& self) -> & str

Transition:is

Workflow and state machine library crates for Rust applications.

Item
Transition :: fn is_role_allowed(& self, role : & str) -> bool

Transition:new

Workflow and state machine library crates for Rust applications.

Item
Transition :: fn new(name : impl Into <String>, from : impl Into <String>, to : impl Into <String>) -> Self

Transition:requires

Workflow and state machine library crates for Rust applications.

Item
Transition :: fn requires_approval(mut self) -> Self

Transition:with

Workflow and state machine library crates for Rust applications.

Item
Transition :: fn with_label(mut self, label : impl Into <String>) -> Self
Transition :: fn with_description(mut self, description : impl Into <String>) -> Self
Transition :: fn with_guard(mut self, guard : Guard) -> Self
Transition :: fn with_expression_guard(mut self, expr : impl Into <String>) -> Self
Transition :: fn with_service_guard(mut self, service : impl Into <String>) -> Self
Transition :: fn with_action(mut self, action : Action) -> Self
Transition :: fn with_action_name(mut self, name : impl Into <String>) -> Self
Transition :: fn with_roles(mut self, roles : Vec <String>) -> Self
Transition :: fn with_role(mut self, role : impl Into <String>) -> Self
Transition :: fn with_metadata(mut self, key : impl Into <String>, value : serde_json::Value) -> Self

WorkflowBuilder

Workflow and state machine library crates for Rust applications.

Item
pub struct WorkflowBuilder
WorkflowBuilder :: fn new(name : impl Into <String>) -> Self
WorkflowBuilder :: fn approval_workflow() -> Result <StateMachineDefinition>
WorkflowBuilder :: fn multi_stage_approval(stages : & & str) -> Result <StateMachineDefinition>
WorkflowBuilder :: fn linear_workflow(states : & & str) -> Result <StateMachineDefinition>

WorkflowError

Workflow and state machine library crates for Rust applications.

Item
pub enum WorkflowError

WorkflowInstanceStatus

Workflow and state machine library crates for Rust applications.

Item
pub enum WorkflowInstanceStatus
WorkflowInstanceStatus :: fn is_terminal(& self) -> bool
WorkflowInstanceStatus :: fn can_transition(& self) -> bool
WorkflowInstanceStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

WorkflowTemplate

Workflow and state machine library crates for Rust applications.

Item
pub struct WorkflowTemplate
WorkflowTemplate :: fn new(name : impl Into <String>, definition : StateMachineDefinition) -> Self
WorkflowTemplate :: fn with_description(mut self, description : impl Into <String>) -> Self
WorkflowTemplate :: fn create_instance(& self) -> StateMachineInstance
WorkflowTemplate :: fn increment_version(& mut self)

SqlIdent

Postgres-backed atomic guarded state transition (compare-and-swap).

Item
pub struct SqlIdent
SqlIdent :: const fn new(value : & 'static str) -> Self
SqlIdent :: const fn as_str(& self) -> & 'static str

StatefulEntity

Postgres-backed atomic guarded state transition (compare-and-swap).

Item
pub trait StatefulEntity
fn generate_transition_trigger_ddl <E : StatefulEntity>(allowed : & (& str, & str)) -> String

TransitionOutcome

Postgres-backed atomic guarded state transition (compare-and-swap).

Item
pub enum TransitionOutcome

TransitionRecord

Postgres-backed atomic guarded state transition (compare-and-swap).

Item
pub struct TransitionRecord

WorkflowStore

Postgres-backed atomic guarded state transition (compare-and-swap).

Item
pub struct WorkflowStore
WorkflowStore :: fn new(pool : PgPool) -> Self
WorkflowStore :: async fn transition_if <E : StatefulEntity>(& self, id : Uuid, expected : & str, next : & str, actor : Option <Uuid>,) -> Result <TransitionOutcome, WorkflowStoreError>
WorkflowStore :: async fn transition_if_on <E : StatefulEntity>(tx : & mut sqlx::Transaction <'_, sqlx::Postgres>, id : Uuid, expected : & str, next : & str, actor : Option <Uuid>,) -> Result <(TransitionOutcome, Option <i64>), WorkflowStoreError>

WorkflowStoreError

Postgres-backed atomic guarded state transition (compare-and-swap).

Item
pub enum WorkflowStoreError

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

operations_workflow

Public surface

`crate root`

ItemWhat it is
pub enum WorkflowErrorWorkflow errors.
pub enum WorkflowInstanceStatusStatus of a workflow instance.
WorkflowInstanceStatus :: fn is_terminal(& self) -> boolCheck if the workflow is in a terminal state.
WorkflowInstanceStatus :: fn can_transition(& self) -> boolCheck if the workflow can accept transitions.
WorkflowInstanceStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub enum GuardTypeType of guard for conditional transitions.
pub struct GuardA guard condition for a transition.
Guard :: fn expression(expr : impl Into <String>) -> SelfCreate a new expression guard.
Guard :: fn service_call(service : impl Into <String>) -> SelfCreate a new service call guard.
pub struct ActionAn action to execute on transition.
Action :: fn new(name : impl Into <String>) -> SelfCreate a new action.
Action :: fn with_param(mut self, key : impl Into <String>, value : serde_json::Value) -> SelfAdd a parameter to the action.
pub type Result<T>: std::result::Result <T, WorkflowError>Result type for workflow operations.
pub enum StateTypeType of state for categorization.
pub struct StateA state in a state machine.
State :: fn new(name : impl Into <String>) -> SelfCreate a new state.
State :: fn initial(mut self) -> SelfSet as initial state.
State :: fn final_state(mut self) -> SelfSet as final state.
State :: fn blocking(mut self) -> SelfSet as blocking state (requires resolution before continuing).
State :: fn waiting(mut self) -> SelfSet as waiting state (awaiting external input).
State :: fn with_label(mut self, label : impl Into <String>) -> SelfSet display label.
State :: fn with_description(mut self, description : impl Into <String>) -> SelfSet description.
State :: fn with_kanban_column(mut self, column : i32) -> SelfSet kanban column position.
State :: fn with_color(mut self, color : impl Into <String>) -> SelfSet display color.
State :: fn with_metadata(mut self, key : impl Into <String>, value : serde_json::Value) -> SelfAdd metadata (accepts any JSON value).
State :: fn display_name(& self) -> & strGet the display name (label or name).
pub struct TransitionA transition between states.
Transition :: fn new(name : impl Into <String>, from : impl Into <String>, to : impl Into <String>) -> SelfCreate a new transition from a single state.
Transition :: fn from_many(name : impl Into <String>, from_states : Vec <String>, to : impl Into <String>,) -> SelfCreate a new transition from multiple states.
Transition :: fn with_label(mut self, label : impl Into <String>) -> SelfSet display label.
Transition :: fn with_description(mut self, description : impl Into <String>) -> SelfSet description.
Transition :: fn with_guard(mut self, guard : Guard) -> SelfAdd a guard condition.
Transition :: fn with_expression_guard(mut self, expr : impl Into <String>) -> SelfAdd an expression guard.
Transition :: fn with_service_guard(mut self, service : impl Into <String>) -> SelfAdd a service call guard.
Transition :: fn with_action(mut self, action : Action) -> SelfAdd an action.
Transition :: fn with_action_name(mut self, name : impl Into <String>) -> SelfAdd a simple named action.
Transition :: fn with_roles(mut self, roles : Vec <String>) -> SelfSet allowed roles for this transition.
Transition :: fn with_role(mut self, role : impl Into <String>) -> SelfAdd an allowed role.
Transition :: fn requires_approval(mut self) -> SelfRequire approval for this transition.
Transition :: fn with_metadata(mut self, key : impl Into <String>, value : serde_json::Value) -> SelfAdd metadata.
Transition :: fn can_trigger_from(& self, state : & str) -> boolCheck if this transition can be triggered from a given state.
Transition :: fn is_role_allowed(& self, role : & str) -> boolCheck if a role is allowed.
Transition :: fn from(& self) -> & strGet the first "from" state (for backwards compatibility).
pub struct StateMachineDefinitionDefinition of a state machine.
StateMachineDefinition :: fn new(name : impl Into <String>) -> SelfCreate a new state machine definition.
StateMachineDefinition :: fn with_description(mut self, description : impl Into <String>) -> SelfSet description.
StateMachineDefinition :: fn with_version(mut self, version : u32) -> SelfSet version.
StateMachineDefinition :: fn with_context_schema(mut self, schema : serde_json::Value) -> SelfSet context schema for validation.
StateMachineDefinition :: fn with_state(mut self, state : State) -> Result <Self>Add a state.
StateMachineDefinition :: fn with_transition(mut self, transition : Transition) -> Result <Self>Add a transition.
StateMachineDefinition :: fn available_transitions(& self, from_state : & str) -> Vec <& Transition>Get available transitions from a state.
StateMachineDefinition :: fn available_transitions_for_role(& self, from_state : & str, role : & str) -> Vec <& Transition>Get available transitions from a state for a specific role.
StateMachineDefinition :: fn is_valid_transition(& self, from : & str, to : & str) -> boolCheck if a transition is valid.
StateMachineDefinition :: fn find_transition(& self, from_state : & str, transition_name : & str) -> Option <& Transition>Find a transition by name from a given state.
StateMachineDefinition :: fn get_initial_state(& self) -> Option <& State>Get the initial state.
StateMachineDefinition :: fn is_final_state(& self, state : & str) -> boolCheck if a state is final.
StateMachineDefinition :: fn is_blocking_state(& self, state : & str) -> boolCheck if a state is blocking.
StateMachineDefinition :: fn states_by_kanban_order(& self) -> Vec <& State>Get states ordered by kanban column.
pub struct EntityRefEntity reference for workflow binding.
EntityRef :: fn new(entity_type : impl Into <String>, entity_id : Uuid) -> SelfCreate a new entity reference.
pub struct StateMachineInstanceInstance of a state machine.
StateMachineInstance :: fn new(definition : & StateMachineDefinition) -> SelfCreate a new instance.
StateMachineInstance :: fn for_entity(mut self, entity_type : impl Into <String>, entity_id : Uuid) -> SelfBind to an entity.
StateMachineInstance :: fn initiated_by(mut self, actor : Uuid) -> SelfSet who initiated the workflow.
StateMachineInstance :: fn with_context(mut self, key : impl Into <String>, value : serde_json::Value) -> SelfSet context data.
StateMachineInstance :: fn with_context_data(mut self, data : HashMap <String, serde_json::Value>) -> SelfSet multiple context values.
StateMachineInstance :: fn transition(& mut self, definition : & StateMachineDefinition, transition_name : & str, actor : Option <Uuid>, comment : Option <String>,) -> Result <()>Transition to a new state.
StateMachineInstance :: fn transition_with_role(& mut self, definition : & StateMachineDefinition, transition_name : & str, actor : Uuid, role : & str, comment : Option <String>,) -> Result <()>Transition with role check.
StateMachineInstance :: fn force_state(& mut self, state : impl Into <String>, actor : Uuid, reason : String)Force transition to a state (bypassing normal flow).
StateMachineInstance :: fn suspend(& mut self, reason : Option <String>)Suspend the workflow.
StateMachineInstance :: fn resume(& mut self) -> Result <()>Resume a suspended workflow.
StateMachineInstance :: fn wait(& mut self)Mark as waiting for external input.
StateMachineInstance :: fn cancel(& mut self, reason : Option <String>)Cancel the workflow.
StateMachineInstance :: fn fail(& mut self, error : String)Fail the workflow.
StateMachineInstance :: fn state(& self) -> & strGet the current state name.
StateMachineInstance :: fn is_complete(& self) -> boolCheck if the workflow is complete (terminal state).
StateMachineInstance :: fn is_active(& self) -> boolCheck if the workflow is active.
StateMachineInstance :: fn get_context(& self, key : & str) -> Option <& serde_json::Value>Get context value.
StateMachineInstance :: fn set_context(& mut self, key : impl Into <String>, value : serde_json::Value)Update context value.
pub struct StateTransitionRecordRecord of a state transition.
pub enum ApprovalStatusApproval status.
ApprovalStatus :: fn is_terminal(& self) -> boolCheck if this is a terminal status.
pub struct ApprovalRequestAn approval request in a workflow.
ApprovalRequest :: fn new(workflow_instance_id : Uuid, transition_name : impl Into <String>, created_by : Uuid,) -> SelfCreate a new approval request.
ApprovalRequest :: fn with_approvers(mut self, approvers : Vec <Uuid>) -> SelfSet required approvers.
ApprovalRequest :: fn with_min_approvals(mut self, min : usize) -> SelfSet minimum approvals needed.
ApprovalRequest :: fn with_expiration(mut self, expires_at : DateTime <Utc>) -> SelfSet expiration.
ApprovalRequest :: fn approve(& mut self, approver : Uuid, comment : Option <String>) -> Result <()>Add an approval.
ApprovalRequest :: fn reject(& mut self, rejector : Uuid, comment : Option <String>) -> Result <()>Reject the request.
ApprovalRequest :: fn cancel(& mut self) -> Result <()>Cancel the request.
ApprovalRequest :: fn is_expired(& self) -> boolCheck if the request has expired.
ApprovalRequest :: fn is_approved(& self) -> boolCheck if the request is approved.
pub struct ApprovalA single approval decision.
pub enum ApprovalDecisionApproval decision.
pub struct WorkflowTemplateWorkflow template for reusable workflow definitions.
WorkflowTemplate :: fn new(name : impl Into <String>, definition : StateMachineDefinition) -> SelfCreate a new workflow template.
WorkflowTemplate :: fn with_description(mut self, description : impl Into <String>) -> SelfSet description.
WorkflowTemplate :: fn create_instance(& self) -> StateMachineInstanceCreate an instance from this template.
WorkflowTemplate :: fn increment_version(& mut self)Increment version.
pub struct WorkflowBuilderBuilder for common workflow patterns.
WorkflowBuilder :: fn new(name : impl Into <String>) -> SelfCreate a new workflow builder.
WorkflowBuilder :: fn approval_workflow() -> Result <StateMachineDefinition>Build a simple approval workflow.
WorkflowBuilder :: fn multi_stage_approval(stages : & & str) -> Result <StateMachineDefinition>Build a multi-stage approval workflow.
WorkflowBuilder :: fn linear_workflow(states : & & str) -> Result <StateMachineDefinition>Build a simple linear workflow.

`store`

ItemWhat it is
pub struct SqlIdentA table or column identifier, validated to a safe character set at construction
SqlIdent :: const fn new(value : & 'static str) -> SelfConstruct a validated identifier
SqlIdent :: const fn as_str(& self) -> & 'static strThe validated identifier string.
pub trait StatefulEntityA domain entity whose status lives on its own table, transitioned via CAS
pub struct TransitionRecordOne committed transition, recorded in workflow_transition_history.
pub enum TransitionOutcomeThe result of WorkflowStore::transition_if.
pub enum WorkflowStoreErrorErrors from the transition store.
pub struct WorkflowStoreA Postgres-backed atomic guarded transition store.
WorkflowStore :: fn new(pool : PgPool) -> SelfWrap a connection pool.
WorkflowStore :: async fn transition_if <E : StatefulEntity>(& self, id : Uuid, expected : & str, next : & str, actor : Option <Uuid>,) -> Result <TransitionOutcome, WorkflowStoreError>Atomically transition id from expected to next, recording history in the SAME transaction
WorkflowStore :: async fn transition_if_on <E : StatefulEntity>(tx : & mut sqlx::Transaction <'_, sqlx::Postgres>, id : Uuid, expected : & str, next : & str, actor : Option <Uuid>,) -> Result <(TransitionOutcome, Option <i64>), WorkflowStoreError>The CAS + history insert on a CALLER-OWNED transaction, so a consumer can ride its own same-transaction effects (an extension-fact row, a dependent update) on the committed transition
fn generate_transition_trigger_ddl <E : StatefulEntity>(allowed : & (& str, & str)) -> StringGenerate the DB-enforcement trigger DDL for an entity FROM its allowed transitions (the app's one FSM graph) — the drift-proof defense-in-depth layer (Gate-1.5 consensus 2026-07-23, option d)

No pub use re-exports: every item above is declared in this crate.

Boundary

Depends on no other workspace tier.

Shares tier operations with 40 other crates: operations-approval-workflow, operations-assessments, operations-block-imaging, operations-boot-media, operations-browser-agent-worker, operations-camera-discovery, operations-camera-liveview, operations-camera-registry, … (40 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)operations
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/operations/workflow
Vocabulary in force (lexicon)current

Dependencies

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
chrono^0.4serdenoalways
serde^1derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonyesalways
thiserror^2noalways
uuid^1v4, v7, serde, jsnoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
tokio^1full, macros, rt-multi-threadnoalways
uuid^1v4, v7, serde, js, v4noalways

Build. None.

Depended on by. 4 workspace crates.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_workflow["application-workflow"] -->|uses| SELF
  n_domain_legal_matter["domain-legal-matter"] -->|uses| SELF
  n_domain_legal_procedure["domain-legal-procedure"] -->|uses| SELF
  n_operations_control_plane["operations-control-plane"] -->|uses| SELF
  SELF["operations-workflow"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

FeatureEnablesOn by default
postgresdep:sqlxno
flowchart LR
  n_postgres["postgres"] --> n_dep_sqlx["dep:sqlx"]

Targets

KindNameSource
liboperations_workflow`src/lib.rs`
testpg_transition`tests/pg_transition.rs`

Error model

Error typeNamed by
WorkflowErrorResult
WorkflowStoreErrordeclared, no public signature returns it

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimenone detected
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

4 workspace crates depend on this one: application-workflow, domain-legal-matter, domain-legal-procedure, operations-control-plane.

Verification

KindCount
Unit tests43
Integration tests3
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root1909
store706

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc115116
Public modules with a //! block11
pie showData
    title Public items with rustdoc
    "Documented" : 115
    "No rustdoc detected" : 1

Metrics

MetricValue
Rust source files2
Source lines2132
Code lines1595
Public API items116
Public modules1
Tests46
Examples0
Cargo features1
Direct runtime dependencies6
Workspace reverse dependencies4
pie showData
    title Public API by kind
    "enum" : 8
    "function" : 1
    "method" : 90
    "struct" : 15
    "trait" : 1
    "type alias" : 1
pie showData
    title Rust source composition
    "Code" : 1595
    "Blank or comment" : 537

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All operations · Manual