Skip to content

The agent that grows with you

test(desktop): control invariant — MIN_VISIBLE_GROUPS holds at 8 and 10 panes on the shared page budget

kshitijk4poor490e6b5966de
diff --git a/apps/desktop/src/components/assistant-ui/thread/list.test.ts b/apps/desktop/src/components/assistant-ui/thread/list.test.ts
index 13b36a5c0f3..f69e0b633ed 100644
--- a/apps/desktop/src/components/assistant-ui/thread/list.test.ts
+++ b/apps/desktop/src/components/assistant-ui/thread/list.test.ts
@@ -265,6 +265,20 @@ describe('firstVisibleGroupIndex', () => {
expect(firstVisibleGroupIndex(groups, 600, 8)).toBe(groups.length - 8)
})
+ it.each([8, 10])('keeps the visible-turn floor at %i mounted panes on the shared page budget', panes => {
+ // #117067 dropped the quarter-page floor from transcriptPaneBudget; its safety
+ // argument is that this floor, not the budget, guards against a degenerate
+ // pane. Control: at high pane counts the per-pane budget covers only ~3 of
+ // these turns, yet 8 stay visible and "Show earlier" still has history to reach.
+ const paneBudget = transcriptPaneBudget(panes, false)
+ const groups = Array.from({ length: 20 }, (_, i) => group(`g${i}`, 20))
+
+ expect(paneBudget * panes).toBeLessThanOrEqual(600 + panes) // shared page, ceil slack only
+ expect(Math.floor(paneBudget / 20)).toBeLessThan(8)
+ expect(firstVisibleGroupIndex(groups, paneBudget, 8)).toBe(groups.length - 8)
+ expect(firstVisibleGroupIndex(groups, paneBudget, 8)).toBeGreaterThan(0)
+ })
+
it('does not force the floor to hide turns the budget already showed', () => {
const groups = Array.from({ length: 20 }, (_, i) => group(`g${i}`, 1))