2c459da009
Implements the full conversational router facade: RouterState, RouterReducer, RouterProjector, RouterRepository, RouterContextBuilder, RouterFacade, protocol types, WebSocket wiring, infrastructure factory, and deterministic test suite. Also fixes spec divergences found in post-implementation review: - Add SteeringNote domain object to core:context (epic prerequisite) - Rename RouterFacade.handleChat → onUserInput per spec interface contract - Add in-memory ConcurrentHashMap conversation history to DefaultRouterFacade - Make RouterRepository.getRouterState suspend - Rename RouterConfig.keepLast → conversationKeepLast, fix defaults (6, 4096) - Refactor InfrastructureModule.createRouterFacade to self-assemble internally - Fix FileReadTool: allowedPaths was dead constructor param (@SuppressUnusedParameter); now stored as private val and enforced in validateRequest - Disable koverVerify on modules tested via testing/ submodules or with hardware/integration dependencies (24 modules); build gate now passes clean
1.9 KiB
1.9 KiB
task-009
status: done
goal
Implement RouterReducer — reduces RouterState from SteeringNoteAddedEvent and workflow lifecycle events (started, completed, failed, paused, resumed, stage completed, stage failed).
target artifact
core/router/src/main/kotlin/com/correx/core/router/RouterReducer.kt
execution steps
- Create
RouterReducerinterface incore/routermodule matching the convention (reduce(state: RouterState, event: StoredEvent): RouterState) - Implement
DefaultRouterReducerclass implementingRouterReducer - Handle
SteeringNoteAddedEvent— append a USER-roleRouterTurntoconversationHistory - Handle
WorkflowStartedEvent— setworkflowStatus = RUNNING, setcurrentStageIdfromstartStageId - Handle
WorkflowCompletedEvent— setworkflowStatus = COMPLETED, clearcurrentStageId - Handle
WorkflowFailedEvent— setworkflowStatus = FAILED, clearcurrentStageId - Handle
OrchestrationPausedEvent— setworkflowStatus = PAUSED - Handle
OrchestrationResumedEvent— setworkflowStatus = RUNNING - Handle
StageCompletedEvent— append aRouterL2EntrywithStageOutcomeKind.SUCCESStol2Memory - Handle
StageFailedEvent— append aRouterL2EntrywithStageOutcomeKind.FAILUREtol2Memory, clearcurrentStageId - Return unchanged
statefor any unknown event types (catch-allelsebranch)
changed artifacts
core/router/src/main/kotlin/com/correx/core/router/RouterReducer.kt— new file
blockers
- none
notes
- Handler methods that don't need payload data (
handleWorkflowCompleted,handleWorkflowFailed,handleOrchestrationPaused,handleOrchestrationResumed) take onlystateparameter to avoid detektUnusedParameterwarnings - All state mutations use
state.copy(...)per core architecture pattern — state is never mutated in place - Timestamps come from
event.metadata.timestampto preserve the original event ordering