debt(pre-router): resolved most of the technical debt that was noted while finishing epic-12 and epic-13.

This commit is contained in:
2026-05-16 14:55:45 +04:00
parent 2207a37549
commit f77efce10b
10 changed files with 107 additions and 43 deletions
@@ -16,7 +16,7 @@ import com.correx.core.events.events.ApprovalRequestedEvent
import com.correx.core.events.types.ApprovalRequestId
import com.correx.core.events.types.SessionId
import com.correx.core.events.types.StageId
import com.correx.core.kernel.orchestration.DefaultSessionOrchestrator
import com.correx.core.kernel.orchestration.ApprovalGateway
import com.correx.core.sessions.ApprovalMode
import io.ktor.server.websocket.DefaultWebSocketServerSession
import io.ktor.websocket.Frame
@@ -28,7 +28,7 @@ import kotlinx.datetime.Clock
import java.util.concurrent.ConcurrentHashMap
class ApprovalCoordinator(
private val orchestrator: DefaultSessionOrchestrator,
private val orchestrator: ApprovalGateway,
private val config: ApprovalConfig,
private val scope: CoroutineScope,
) {
@@ -1,8 +1,11 @@
@file:Suppress("MatchingDeclarationName")
package com.correx.apps.server.routes
import com.correx.apps.server.approval.ApprovalCoordinator
import com.correx.apps.server.protocol.ApprovalDecision
import com.correx.apps.server.protocol.ClientMessage
import com.correx.apps.server.protocol.ServerMessage
import com.correx.core.events.types.ApprovalRequestId
import com.correx.core.events.types.SessionId
import com.correx.core.utils.TypeId
@@ -43,7 +46,8 @@ fun Route.approvalRoutes(coordinator: ApprovalCoordinator) {
)
val error = coordinator.handleResponse(msg, sessionId)
if (error != null) {
call.respond(HttpStatusCode.Conflict, mapOf("error" to (error as? com.correx.apps.server.protocol.ServerMessage.ProtocolError)?.message))
val msg = (error as? ServerMessage.ProtocolError)?.message
call.respond(HttpStatusCode.Conflict, mapOf("error" to msg))
} else {
call.respond(HttpStatusCode.OK)
}