Files
correx/docs/specs/2026-05-20-router/exec/task-021.md
T
kami 2c459da009 feat(router): implement Epic 14 — core:router module
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
2026-05-21 15:06:20 +04:00

1.9 KiB

task-021

status:

  • done

goal

Test RouterProjector — verify initial() returns empty defaults and apply() correctly chains reducer output.

target artifact

testing/deterministic/src/test/kotlin/RouterProjectorTest.kt

execution steps

  • Create RouterProjectorTest.kt in testing/deterministic/src/test/kotlin/
  • Test initial() returns RouterState with IDLE status, null sessionId, null currentStageId, empty l2Memory and conversationHistory
  • Test initial() returns same state as reducer.initial (delegation verification)
  • Test apply(WorkflowStartedEvent) delegates to reducer and sets RUNNING
  • Test apply(WorkflowCompletedEvent) delegates to reducer and sets COMPLETED, clears currentStageId
  • Test apply(WorkflowFailedEvent) delegates to reducer and sets FAILED, clears currentStageId
  • Test apply(OrchestrationPausedEvent) delegates to reducer and sets PAUSED
  • Test apply(OrchestrationResumedEvent) delegates to reducer and sets RUNNING
  • Test apply(StageCompletedEvent) delegates to reducer and appends l2Memory entry with SUCCESS
  • Test apply(StageFailedEvent) delegates to reducer and appends FAILURE entry, clears currentStageId
  • Test apply(SteeringNoteAddedEvent) leaves state unchanged (unhandled event)
  • Test apply(ToolInvokedEvent) leaves state unchanged (unhandled event)
  • Test apply produces same result as reducer.reduce for every handled event (full equivalence)
  • Test full lifecycle through projector mirrors reducer pipeline
  • Run ./gradlew :testing:deterministic:test --tests RouterProjectorTest --rerun-tasks

changed artifacts

  • testing/deterministic/src/test/kotlin/RouterProjectorTest.kt (created)

blockers

  • None

notes

  • Kotlin backtick-quoted test names cannot contain dots (parsed as member access); avoided dots in test name strings
  • Projector is a thin delegate over RouterReducer; tests verify both individual event paths and full equivalence with direct reducer calls