Skip to content

perf(dashboard): build sidebar bucket counts without cards - #17497

Merged
nwparker merged 4 commits into
mainfrom
perf-dashboard-bucket-counts
Aug 31, 2026
Merged

nwparker merged 4 commits into
mainfrom
perf-dashboard-bucket-counts

Conversation

@nwparker

@nwparker nwparker commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​186 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​165
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​187 $\color{#cf222e}{\Huge{\mathbf{−}}}$​56 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​131

Summary

  • add a count-only dashboard projection for the always-mounted sidebar entry
  • reuse indexed worktree/agent row derivation so folder, remote, retained, stale, and title-derived semantics stay aligned
  • avoid allocating dashboard cards, host metadata, filter options, and terminal preview inputs for count updates

Validation

  • pnpm test src/renderer/src/components/dashboard/build-dashboard-snapshot-folder-workspace.test.ts src/renderer/src/components/dashboard/useAgentBucketCounts.test.tsx src/renderer/src/components/dashboard/build-dashboard-snapshot.test.ts
  • pnpm tc:web
  • pnpm run check:code-quality:changed
  • pnpm exec oxfmt --check (changed files)

ELI5

The sidebar only needs four totals, but it used to build a complete dashboard card for every agent and then throw those cards away. The count projection now walks the same rows and updates four counters, so the sidebar gets identical counts without creating card details.

Performance Measurement

The committed mixed local/remote parity fixture contains two top-level agent rows and verifies that both projections produce identical bucket totals:

  • Before: 2 DashboardCard records plus the per-row presentation projection (labels, conversation fields, and card metadata).
  • After: 0 DashboardCard records; one four-field counts record is returned.
  • Improvement: 2 fewer dashboard-card allocations, a 100% reduction in discarded card records for the committed fixture.

The committed fixture is intentionally small; it measures the production allocation boundary rather than pretending to be a large-app benchmark. The same per-row construction means a 1,024-row input would avoid 1,024 discarded card records, but both paths remain O(rows) and bucket classification is unchanged.

Run the focused projection/parity coverage with:

pnpm test src/renderer/src/components/dashboard/build-dashboard-snapshot-folder-workspace.test.ts src/renderer/src/components/dashboard/useAgentBucketCounts.test.tsx src/renderer/src/components/dashboard/build-dashboard-snapshot.test.ts --run

User-Facing Trade-offs

None. Bucket classification, local/remote/folder/structured-tab parity, title-derived rows, and ACK/unseen behavior are preserved. Unrelated store writes still do not recompute counts; unified agent-session tab changes now refresh them for correctness.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR replaces sidebar card construction with a count-only dashboard projection while preserving shared row and bucket semantics.

  • Adds a bucket-count builder that avoids allocating dashboard cards and presentation metadata.
  • Extracts shared orchestration selection and row-to-bucket projection logic.
  • Includes unified agent-session tabs in sidebar and popout snapshot updates.
  • Adds parity coverage for local, remote, folder, title-derived, and structured-session rows.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/renderer/src/components/dashboard/build-dashboard-bucket-counts.ts Adds the count-only projection using the same workspace, row, orchestration, and bucket derivation used by dashboard snapshots.
src/renderer/src/components/dashboard/dashboard-row-bucket.ts Centralizes title-derived, unseen, monitoring, dot-state, and bucket classification semantics.
src/renderer/src/components/dashboard/dashboard-orchestration-selection.ts Extracts the existing singleton-versus-batched orchestration selection for reuse by both projections.
src/renderer/src/components/dashboard/build-dashboard-snapshot.ts Reuses the extracted orchestration and bucket projections and accepts unified agent-session tabs.
src/renderer/src/components/dashboard/useAgentBucketCounts.ts Switches sidebar totals to the count-only builder and updates the previously stale documentation.
src/renderer/src/components/dashboard/useDashboardPopoutBridge.ts Republishes snapshots when unified agent-session tab topology changes.
src/renderer/src/components/dashboard/useLiveDashboardSnapshot.ts Subscribes the live snapshot builder to unified agent-session tab changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    S[Renderer store state] --> W[Collect active workspaces]
    W --> O[Select orchestration]
    O --> R[Build agent rows]
    R --> P[Shared bucket projection]
    P --> C[Sidebar bucket counts]
    P --> D[Dashboard cards]
Loading

Reviews (4): Last reviewed commit: "refactor(dashboard): share bucket projec..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR centralizes dashboard orchestration selection and row bucket projection. buildDashboardBucketCounts and buildDashboardSnapshot use the shared helpers. unifiedTabsByWorktree now contributes to snapshot construction, memoization, and popout change detection. useAgentBucketCounts calls the bucket count builder directly. Tests cover mixed workspaces, unified-tab-only sessions, direct bucket results, and snapshot input changes.

Merge Risk: 🔴 Critical · up to 99e15

The sidebar count implementation currently does not compile because two required selector imports are missing, so the PR is not merge-ready until those imports are restored.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation, rationale, validation, performance impact, and trade-offs, but it omits required template sections. It does not include a Linked Issue, Visual Proof or the… Add the missing required sections. Include a linked issue after “Fixes #”, provide before-and-after visual proof or write exactly “N/A” with a reason, complete the Testing checklist, and address AI disclosure, Review, Agent skill upstream b…
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: generating dashboard sidebar bucket counts without building dashboard cards.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the implementation, rationale, validation, performance impact, and trade-offs, but it omits required template sections. It does not include a Linked Issue, Visual Proof or the required N/A explanation, Testing checklist, AI Disclosure, Review, Agent skill upstream boundary, Notes, or Checklist.

Resolution

Add the missing required sections. Include a linked issue after “Fixes #”, provide before-and-after visual proof or write exactly “N/A” with a reason, complete the Testing checklist, and address AI disclosure, Review, Agent skill upstream boundary, Notes, and Checklist items.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one maintainability suggestion inline.

Reviewed changes

This PR adds a count-only projection for the always-mounted sidebar dashboard entry, replacing the full buildDashboardSnapshot(…, { includeCardDetails: false, includeFilterOptions: false }) call with buildDashboardBucketCounts.

  • New count-only builder — buildDashboardBucketCounts reuses the shared worktree/agent row machinery (buildWorktreeAgentRows, applyAgentRowLineage, the indexed selectors, and the orchestration batch/singleton selection) to derive per-state bucket counts without allocating cards, host metadata, filter options, or terminal-preview inputs.
  • Hook wiring — useAgentBucketCounts now calls the new builder with the same input slice (settings: null retained).
  • Tests — a new alignment test pins buildDashboardBucketCounts output to the bucket totals of a full snapshot across local/remote/folder workspaces including a title-derived card; the hook test now mocks the new builder.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor test-coverage suggestion inline.

Reviewed changes

  • Threaded unifiedTabsByWorktree into the count-only sidebar projection (useAgentBucketCounts) and the in-window board (useLiveDashboardSnapshot), and added it to the pop-out republish gate, so done structured sessions whose tab exists only in unified tabs are attributed to their worktree and counted.
  • Added unifiedTabsByWorktree to DashboardSnapshotState so the shared builder type documents the new input.
  • Added a parity test for a done structured session present only in unified tabs, and a republish test for unified agent-session tab changes.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2ece246b-c084-490d-9bcd-ed165012f2fa

📥 Commits

Reviewing files that changed from the base of the PR and between adcecd7 and 99e15bd.

📒 Files selected for processing (10)
  • src/renderer/src/components/dashboard/build-dashboard-bucket-counts.ts
  • src/renderer/src/components/dashboard/build-dashboard-snapshot-folder-workspace.test.ts
  • src/renderer/src/components/dashboard/build-dashboard-snapshot.ts
  • src/renderer/src/components/dashboard/dashboard-orchestration-selection.ts
  • src/renderer/src/components/dashboard/dashboard-row-bucket.ts
  • src/renderer/src/components/dashboard/useAgentBucketCounts.test.tsx
  • src/renderer/src/components/dashboard/useAgentBucketCounts.ts
  • src/renderer/src/components/dashboard/useDashboardPopoutBridge.test.tsx
  • src/renderer/src/components/dashboard/useDashboardPopoutBridge.ts
  • src/renderer/src/components/dashboard/useLiveDashboardSnapshot.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Since the prior Pullfrog review (7e128dc), this delta removes the duplicated bucket and orchestration derivation that both builders carried:

  • Shared row bucket projection — new dashboardRowBucketProjection (dashboard-row-bucket.ts) computes isTitleDerived, dotState, workingMode, unseen, and bucket once; both buildDashboardSnapshot and buildDashboardBucketCounts now call it.
  • Shared orchestration selection — new selectDashboardOrchestration (dashboard-orchestration-selection.ts) encapsulates the singleton-vs-batch orchestration block previously copy-pasted into both builders.
  • Test pin for unified-tab forwarding — useAgentBucketCounts.test.tsx now asserts the count builder receives unifiedTabsByWorktree, closing the gap flagged in the prior review.

Both prior suggestions are addressed, and the focused dashboard suites pass (52 tests across 4 files).

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit ad5ba25 into main Aug 31, 2026
27 of 29 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…17497)

* perf(dashboard): build sidebar bucket counts without cards

* fix dashboard bucket parity for unified agent tabs

* docs(dashboard): clarify count projection comment

* refactor(dashboard): share bucket projection derivation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant