test(jetbrains): pin reflow gate to Busy with a non-streaming state

Add a Retry-state reflow test (isBusy() == true but not SessionState.Busy):
it must keep restarting the settle window toward the idle budget rather than
collapsing to REFLOW_PASSES. This is the only case that distinguishes
`is SessionState.Busy` from the old `isBusy()` predicate — verified it fails
(7 passes) if the gate is reverted to isBusy().
This commit is contained in:
kirillk
2026-07-31 18:26:08 -04:00
parent f1947697ea
commit b2f17a20c2
@@ -241,6 +241,25 @@ class SessionMessageListPanelTest : BasePlatformTestCase() {
assertTrue("streaming reflow must settle in the pass window, was $reflows", reflows in 1..10)
}
fun `test non-streaming active state keeps the reflow settle window`() {
var reflows = 0
panel.onReflow = { reflows++ }
// Retry is isBusy() == true but not SessionState.Busy: no deltas arrive, so a moving height
// means the panes are still settling and the window must keep restarting toward the idle
// budget rather than collapsing to REFLOW_PASSES. recoverPending() can seed this right after
// load, and it is the only case that tells `is SessionState.Busy` apart from `isBusy()`.
model.loadHistory(listOf(MessageWithPartsDto(msg("u1", "user"), emptyList())))
model.setState(SessionState.Retry("retrying", 1, 0L))
panel.add(EverGrowing(), 0)
panel.setSize(600, 400)
UIUtil.dispatchAllInvocationEvents()
// Reaches the idle budget region (~25), not the streaming window (~7). Reverting the gate to
// isBusy() would collapse this to REFLOW_PASSES and fail here.
assertTrue("non-streaming state must keep re-measuring, was $reflows", reflows in 11..30)
}
fun `test apply style drops cached panel measurements`() {
val child = Growing(20)
panel.add(child, 0)