Keep open tool cards out of groups
This commit is contained in:
1 parent
33b130b6bb
commit
9bcf0f1a48
4 files changed
+55
-48
No files matched your search
@@ -5,10 +5,9 @@ import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
/**
|
||||
* How a run of tool calls is cut into rows: the call still running and the last call in the
|
||||
* transcript are drawn on their own, and every piece the cut leaves behind still has a key of its
|
||||
* own -- two rows sharing one key take the app down, and a key that moves takes the reader's place
|
||||
* with it.
|
||||
* How a run of tool calls is cut into rows: a call still running, open, or last in the transcript
|
||||
* is drawn on its own, and every piece the cut leaves behind still has a key of its own -- two rows
|
||||
* sharing one key take the app down, and a key that moves takes the reader's place with it.
|
||||
*/
|
||||
class ToolRowsTest {
|
||||
private var seq = 0L
|
||||
@@ -75,6 +74,30 @@ class ToolRowsTest {
|
||||
assertKeysDistinct(rows)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun an_open_call_stays_out_of_its_group_until_it_is_closed() {
|
||||
val calls =
|
||||
listOf(
|
||||
call("a"),
|
||||
call("b", runId = "a"),
|
||||
call("c", runId = "a"),
|
||||
call("d", runId = "a"),
|
||||
reply(),
|
||||
)
|
||||
|
||||
val whileOpen = groupToolRuns(calls, expandedTools = setOf("b"))
|
||||
val afterItCloses = groupToolRuns(calls)
|
||||
|
||||
assertEquals(
|
||||
listOf(listOf("a"), listOf("b"), listOf("c", "d"), listOf("reply")),
|
||||
shape(whileOpen),
|
||||
)
|
||||
assertTrue(whileOpen[1] is TranscriptRow.Single, "$whileOpen")
|
||||
assertKeysDistinct(whileOpen)
|
||||
assertEquals(listOf(listOf("a", "b", "c", "d"), listOf("reply")), shape(afterItCloses))
|
||||
assertTrue(afterItCloses.first() is TranscriptRow.Tools, "$afterItCloses")
|
||||
}
|
||||
|
||||
/**
|
||||
* The one case where the run's name is a call that is not in the run's first row: a page of
|
||||
* history joined onto a run whose own first call is still going ([joinPages] renames the older
|
||||
|
||||
Reference in new issue
Block a user