From 9d0d12fcfc2606dc3ae746ee844c9ac3101c7115 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Thu, 8 Oct 2026 18:07:01 -0700 Subject: [PATCH] fix(dashboard): distinguish stored and transcript message counts --- .../sessions/SessionInspector.dom.test.tsx | 31 +++++++++++++++++-- .../workspaces/sessions/SessionInspector.tsx | 27 ++++++++-------- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/dashboard/src/workspaces/sessions/SessionInspector.dom.test.tsx b/dashboard/src/workspaces/sessions/SessionInspector.dom.test.tsx index 609043e000..63db7ec43f 100644 --- a/dashboard/src/workspaces/sessions/SessionInspector.dom.test.tsx +++ b/dashboard/src/workspaces/sessions/SessionInspector.dom.test.tsx @@ -35,7 +35,7 @@ describe('Session transcript drill-down', () => { expect(await screen.findByText('Unknown')).toBeTruthy(); expect(await screen.findByText(/lcm_temporal_retrieval_not_mounted/)).toBeTruthy(); expect(screen.queryByText('assistant')).toBeNull(); - expect(screen.queryByText(/raw messages/)).toBeNull(); + expect(screen.queryByRole('list', { name: 'Transcript messages' })).toBeNull(); }); /** The two governed refusals the LCM read routes actually serve @@ -69,7 +69,7 @@ describe('Session transcript drill-down', () => { expect(screen.getByText(new RegExp(reason))).toBeTruthy(); const chip = document.querySelector(`[data-state="${state}"]`); expect(chip).not.toBeNull(); - expect(screen.queryByText(/raw messages/)).toBeNull(); + expect(screen.queryByRole('list', { name: 'Transcript messages' })).toBeNull(); expect(screen.queryByText(/no transcript/i)).toBeNull(); }); @@ -169,6 +169,33 @@ describe('Session transcript drill-down', () => { expect(requests.some((url) => url.includes('cursor=opaque%2Bcursor%2F%3D%3D'))).toBe(true); expect(requests.some((url) => /[?&](?:offset|order)=/.test(url))).toBe(false); }); + + it('keeps stored totals separate from the end of the available transcript', async () => { + renderTranscript( + fixtureEnvelope( + sessionPage({ + counts: { + message_count: 478, + source_token_count: null, + summary_node_count: 0, + summary_token_count: null, + }, + messages: [message('available canonical message')], + next_cursor: null, + }), + ), + ); + + expect(await screen.findByText('available canonical message')).toBeTruthy(); + expect(screen.getByText('stored messages')).toBeTruthy(); + expect(screen.getByText('478')).toBeTruthy(); + const pageStatus = screen.getByText(/1 on this page/); + expect(pageStatus.textContent).toContain('last available page'); + expect(pageStatus.textContent).not.toContain('478'); + expect(screen.getByText(/does not establish that every stored message is represented/)).toBeTruthy(); + expect(screen.getByRole('list', { name: 'Transcript messages' })).toBeTruthy(); + expect((screen.getByRole('button', { name: 'Next page' }) as HTMLButtonElement).disabled).toBe(true); + }); }); describe('Session provenance inspector', () => { diff --git a/dashboard/src/workspaces/sessions/SessionInspector.tsx b/dashboard/src/workspaces/sessions/SessionInspector.tsx index d91a4f8d4c..31d601dd97 100644 --- a/dashboard/src/workspaces/sessions/SessionInspector.tsx +++ b/dashboard/src/workspaces/sessions/SessionInspector.tsx @@ -450,7 +450,7 @@ function SessionBody({
-
- raw messages + transcript messages - {/* Loaded page count, whole-session total, and whether another page - * exists, all three, because any one alone lets a page read as the - * transcript. A status region so paging announces where the reader now - * is; `tabIndex={-1}` so the focus repair can land here without adding - * a tab stop. */} + {/* Paging restores focus here so assistive technology announces the loaded page. */}

- {messages.length} on this page · {payload.counts.message_count.toLocaleString()} in session · - page {pageNumber} · page size {limit} - {payload.next_cursor != null ? ' · more pages follow' : ' · last page'} + {messages.length} on this page · page {pageNumber} · page size {limit} + {payload.next_cursor != null ? ' · more pages follow' : ' · last available page'} +

+

+ Stored-message totals can differ from the available transcript. The last available page + does not establish that every stored message is represented or explain any difference.

{messages.length > 0 ? (

@@ -690,7 +689,7 @@ function RawMessages({ ) : (

    {messages.map((message) => (