feat: add executor tracing, auto-register primitives, and Default impls

- Add info!-level tracing to workflow executor: logs each execution
  round, each step run (with type and name), step completion, and
  workflow completion
- WorkflowHost.start() now auto-registers all built-in primitive step
  types so users don't need to register them manually
- Add #[derive(Default)] to all primitive steps and PollEndpointConfig
- Add tracing-subscriber to wfe crate for the pizza example
- Pizza example now shows full step-by-step execution logs
This commit is contained in:
2026-03-25 20:32:47 +00:00
parent 6d57f8ef22
commit 88fc6bf7ad
13 changed files with 70 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ use crate::models::ExecutionResult;
use crate::traits::step::{StepBody, StepExecutionContext};
/// A decision step that returns an outcome value for routing.
#[derive(Default)]
pub struct DecideStep {
pub expression_value: serde_json::Value,
}

View File

@@ -4,6 +4,7 @@ use crate::models::ExecutionResult;
use crate::traits::step::{StepBody, StepExecutionContext};
/// A no-op marker step indicating the end of a workflow branch.
#[derive(Default)]
pub struct EndStep;
#[async_trait]

View File

@@ -5,6 +5,7 @@ use crate::models::ExecutionResult;
use crate::traits::step::{StepBody, StepExecutionContext};
/// A conditional step that branches execution based on a boolean condition.
#[derive(Default)]
pub struct IfStep {
pub condition: bool,
}

View File

@@ -6,6 +6,7 @@ use crate::traits::step::{StepBody, StepExecutionContext};
/// A step that polls an external HTTP endpoint until a condition is met.
/// The actual HTTP polling is handled by the executor, not this step.
#[derive(Default)]
pub struct PollEndpointStep {
pub config: PollEndpointConfig,
}

View File

@@ -8,6 +8,7 @@ use crate::traits::step::{StepBody, StepExecutionContext};
/// A step that repeatedly schedules child execution at an interval
/// until a stop condition is met.
#[derive(Default)]
pub struct RecurStep {
pub interval: Duration,
pub stop_condition: bool,

View File

@@ -7,6 +7,7 @@ use crate::models::ExecutionResult;
use crate::traits::step::{StepBody, StepExecutionContext};
/// A step that schedules child execution after a delay.
#[derive(Default)]
pub struct ScheduleStep {
pub interval: Duration,
}

View File

@@ -6,6 +6,7 @@ use crate::traits::step::{StepBody, StepExecutionContext};
/// A container step that executes its children sequentially.
/// Completes when all children have finished.
#[derive(Default)]
pub struct SequenceStep;
#[async_trait]

View File

@@ -5,6 +5,7 @@ use crate::models::ExecutionResult;
use crate::traits::step::{StepBody, StepExecutionContext};
/// A looping step that repeats its children while a condition is true.
#[derive(Default)]
pub struct WhileStep {
pub condition: bool,
}