durable_workflow 0.2.0
durable_workflow: ^0.2.0 copied to clipboard
Local durable execution library for Dart. Provides durable checkpoint/resume workflows with zero dependencies.
0.2.0 #
Breaking Changes #
- Removed
idempotencyKeyfromWorkflowContext.step(),StepCheckpoint, andStepExecutor.executeStep(). The field was stored but never used for deduplication. DB column preserved as null for schema compatibility. CheckpointStorenow requires 3 new methods:saveCheckpoints(),deleteOldTimers(),deleteOldSignals(). All implementations must be updated.- Exception types changed:
StateErrorfor missing executions is nowWorkflowExecutionNotFoundException. Signal timeout throwsWorkflowTimeoutExceptioninstead ofTimeoutException.
Migration Guide #
// Before (0.1.x)
try {
await engine.cancel('nonexistent');
} on StateError catch (e) { ... }
// After (0.2.0)
try {
await engine.cancel('nonexistent');
} on WorkflowExecutionNotFoundException catch (e) { ... }
// Before (0.1.x)
await ctx.step('pay', () async => result, idempotencyKey: 'key');
// After (0.2.0) — idempotencyKey parameter removed
await ctx.step('pay', () async => result);
New Features #
DurableEngine.dispose()declared in the abstract interface — no more casting toDurableEngineImplto release resources.- Custom exception hierarchy:
DurableWorkflowExceptionbase class withWorkflowTimeoutException,WorkflowExecutionNotFoundException,CompensationExceptionsubtypes. DurableEngineObserver: lifecycle monitoring hooks for step execution, retry, compensation, recovery, and error events.- Input validation:
workflowType,stepName,signalNameare validated at API boundaries (empty, control chars, length > 256). - Error formatter: optional
errorFormatterparameter onDurableEngineImplto sanitize error messages before persistence. - CheckpointStore cleanup:
deleteOldTimers()anddeleteOldSignals()for pruning terminal-state records,saveCheckpoints()for batch inserts.
Improvements #
- Recovery scanner reentrance guard prevents concurrent
scan()calls. - Signal timeout race condition protection with double-guard on completer state.
- Engine dispose cancels active executors and safely closes observer streams.
- Duplicate execution ID prevention in
_executeBody.
0.1.0 #
- Initial release.
- Core durable workflow engine with checkpoint/resume semantics.
- Saga compensation pattern for automatic rollback.
- Durable timers that survive process restarts.
- External signal coordination via
waitSignal. - Configurable retry policies (fixed interval, exponential backoff).
- Pluggable
CheckpointStorepersistence interface. InMemoryCheckpointStorefor testing.RecoveryScannerfor automatic detection and resumption of interrupted workflows.