Event sourcing core — commands, events, decider & projector #4
Labels
No labels
area:config
area:contracts
area:engine
area:eventsourcing
area:frontend
area:git
area:ipc
area:persistence
area:provider
area:scaffold
area:terminal
type:user-story
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/peon#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
User story
As a backend developer, I want pure-function implementations of the Decider (command validation → events) and Projector (event folding → read model), so that the core business logic is fully testable without I/O and serves as the foundation for the OrchestrationEngine.
Acceptance criteria
Commands (
orchestration/commands.rs)OrchestrationCommandenum with all variants from spec §5.1:CreateProject,DeleteProject,RenameProjectCreateThread,DeleteThread,SelectThreadStartTurn,InterruptTurn,ApprovePendingAction,RejectPendingActionIngestProviderEventCreateCheckpoint,RestoreCheckpointCommitChanges,CreateBranch,PushBranchEvents (
orchestration/events.rs)OrchestrationEventenum with all variants from spec §5.2 (ProjectCreated, ThreadCreated, TurnStarted, MessageAppended, MessageChunkReceived, CheckpointCreated, etc.)StoredEventwrapper withsequence: u64,event: OrchestrationEvent,stored_at: DateTime<Utc>ProviderEventenum (TextDelta, ToolCall, ToolResult, ThinkingDelta, TurnComplete, Error, AwaitingApproval) as per spec §7.1Decider (
orchestration/decider.rs)fn decide(command, model) -> Result<Vec<OrchestrationEvent>, DeciderError>— pure function, no async, no side-effectsCreateProject: rejects duplicate paths, emitsProjectCreatedDeleteProject: rejects unknown id, emitsProjectDeletedRenameProject: rejects unknown id, emitsProjectRenamedCreateThread: validates project exists, emitsThreadCreatedDeleteThread: validates thread exists, emitsThreadDeletedSelectThread: validates thread exists, emitsThreadSelectedStartTurn: validates thread exists and isIdle, emitsTurnStarted+ThreadStatusChanged(Running)InterruptTurn: validates thread isRunning, emitsTurnInterrupted+ThreadStatusChanged(Idle)IngestProviderEvent: mapsProviderEventvariants to domain events (MessageAppended, MessageChunkReceived, TurnCompleted, etc.)CreateCheckpoint: emitsCheckpointCreatedDeciderErrorenum with descriptive variantsProjector (
orchestration/projector.rs)fn project(model, event) -> OrchestrationReadModel— pure fold functionOrchestrationEventvariants: creates/deletes/renames projects, creates threads, updates status, appends turns and messages, records checkpointsTests
Out of scope
References
Dependencies
main