feature: local-usage-stats (4/4) - #1134
Conversation
|
Important Review skippedToo many files! This PR contains 186 files, which is 36 over the limit of 150. To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (186)
You can disable this status message by setting the 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. Comment |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
f398395 to
2fe7eb2
Compare
307a751 to
6ba1f75
Compare
66c6878 to
79d9135
Compare
…cit-any Add new test file to eslint-suppressions.json with count of 26 no-explicit-any suppressions. These are standard test patterns (mock objects, private property access via 'as any') consistent with other test files in the suppressions list. Fixes CI lint failure in PR #25 compile (lint) job.
…d height With only maxHeight set, the Virtuoso scroller's height:100% resolves against an auto-height parent, collapses to 0px, and deadlocks (zero viewport -> zero rendered items -> zero content height), so the Tasks header showed a count but no rows ever rendered. Drive an explicit height from totalListHeightChanged (capped at 400px) and bootstrap measurement with initialItemCount clamped to the task count (a larger fixed value crashes itemContent with undefined items). Adds Playwright CT regression tests (jsdom mocks Virtuoso and cannot catch this) and switches the dashboard i18n imports to the @src spelling so the CT harness can stub the TranslationContext.
Clicking the active range preset re-armed the resyncing banner without triggering a resubscription, so no snapshot ever arrived to clear it and the indicator spun forever (e.g. on double-click). Gate the banner on an actual preset change and clear it on the custom-range early return.
…ubtasks The Tasks list paged every History task, so subtasks appeared as sibling rows even though each parent row already aggregates its whole subtree (double-counted visually, detached from the summary cards). - Catalog pages root tasks only; bounded-range membership is subtree-based (a root is listed when the root or any descendant was created in range), orphans promote to roots. - DashboardTaskSummary gains childTaskIds; DashboardTaskPage gains childTasks carrying direct children of the page's roots. - Reducer keeps childTasks/subtask upserts out of the visible root order while storing them in the normalized map. - TaskList renders roots; expanding a root with subtasks shows an indented subtask list, and each subtask toggles its own API-call detail. Childless roots expand directly into their detail. - Adds Playwright CT coverage for the expand interaction (jsdom mocks react-virtuoso and cannot exercise it).
The root-only task page reads childrenByParentId for childTasks; the handler/routing specs' catalog stubs predated that index.
79d9135 to
5d25477
Compare
… coverage - Add coverage tests for UsageStatsService, UsageStatsStreamCoordinator, UsageStatsMigration, UsageStatsProjection, DashboardTaskProjection, UsageAggregator, costRecalculation, and UsageRecorder. - Add new safeWriteJson spec to cover rollback and failure paths. - Add dashboard webview tests for TaskList, AnimatedNumber, SessionDetail, dashboardStreamReducer, and useDashboardStatsStream edge cases. - Fix vscode mock so RelativePattern is constructible for file watcher tests.
- playwright-ct.config.ts: alias '@/i18n/TranslationContext' to the CT mock. DashboardSummary and UsageHeatmap import useAppTranslation via '@/i18n/...' which bypassed the existing '@src/i18n/...' alias, pulling the real TranslationContext -> ExtensionStateContext -> @roo-code/types barrel (zod) into the CT bundle and throwing 'ReferenceError: z is not defined' at mount. Fixes all 3 webview visual snapshot failures (bundle error, not pixel mismatch). - useDashboardStatsStream.spec.tsx: add coverage for the 10s loading timeout ERROR dispatch and the requestTaskPage no-cursor guard to close the patch-coverage shortfall.
…compatibility Root cause: DashboardSummary and UsageHeatmap components use StandardTooltip which requires a Radix TooltipProvider in the component tree. Playwright CT mounts components without the app's provider hierarchy, causing silent render failures (elements not found). Additionally, the ProviderBreakdownFixture was defined inline in the test file, which Playwright CT cannot mount (requires test story or external fixture). Fix: Extract all fixtures into StatsPanel.visual.fixture.tsx with proper TranslationContext.Provider and TooltipProvider wrappers. Run: https://github.com/Zoo-Code-Org/Zoo-Code/actions/runs/31237627413
…ov coverage gap - Move data-testid in ProviderBreakdownFixture from outer div to table (Playwright CT cannot find data-testid on root-level mount element) - Add CI-generated baseline screenshots for StatsPanel visual tests - Add 5 coverage tests for handleRebuildUsageStats and handleGetDashboardTaskDetail error branches (79.86% -> 80%+)
Stack Position
feature/local-usage-statsDescription
https://www.youtube.com/shorts/UHnnOCM1_f0
Full Feature Description
feature/local-usage-statsusage-stats.ts,src/services/stats, the provider/task capture pathsTask.ts, the stats IPCusageStatsMessageHandler.ts, and the UIDashboardView.tsxanduseDashboardStatsStream.ts.Why Split Into 17 PRs
Instead of submitting this feature as a single unified PR, it was split into individual PRs because as code size grows, safely reviewing a PR becomes very difficult. The feature was broken into mutually exclusive individual PRs so that each can be reviewed independently.
What This PR Specifically Changes
Adds SQLite projection, transactional/idempotent migration, local-day rollup, rebuild/query/stream IPC, epoch guard, dashboard summary/session/heatmap/loading/retry UI, and visual coverage. Removes other feature files.
Included Files
src/services/stats/UsageStatsDatabase.tssrc/services/stats/UsageStatsMigration.tssrc/services/stats/UsageStatsProjection.tssrc/services/stats/UsageStatsStreamCoordinator.tssrc/core/webview/usageStatsMessageHandler.tswebview-ui/src/components/dashboard/DashboardView.tsxwebview-ui/src/components/dashboard/useDashboardStatsStream.tswebview-ui/src/components/dashboard/DashboardView.visual.tsxExclusion Scope