refactor: extract pure state machines from execute() and run() #349
No reviewers
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jwilger/eventcore!349
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/internal-state-machines"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Extracts the core logic of
execute()andProjectionRunner::run()into pure state machines that yield effects, with thin shell loops dispatching effects to backend traits.ExecutePipeline: Pure state machine encapsulating stream resolution, state reconstruction, handle(), event appending, and retry-on-conflict. YieldsStoreEffect(ReadStream, AppendEvents, Sleep) and acceptsStoreEffectResult.ProjectionPipeline: Pure state machine encapsulating checkpoint loading, event polling, event application with retry/skip/fatal strategies, and checkpoint saving. YieldsProjectionEffect(ReadEvents, LoadCheckpoint, SaveCheckpoint, Sleep).execute()andrun()become ~20-line shell loops that dispatch effects toEventStore/EventReader/CheckpointStoretraits.Benefits
No Breaking Changes
execute()signature unchanged:Result<ExecutionResponse, CommandError>CommandLogictrait unchangedProjectionRunner::run()signature unchangedThis is the internal refactor portion of #299, extracted after closing #348 (caller-driven effects were abandoned in favor of pure commands with pre-calculated inputs).
Test plan
🤖 Generated with Claude Code