Add attention inbox and AI usage observability

This commit is contained in:
jjbrunton committed 2026-08-09 08:52:32 +01:00
1 parent ca59ba0f1f
commit 83b5f1f5b6
30 files changed
+702 -28

No files matched your search

+19 -1
View File
@@ -79,7 +79,7 @@ describe('dashboard foundation', () => {
const { router } = renderDashboard('/');
const navigation = screen.getByRole('navigation', { name: 'Primary navigation' });
for (const label of ['Overview', 'Conversations', 'Media', 'Performance', 'Operations', 'Settings']) {
for (const label of ['Overview', 'Needs attention', 'Conversations', 'Media', 'Performance', 'Operations', 'Settings']) {
expect(within(navigation).getByRole('link', { name: label })).toBeInTheDocument();
}
@@ -91,6 +91,24 @@ describe('dashboard foundation', () => {
expect(screen.getByRole('heading', { name: 'Operations' })).toBeInTheDocument();
});
it('shows actionable attention items and links handoffs to their conversation', async () => {
installSuccessfulApi();
server.use(http.get('/api/attention', () => HttpResponse.json({
generatedAt: Date.parse('2026-08-09T08:00:00Z'),
items: [{
id: 'conversation:one', kind: 'human-required', severity: 'warning',
title: 'Human follow-up required for u/alice', detail: 'Automated turns are exhausted.',
occurredAt: Date.parse('2026-08-09T07:00:00Z'),
owner: { accountId: '@one:reddit.com', redditUsername: 'operator' },
conversationId: '@one:reddit.com~!room:reddit.com', username: 'alice',
}],
})));
renderDashboard('/attention');
expect(await screen.findByRole('heading', { name: 'Needs attention' })).toBeInTheDocument();
expect(screen.getByText('Human follow-up required for u/alice')).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'Open conversation' })).toHaveAttribute('href', '/conversations/%40one%3Areddit.com~!room%3Areddit.com');
});
it('hydrates media filters from the routed URL', async () => {
installSuccessfulApi();
server.use(