chore(cleanup): delete confirmed-dead files with no live references
Removes 6 files audited as fully unused: StageExecutor interface (shadowed by kernel), CyclePolicyResolver and PolicyValidation (deferred cycle policy), ApprovalRoutes (never registered), TuiNavigation (superseded by reducer), and ReplayContractTest abstract class (no concrete subclasses). ArtifactRelationshipType and CyclePolicy were audited but retained — both are actively referenced by production code.
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
@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
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.server.request.receive
|
||||
import io.ktor.server.response.respond
|
||||
import io.ktor.server.routing.Route
|
||||
import io.ktor.server.routing.post
|
||||
import io.ktor.server.routing.route
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ApprovalRequest(
|
||||
val requestId: String,
|
||||
val decision: String,
|
||||
val note: String? = null,
|
||||
)
|
||||
|
||||
fun Route.approvalRoutes(coordinator: ApprovalCoordinator) {
|
||||
route("/sessions/{id}/approve") {
|
||||
post {
|
||||
val id = call.parameters["id"]
|
||||
?: return@post call.respond(HttpStatusCode.BadRequest, "Missing session id")
|
||||
val sessionId: SessionId = TypeId(id)
|
||||
val body = call.receive<ApprovalRequest>()
|
||||
val requestId: ApprovalRequestId = TypeId(body.requestId)
|
||||
val decision = when (body.decision.lowercase()) {
|
||||
"approve" -> ApprovalDecision.APPROVE
|
||||
"reject" -> ApprovalDecision.REJECT
|
||||
"steer" -> ApprovalDecision.STEER
|
||||
else -> return@post call.respond(HttpStatusCode.BadRequest, "Unknown decision: ${body.decision}")
|
||||
}
|
||||
val msg = ClientMessage.ApprovalResponse(
|
||||
requestId = requestId,
|
||||
decision = decision,
|
||||
steeringNote = body.note,
|
||||
)
|
||||
val error = coordinator.handleResponse(msg, sessionId)
|
||||
if (error != null) {
|
||||
val msg = (error as? ServerMessage.ProtocolError)?.message
|
||||
call.respond(HttpStatusCode.Conflict, mapOf("error" to msg))
|
||||
} else {
|
||||
call.respond(HttpStatusCode.OK)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.correx.apps.tui
|
||||
|
||||
import com.correx.apps.tui.state.TuiState
|
||||
|
||||
internal fun navigateUp(state: TuiState): TuiState {
|
||||
val sessions = state.sessions.sessions
|
||||
if (sessions.isEmpty()) return state
|
||||
val idx = sessions.indexOfFirst { it.id == state.sessions.selectedId }
|
||||
val newIdx = if (idx <= 0) sessions.lastIndex else idx - 1
|
||||
return state.copy(sessions = state.sessions.copy(selectedId = sessions[newIdx].id))
|
||||
}
|
||||
|
||||
internal fun navigateDown(state: TuiState): TuiState {
|
||||
val sessions = state.sessions.sessions
|
||||
if (sessions.isEmpty()) return state
|
||||
val idx = sessions.indexOfFirst { it.id == state.sessions.selectedId }
|
||||
val newIdx = if (idx >= sessions.lastIndex) 0 else idx + 1
|
||||
return state.copy(sessions = state.sessions.copy(selectedId = sessions[newIdx].id))
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
package com.correx.core.transitions.execution
|
||||
|
||||
interface StageExecutor {
|
||||
fun execute(
|
||||
request: StageExecutionRequest
|
||||
): StageExecutionResult
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.correx.core.transitions.policy
|
||||
|
||||
class CyclePolicyResolver(
|
||||
private val bindings: Set<CyclePolicyBinding>
|
||||
) {
|
||||
|
||||
fun resolve(signature: CycleSignature): CyclePolicy? {
|
||||
return bindings
|
||||
.firstOrNull { it.cycle == signature }
|
||||
?.policy
|
||||
}
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
package com.correx.core.transitions.policy
|
||||
|
||||
class PolicyValidation {
|
||||
fun validate(
|
||||
bindings: Set<CyclePolicyBinding>,
|
||||
knownCycles: Set<CycleSignature>
|
||||
): List<String> {
|
||||
|
||||
val errors = mutableListOf<String>()
|
||||
|
||||
val bound = bindings.map { it.cycle }.toSet()
|
||||
|
||||
val unbound = knownCycles - bound
|
||||
|
||||
if (unbound.isNotEmpty()) {
|
||||
errors += unbound.map {
|
||||
"Cycle $it has no policy binding"
|
||||
}
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package com.correx.testing.contracts.fixtures.projections
|
||||
|
||||
import com.correx.core.events.stores.EventStore
|
||||
import com.correx.core.events.types.EventId
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.sessions.projections.replay.EventReplayer
|
||||
import com.correx.testing.fixtures.EventFixtures.newEvent
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
abstract class ReplayContractTest<S> {
|
||||
|
||||
protected abstract fun store(): EventStore
|
||||
|
||||
protected abstract fun replayer(
|
||||
store: EventStore
|
||||
): EventReplayer<S>
|
||||
|
||||
@Test
|
||||
fun `rebuild is deterministic`(): Unit = runBlocking {
|
||||
val store = store()
|
||||
|
||||
repeat(50) {
|
||||
store.append(newEvent(EventId("e$it"), SessionId("s1")))
|
||||
}
|
||||
|
||||
val replayer = replayer(store)
|
||||
|
||||
val state1 = replayer.rebuild(SessionId("s1"))
|
||||
val state2 = replayer.rebuild(SessionId("s1"))
|
||||
|
||||
assertEquals(state1, state2)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user