feat(workspace): backend dashboard read model#555
Closed
david-engelmann wants to merge 1 commit into
Closed
Conversation
Add a typed `load_dashboard_snapshot` command that groups workspaces into kanban lanes (in-progress / review / done / backlog / canceled / archived) with a live `isStreaming` overlay, so the upcoming dashboard view (dohooo#482) can render cards without rewriting the sidebar's aggregate queries. Reuses `load_workspace_records` + `load_archived_workspace_records` so the dashboard never disagrees with the sidebar about a row's status / PR metadata / message counts. Six lanes always returned in stable display order — the frontend renders columns in iteration order and never needs to sort. Empty lanes ship as empty `cards` arrays so the dashboard can paint placeholders consistently. `isStreaming` is computed from a single `ActiveStreams::snapshot_for_ui` call per request; the bridge handler also invalidates the `dashboardSnapshot` query on `ActiveStreamsChanged` so the busy badge stays live without polling. Explicitly out of scope for this slice: - Dashboard UI rendering (Track E / PR E2). - Git change-line counts per workspace (those come from the heavy `workspace_action_status` path — defer to per-card lazy fetches). - Project filtering server-side — the frontend already has every card's repoId, filtering is a one-liner there. - No drag-and-drop, no status mutation, no new task-management state. Tests: - 4 Rust unit tests covering empty-board lane shape, status-driven bucketing with archived-lane split, streaming overlay (with the orphan-workspace-id defensive case), and the kebab-case wire format for `DashboardLaneId`. Closes dohooo#482 (the backend slice — UI is the next PR in track E).
|
@david-engelmann is attempting to deploy a commit to the Caspian's Team Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
@david-engelmann I feel like if this only includes the backend changes, then it shouldn't close the issue yet |
Contributor
Author
|
@taroj1205 meant to open as a draft in my fork, sorry about that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
load_dashboard_snapshotcommand that groups workspaces into kanban lanes (in-progress / review / done / backlog / canceled / archived) with a liveisStreamingoverlay per card.load_workspace_records+load_archived_workspace_recordsqueries the sidebar already runs, so the dashboard never disagrees with the sidebar about a row's status / PR metadata / message counts.workspace::dashboardmodule +DashboardSnapshot/DashboardLane/DashboardCard/DashboardLaneIdtypes, mirrored on the frontend insrc/lib/api.ts.dashboardSnapshotquery onWorkspaceListChanged/WorkspaceChanged/ActiveStreamsChangedso the dashboard stays in lockstep with the sidebar.Why
Closes #482 (backend slice — UI is the next PR in this track). The issue asks for a kanban view that groups existing workspaces by status; the data already exists on the workspace row, this PR just exposes it in the shape a dashboard card grid wants.
Scope boundary
Included:
workspace::dashboardmodule +build_dashboard_snapshot/assemble_snapshot(the second is a pure shaping helper so tests don't need to spin up the DB pool).DashboardLaneIdkebab-case enum mirroringWorkspaceStatusplus anArchivedlane; six lanes always returned in stable display order so the frontend renders columns in iteration order.DashboardCardflattensWorkspaceSummaryand addsisStreaming: boolfromActiveStreams::snapshot_for_ui. Frontend never has to cross-referencelistActiveStreamsfor the busy badge.load_dashboard_snapshotTauri command +loadDashboardSnapshotTS wrapper +dashboardSnapshotQueryOptionsfactory.ActiveStreamsChangedso the streaming overlay stays live.Deferred (intentionally out of scope):
workspace_action_statuspath (one git subprocess per workspace). Better to fetch lazily per card on hover or per visible card.repoId, so the filter is a one-liner on the frontend.Test plan
cd src-tauri && cargo nextest run— 1158 / 1158 pass (4 new dashboard tests).cd src-tauri && cargo test --doc— clean.cd src-tauri && cargo fmt --all -- --check— clean.bun run lint— biome + clippy-D warningsclean.bun run typecheck— clean (newDashboardSnapshot/DashboardLane/DashboardCard/DashboardLaneIdTS types).bun run test:frontend— 1113 / 1113 pass (existing tests unchanged; new query options + bridge handler additions are tree-shaken from non-dashboard surfaces).Coverage added
New tests:
workspace::dashboard::tests::snapshot_always_returns_all_six_lanes_in_stable_orderworkspace::dashboard::tests::workspaces_are_grouped_by_status_and_archived_split_into_own_laneworkspace::dashboard::tests::is_streaming_overlays_active_workspaces_onlyworkspace::dashboard::tests::lane_id_kebab_case_serialization_matches_workspace_statusThe streaming test deliberately includes a defensive case for the rare boot race where an
ActiveStreamSummaryhasworkspace_id: None— the snapshot should treat those entries as unmatched rather than panic on.unwrap().Follow-up
This is PR E1 in the dashboard track. E2 wires the actual UI: a route, a card grid using
dashboardSnapshotQueryOptions, and a project filter chip set powered byrepoIdon each card.