Metadata
- Status: done
- Phase: 1-MVP
- Version: v0.1.0
- Priority: high
- Estimation: M
Description
Persist workflow execution state to JSON files. Save state after each step completion for crash recovery. Support atomic writes to prevent corruption. Enable workflow resumption from persisted state.
Acceptance Criteria
Dependencies
- Blocked by: F001, F003
- Unblocks: F013
Impacted Files
internal/infrastructure/store/json_store.go # NEW
internal/infrastructure/store/json_store_test.go # NEW
internal/application/execution_service.go # MODIFIED (checkpoint)
internal/domain/ports/store.go # EXISTING (interface)
storage/states/
Technical Tasks
Notes
State file location: storage/states/{workflow-id}.json
Atomic write pattern:
tmpFile := stateFile + ".tmp"
os.WriteFile(tmpFile, data, 0600)
os.Rename(tmpFile, stateFile) // Atomic on POSIX
Implementation Summary
JSONStore implements ports.StateStore interface
- Atomic writes via temp file +
os.Rename
- File locking via
syscall.Flock(LOCK_EX)
ExecutionService.checkpoint() saves state after each step
- 14 unit tests + 1 integration test (all passing)
Synced from docs/plans/features/v0.1.0/F004-json-state-persistence.md
Metadata
Description
Persist workflow execution state to JSON files. Save state after each step completion for crash recovery. Support atomic writes to prevent corruption. Enable workflow resumption from persisted state.
Acceptance Criteria
Dependencies
Impacted Files
Technical Tasks
Notes
State file location:
storage/states/{workflow-id}.jsonAtomic write pattern:
Implementation Summary
JSONStoreimplementsports.StateStoreinterfaceos.Renamesyscall.Flock(LOCK_EX)ExecutionService.checkpoint()saves state after each stepSynced from
docs/plans/features/v0.1.0/F004-json-state-persistence.md