fix(chat): support batch clarify.request payload and route question_id on respond (fixes #1045) (#1046)

This commit is contained in:
M57 authored and GitHub committed 2026-09-03 12:50:13 +03:00
1 parent dbd7008ee3
commit fa17c95296
6 files changed
+159 -1

No files matched your search

@@ -291,6 +291,42 @@ class EventParserTest {
assertEquals(listOf("staging", "production"), clarifyEvent.options)
}
@Test
fun testParseClarifyRequest_withBatchQuestions_parsesSuccessfully() {
val response =
createJsonRpcResponse(
jsonrpc = "2.0",
id = null,
result = null,
error = null,
method = "event",
params =
mapOf(
"type" to "clarify.request",
"payload" to
mapOf(
"request_id" to "req-batch-1",
"questions" to
listOf(
mapOf(
"qid" to "q0",
"question" to "Which database?",
"choices" to listOf("Postgres", "SQLite"),
"multi_select" to false,
),
),
),
),
)
val event = EventParser.parse(response)
assertTrue(event is WsEvent.ClarifyRequest)
val clarifyEvent = event as WsEvent.ClarifyRequest
assertEquals("Which database?", clarifyEvent.text)
assertEquals(listOf("Postgres", "SQLite"), clarifyEvent.options)
assertEquals("req-batch-1", clarifyEvent.clarifyId)
assertEquals("q0", clarifyEvent.questionId)
}
// ── TEST-07: Untested subtypes ─────────────────────────────────────
@Test