fix(web): batch session expansion and keep running sessions visible (#4715)

* fix(web): expand workspace sessions in bounded batches

* fix(web): keep running sessions outside overflow quota

---------

Co-authored-by: Turtle <[email protected]>
This commit is contained in:
Turtle 2099andTurtle authored and GitHub committed 2026-09-20 10:38:56 +00:00
1 parent 068cf03441
commit e8f3d02da8
8 files changed
+267 -33

No files matched your search

@@ -0,0 +1,18 @@
- tree "Sessions":
- treeitem "{{workspace}}" [expanded]
- treeitem "New Session" [selected]
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} Session actions for {{workspace}} Archive session Pin session":
- text: {{workspace}}
- button "Session actions for {{workspace}}"
- button "Archive session"
- button "Pin session"
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} 1min"
- button "Show 6 more sessions"
@@ -9,4 +9,4 @@
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} 1min"
- treeitem "{{workspace}} 1min"
- button "Show 1 more sessions"
- button "Show 11 more sessions"
@@ -22,7 +22,7 @@ const EXPECTED_DIR = fileURLToPath(new URL('./expected/workspace-new-session-fol
const SIDEBAR_EXPECTED = join(EXPECTED_DIR, 'sidebar.expected.md')
const SEED = fileURLToPath(new URL('../../../snapshots/web/message-feedback-protocol/session.v3.jsonl', import.meta.url))
const MODE = webSnapshotMode()
const EXISTING_SESSION_COUNT = 6
const EXISTING_SESSION_COUNT = 16
describe('web e2e: blank New Session folding quota', () => {
let scaffold: WebScaffold
@@ -72,7 +72,7 @@ describe('web e2e: blank New Session folding quota', () => {
await expect.poll(() => sidebar.getByRole('treeitem').count(), { timeout: 15_000 }).toBe(7)
expect(await sidebar.getByText('New Session', { exact: true }).count()).toBe(1)
expect(await sidebar.getByText(basename(scaffold.workspaceCwd), { exact: true }).count()).toBe(6)
const showMore = sidebar.getByRole('button', { name: 'Show 1 more sessions' })
const showMore = sidebar.getByRole('button', { name: 'Show 11 more sessions' })
await showMore.waitFor({ timeout: 15_000 })
await compareOrRefreshGolden(
SIDEBAR_EXPECTED,
@@ -81,11 +81,20 @@ describe('web e2e: blank New Session folding quota', () => {
)
await showMore.click()
await expect.poll(() => sidebar.getByRole('treeitem').count(), { timeout: 10_000 }).toBe(8)
expect(await sidebar.getByText(basename(scaffold.workspaceCwd), { exact: true }).count()).toBe(7)
await expect.poll(() => sidebar.getByRole('treeitem').count(), { timeout: 10_000 }).toBe(12)
expect(await sidebar.getByText(basename(scaffold.workspaceCwd), { exact: true }).count()).toBe(11)
await compareOrRefreshGolden(
join(EXPECTED_DIR, 'first-batch.expected.md'),
await captureStableAria(page, '[role="tree"][aria-label="Sessions"]', scaffold.workspaceCwd),
MODE,
)
await sidebar.getByRole('button', { name: 'Show 6 more sessions' }).click()
await expect.poll(() => sidebar.getByRole('treeitem').count()).toBe(17)
await sidebar.getByRole('button', { name: 'Show 1 more sessions' }).click()
await expect.poll(() => sidebar.getByRole('treeitem').count()).toBe(18)
await sidebar.getByRole('button', { name: 'Show less' }).click()
await expect.poll(() => sidebar.getByRole('treeitem').count()).toBe(7)
await assertFixtureInventory(EXPECTED_DIR, ['sidebar.expected.md'])
await assertFixtureInventory(EXPECTED_DIR, ['sidebar.expected.md', 'first-batch.expected.md'])
expect(tripwire.pageErrors).toEqual([])
expect(tripwire.warnings).toEqual([])
})