Skip to content

Checkpointing Specification

Document ID: WF-007
Version: 1.0.0
Status: Draft
Owner: Workflow Engine Team
Last Updated: 2026-06-26


This document defines the checkpointing architecture used by the Wovyr Workflow Engine.

Checkpointing enables:

  • Durable workflow execution
  • Fast recovery after failures
  • Event replay optimization
  • Long-running workflows
  • Distributed execution
  • Workflow migration
  • Version-safe recovery

The checkpoint system is the foundation of fault tolerance within the workflow engine.


The checkpoint subsystem must provide:

  • Durable persistence
  • Fast recovery
  • Deterministic replay
  • Incremental snapshots
  • Storage abstraction
  • Compression support
  • Encryption support
  • Horizontal scalability

The checkpoint system follows these principles:

  1. Checkpoints are immutable.
  2. Every checkpoint is versioned.
  3. Checkpoints never replace event history.
  4. Events remain the source of truth.
  5. Recovery always starts from the latest valid checkpoint.
  6. Checkpoints are portable across workers.
  7. Storage implementation is pluggable.

Workflow Runtime
Checkpoint Manager
┌─────────────┼─────────────┐
▼ ▼ ▼
Snapshot Store Compression Encryption
Persistence Adapter
PostgreSQL / S3 / RocksDB / Object Storage

Workflow Running
Checkpoint Triggered
Collect Runtime State
Serialize Snapshot
Compress
Encrypt
Persist
Checkpoint Available

Checkpoints may be created:

  • After workflow creation
  • After every completed activity
  • Before waiting
  • Before compensation
  • After compensation
  • Before workflow completion
  • Periodically
  • Before worker migration
  • Before shutdown

Trigger policies are configurable.


Contains the complete workflow state.

Used for:

  • Initial snapshots
  • Periodic snapshots
  • Long-running workflows

Contains only changes since the previous checkpoint.

Benefits:

  • Smaller storage footprint
  • Faster persistence
  • Lower bandwidth usage

Created through API or CLI.

Useful for:

  • Maintenance
  • Migration
  • Debugging

Generated by runtime policies.

Default mode for production.


Every checkpoint stores:

checkpointId:
workflowId:
executionId:
workflowVersion:
checkpointVersion:
createdAt:
workerId:
stateVersion:
currentState:
activeNodes:
completedNodes:
variables:
activityResults:
pendingEvents:
leases:
metadata:

Checkpoint
├── Metadata
├── Workflow State
├── Activity State
├── Variables
├── Active DAG
├── Retry State
├── Compensation State
├── Event Cursor
├── Scheduler State
└── Security Metadata

Supported serialization formats:

  • CBOR (default)
  • MessagePack
  • JSON (debugging)
  • Protobuf (future)

Serialization format is configurable.


Supported compression algorithms:

AlgorithmPurpose
ZstdDefault
GzipCompatibility
LZ4High-speed recovery

Compression should occur after serialization.


Checkpoint encryption supports:

  • AES-256-GCM
  • Envelope encryption
  • Customer-managed keys
  • Cloud KMS integration

Sensitive workflow data must remain encrypted at rest.


Supported providers:

ProviderUse Case
PostgreSQLDefault
S3Enterprise
Azure Blob StorageCloud
Google Cloud StorageCloud
RocksDBEmbedded
Local FilesystemDevelopment

Storage providers implement a common interface.


Each checkpoint maintains:

Workflow Version
Checkpoint Version
Schema Version
Serialization Version
Encryption Version

Older checkpoints remain readable.


Recovery steps:

Worker Starts
Locate Latest Checkpoint
Load Snapshot
Decrypt
Decompress
Deserialize
Replay Events
Resume Workflow

Recovery must produce identical workflow state.


Replay begins after the checkpoint event cursor.

Example:

Checkpoint -> Event 231
Replay:
232
233
234
235
Resume Execution

Events before the checkpoint are never replayed.


Checkpoint creation must be atomic.

Required guarantees:

  • No partial snapshots
  • No duplicate checkpoints
  • Consistent DAG state
  • Consistent variable state
  • Consistent activity state

Checkpointing enables workflow migration.

Migration steps:

  1. Worker releases lease.
  2. Latest checkpoint persisted.
  3. Scheduler assigns new worker.
  4. New worker restores checkpoint.
  5. Replay remaining events.
  6. Resume execution.

Migration must be transparent.


Retention policies:

  • Keep latest N checkpoints
  • Keep daily snapshots
  • Keep milestone checkpoints
  • Delete expired snapshots

Retention is configurable per workflow.


The Checkpoint Manager periodically removes:

  • Expired checkpoints
  • Superseded incremental checkpoints
  • Orphaned snapshots
  • Failed snapshot attempts

Garbage collection must never remove checkpoints required for recovery.


Checkpoint failures may occur during:

  • Serialization
  • Compression
  • Encryption
  • Persistence

Policies:

  • Retry
  • Fallback storage
  • Alert operator
  • Pause workflow
  • Abort workflow (configurable)

MetricTarget
Checkpoint creation< 20 ms
Restore time< 100 ms
Compression overhead< 10 ms
Encryption overhead< 5 ms
Recovery startup< 250 ms

Targets assume medium-sized enterprise workflows.


Metrics:

  • Checkpoints created
  • Failed checkpoints
  • Restore duration
  • Snapshot size
  • Compression ratio
  • Encryption duration
  • Recovery duration

Logs include:

  • Workflow ID
  • Checkpoint ID
  • Version
  • Worker ID
  • Storage provider

Checkpoint storage enforces:

  • Encryption at rest
  • TLS in transit
  • Tenant isolation
  • Access auditing
  • Integrity validation
  • Digital signatures (optional)

pub trait CheckpointStore {
fn save(
&self,
checkpoint: WorkflowCheckpoint,
) -> Result<CheckpointId>;
fn load(
&self,
id: CheckpointId,
) -> Result<WorkflowCheckpoint>;
fn latest(
&self,
workflow_id: WorkflowId,
) -> Result<Option<WorkflowCheckpoint>>;
fn delete(
&self,
id: CheckpointId,
) -> Result<()>;
}

engine-workflow/
└── checkpoint/
├── manager.rs
├── snapshot.rs
├── serializer.rs
├── compression.rs
├── encryption.rs
├── recovery.rs
├── retention.rs
├── gc.rs
├── storage.rs
├── version.rs
└── mod.rs

  • Serialization
  • Compression
  • Encryption
  • Version compatibility
  • Recovery
  • Worker migration
  • Incremental checkpoints
  • Storage providers
  • Large workflows
  • Massive variables
  • Thousands of activities
  • Concurrent checkpoints
  • Crash during checkpoint
  • Storage outage
  • Corrupted snapshot
  • Encryption failure

RequirementTarget
DurabilityNo data loss after committed checkpoint
Availability99.99%
Replay correctness100%
Restore correctness100%
Compression supportYes
Encryption supportYes

  • Workflow Overview
  • Execution Model
  • Workflow DSL
  • DAG Engine
  • Scheduler
  • State Machine
  • Retry Engine
  • Compensation
  • Distributed Execution
  • Persistence
  • Rust Crate Design

VersionDateDescription
1.0.02026-06-26Initial Checkpointing Specification