From 850c6df7430d5e245fcc5ceea13145fa67dd2caa Mon Sep 17 00:00:00 2001 From: kami Date: Sun, 24 May 2026 23:11:17 +0400 Subject: [PATCH] fix(build): resolve three failing tests across integration and tui modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SessionOrchestratorIntegrationTest: wire approvalRepository into OrchestratorRepositories constructor which gained the field in the kernel refactor. TambouiKeyMapperTest: correct ctrl-h to alt-h — the mapper has always placed ToggleApprovalOverlay under the Alt branch, not Ctrl. SessionOrchestrator.emit: replace substring(0,7) with take(7) to avoid StringIndexOutOfBoundsException when session IDs are shorter than 7 chars. --- .../com/correx/apps/tui/input/TambouiKeyMapperTest.kt | 4 ++-- .../core/kernel/orchestration/SessionOrchestrator.kt | 2 +- .../src/test/kotlin/SessionOrchestratorIntegrationTest.kt | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/tui/src/test/kotlin/com/correx/apps/tui/input/TambouiKeyMapperTest.kt b/apps/tui/src/test/kotlin/com/correx/apps/tui/input/TambouiKeyMapperTest.kt index 68d4f834..1311e841 100644 --- a/apps/tui/src/test/kotlin/com/correx/apps/tui/input/TambouiKeyMapperTest.kt +++ b/apps/tui/src/test/kotlin/com/correx/apps/tui/input/TambouiKeyMapperTest.kt @@ -60,8 +60,8 @@ class TambouiKeyMapperTest { } @Test - fun `ctrl-h maps to ToggleApprovalOverlay`() { - assertEquals(KeyEvent.ToggleApprovalOverlay, mapKey(TambouiKeyEvent(KeyCode.CHAR, KeyModifiers.CTRL, 'h'.code))) + fun `alt-h maps to ToggleApprovalOverlay`() { + assertEquals(KeyEvent.ToggleApprovalOverlay, mapKey(TambouiKeyEvent(KeyCode.CHAR, KeyModifiers.ALT, 'h'.code))) } @Test diff --git a/core/kernel/src/main/kotlin/com/correx/core/kernel/orchestration/SessionOrchestrator.kt b/core/kernel/src/main/kotlin/com/correx/core/kernel/orchestration/SessionOrchestrator.kt index d5d24e87..079fd74c 100644 --- a/core/kernel/src/main/kotlin/com/correx/core/kernel/orchestration/SessionOrchestrator.kt +++ b/core/kernel/src/main/kotlin/com/correx/core/kernel/orchestration/SessionOrchestrator.kt @@ -646,7 +646,7 @@ abstract class SessionOrchestrator( // --- event emission --- internal suspend fun emit(sessionId: SessionId, payload: EventPayload) { - log.debug("[session {}] emitting event, payload: {}", sessionId.value.substring(0, 7), payload) + log.debug("[session {}] emitting event, payload: {}", sessionId.value.take(7), payload) eventStore.append( NewEvent( metadata = EventMetadata( diff --git a/testing/integration/src/test/kotlin/SessionOrchestratorIntegrationTest.kt b/testing/integration/src/test/kotlin/SessionOrchestratorIntegrationTest.kt index bf023973..d25fb7c0 100644 --- a/testing/integration/src/test/kotlin/SessionOrchestratorIntegrationTest.kt +++ b/testing/integration/src/test/kotlin/SessionOrchestratorIntegrationTest.kt @@ -1,5 +1,8 @@ import com.correx.core.approvals.ApprovalOutcome +import com.correx.core.approvals.ApprovalProjector import com.correx.core.approvals.ApprovalStatus +import com.correx.core.approvals.DefaultApprovalReducer +import com.correx.core.approvals.DefaultApprovalRepository import com.correx.core.approvals.Tier import com.correx.core.approvals.domain.DefaultApprovalEngine import com.correx.core.approvals.model.ApprovalContext @@ -87,12 +90,17 @@ class SessionOrchestratorIntegrationTest { private val riskAssessor = DefaultRiskAssessor() private val artifactStore = NoopArtifactStore() + private val approvalRepository = DefaultApprovalRepository( + DefaultEventReplayer(eventStore, ApprovalProjector(DefaultApprovalReducer())), + ) + private val repositories = OrchestratorRepositories( eventStore = eventStore, inferenceRepository = inferenceRepository, orchestrationRepository = orchestrationRepository, sessionRepository = sessionRepository, artifactRepository = LiveArtifactRepository(eventStore, DefaultArtifactReducer()), + approvalRepository = approvalRepository, ) private val engines = OrchestratorEngines(