Repository navigation
Closed
Description
Context
The dashboard specification contains a number of requirements that are easy to implement approximately and hard to notice when they regress. These are the ones that need explicit test coverage:
- "Dismissing a notification must not resolve a blocker." — an attention item derived from a failed task must survive an inbox dismissal.
- "Avoid asking the user to fix something the system is already fixing." — a task under automatic recovery belongs in "Happening now", not "Needs attention".
- "Avoid reordering content while someone is clicking or expanding a row." — live updates must not reshuffle the active list.
- "'No work running' and 'Unable to load running work' must look different." — the idle and unavailable states must be textually distinct.
- "Show unavailable data as unavailable, rather than zero." — a null success rate must not render as 0%.
- "Hide the empty attention panel so it does not consume space." — the desktop panel must be absent from the DOM, not merely hidden.
- "Counts should use consistent definitions across the dashboard and task pages."
The repository already has strong precedent for this style of test. propr-ui/src/components/TaskList.test.tsx asserts that socket bursts do not cause redundant fetches; LiveFileChips.test.tsx asserts exact API call counts after three rapid updates; mobile-install.smoke.pw.ts and task-list-desktop.pw.ts assert no horizontal overflow at narrow widths. This task follows those patterns rather than inventing new ones.
Requirements
Backend tests (packages/api/test/dashboardRoutes.test.ts)
- Count consistency:
/api/dashboard/summaryand/api/dashboard/activereport the same running and queued counts for the same repository filter. - Notification independence: dismissing every notification for a failed task leaves that task present in
/api/dashboard/attention. - Recovery exclusion: a failed task with a newer in-flight run for the same issue appears in
activeand not inattention. - Ordering: blocking failures sort before pending approvals; within each group, older items come first.
- Success-rate denominator: cancelled, queued, and running work is excluded; an empty denominator yields
null, not0. - Repository validation: a malformed
repositoryvalue yields HTTP 400 on all four endpoints.
Frontend unit tests (propr-ui/src/components/Dashboard.test.tsx)
- Ten rapid
onTaskUpdatesocket callbacks produce exactly one fetch per live section. - With an expanded "Happening now" row, a socket-driven refresh that returns a reordered array leaves the rendered order unchanged.
- An empty running list renders "No work running"; a rejected running-work request renders "Unable to load running work" plus a retry control. Assert the two strings are different and both are reachable.
- A disconnected socket with previously-loaded rows keeps those rows rendered and shows a "Reconnecting · Last updated" line.
- Zero attention items with
hideWhenEmptyrenders nothing (assertcontainerhas no attention heading); withhideWhenEmptyfalse, renders "Nothing needs your attention." - A
successRate: nullresponse renders "—", and the test explicitly asserts the absence of "0%". - Changing the repository selector writes
?repository=owner/repointo the URL and triggers a refetch in every section.
Browser layout tests (propr-ui/e2e/dashboard-responsive.pw.ts)
- At 320px, 390px, 1024px, and 1440px: no horizontal document overflow.
- At 320px and 390px: DOM order is summary strip, attention, happening now, recent outcomes, historical stats.
- At 1440px: happening now and recent outcomes are in the wide column; attention and stats are in the narrow column; with zero attention items the attention heading is absent.
- With an outcome lacking a score, no empty score column is reserved on mobile.
- Long titles wrap to at most two lines without being truncated, while secondary metadata is hidden first.
Implementation Specification
- Backend tests use the in-memory
better-sqlite3harness pattern frompackages/core/test/planNotificationActionsMigration.test.tsand the route-handler-invocation pattern frompackages/api/test/visualPreviewLogRedaction.test.ts. - Frontend unit tests mock
../api/dashboardApiand../contexts/SocketContextin the same shape used byTaskList.test.tsxandLiveFileChips.test.tsx, capturing the registeredonTaskUpdatecallback so it can be invoked directly. - Playwright tests stub
**/api/**and close**/socket.io/**, followinginbox-dismissal.pw.tsandpreview-media.pw.ts. Screenshots are captured only whenPROPR_CAPTURE_PREVIEWSis set, matching existing conventions.
Acceptance Criteria
- All listed backend, unit, and Playwright tests exist and pass.
- The burst test asserts an exact call count, not a range.
- The idle-versus-unavailable test asserts both strings and their inequality.
- The empty-attention desktop test asserts DOM absence, not a CSS class.
- The null-success-rate test asserts the absence of
0%. - Playwright tests run without a backend, Redis, credentials, or network access.
Created by ProPR AI Planner
Activity
propr-dev commentedon Sep 23, 2026
Suggested Implementation:
Implementation Approach
The tests are split across three layers because the requirements themselves live at three layers, and testing them in the wrong layer produces weak coverage.
Data-derivation rules — attention independence from notifications, recovery exclusion, success-rate denominators — are database semantics. Testing them through the UI would require an enormous amount of mocking and would still not prove the SQL is right. These go in backend tests against a real in-memory SQLite database, following the pattern already established in
planNotificationActionsMigration.test.ts.Live-update behaviour — burst coalescing, stable ordering, idle-versus-unavailable — is component state management. These need React rendering with a controllable socket, which is exactly what
TaskList.test.tsxandLiveFileChips.test.tsxalready do by capturing the registered callback and invoking it directly.Layout and overflow behaviour cannot be verified without a real layout engine.
getBoundingClientRectin jsdom returns zeros, so a unit test asserting "no horizontal overflow" is meaningless. These go in Playwright, following the established fixture pattern of stubbing**/api/**and closing the socket so the suite needs no backend.One deliberate choice throughout: assertions are exact rather than loose. The burst test asserts
toHaveBeenCalledTimes(1), nottoBeLessThan(10), because a regression from 1 to 3 calls is a real defect that a loose bound would hide. Likewise the idle-versus-unavailable test asserts both strings and their inequality, because two states that happen to render the same text would otherwise pass.File:
packages/api/test/dashboardRoutes.test.ts(new file)Why this file: The attention-derivation rules are the highest-risk part of the feature, because implementing them against
notification_user_stateswould be easier and would pass any UI-level test. Only a database-level test can prove the dashboard reads from task state instead.File:
propr-ui/src/components/Dashboard.test.tsx(new file)Why this file: Burst coalescing, stable ordering, and the idle-versus-unavailable distinction are all component state behaviours. They need real React rendering with a socket the test can drive, which is exactly the shape
TaskList.test.tsxandLiveFileChips.test.tsxalready use.File:
propr-ui/e2e/dashboard-responsive.pw.ts(new file)Why this file: Overflow, DOM ordering across breakpoints, and "no empty score column" are all layout facts. jsdom cannot measure them —
getBoundingClientRectreturns zeros — so these must run in a real browser. The fixture followsinbox-dismissal.pw.tsexactly: stub**/api/**, close the socket, and need no backend.propr-dev commentedon Sep 23, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-52480/claude-opus-5-add-dashboard-behaviour-t-20260923-1511-nkh2478-epic-dashboard-data-2kiissue-2480-20260923-1511-claude-opus-5-nkh🔍 Track Task Execution
All checks pass. Here's what I implemented for issue #2480.
All checks pass. Here's what I implemented for issue #2480.