feat: git metrics on /v1/metric-results + metric-view refinements - #191
Conversation
Cut the git metrics family over to the unified /v1/metric-results path, mirroring the AI family: git_output renders from server-owned metadata and the git-specific legacy rendering is removed. Git family: - Add median computation and the histogram view to the wire vocabulary, normalization, MSW factory, and fixtures. - Flip git_output to a MetricGroup (git.* metrics with per-metric views); move the prs_merged KPI tile onto git.prs_merged. - Remove the git-specific legacy rendering: registry ids, member/dept-dist queries and their mock handlers, the drilldown-extras branch, the order/description/partition entries, and the orphaned v2 LOC chart. The v1 dashboard, team modal, catalog, and mocks keep their git entries. Metric views (generic, shared with the AI family): - Distributions: shade histogram bars by each range's side of the peer median (per metric direction), intensity by distance from it; headline is the entity's own median, with the peer median as the pivot line. Grouped in one "Distributions" card. - Fold each dimension breakdown into its trend legend (per-part total and share) and drop the standalone breakdown block; keep the renderer. - Combine commits and PRs merged into one trend; label a lone dimensionless series by its metric and hide a one-series legend. - Round composition shares with the largest-remainder method so a legend always sums to 100. - Drop keepPreviousData so a period change shows a spinner instead of dimmed stale data; disable focus and reconnect refetches; metric KPI tiles and drilldowns render a spinner while loading. - Let a lone chart span the full width; centralize status fill colors and the value-vs-median scoring helper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Aleksandr Barkhatov <pm@aleks.bar>
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR migrates git-related metrics from legacy batch endpoints to the unified metric system, adding histogram and median result types, a new MetricHistogram widget, and Distributions drilldown rendering. It removes legacy git_output LOC handling, updates legend percentage-share formatting across MetricBreakdown/MetricTrend, adds a PeerStory multiplier gap format, and separately disables query refetch-on-reconnect and placeholder-data caching. ChangesGit-metrics migration to unified histogram/median metric system
Legend percentage-share and gap-formatting UI polish
Estimated code review effort: 4 (Complex) | ~75 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/queries/metric-results.ts (1)
116-120: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueTrim the
keepPreviousDatawording in the page-dim comment. Metric queries now goisPendingon period changes, soisFetching && !isPendingonly describes revalidation/background refetches here; the old “show old values while new ones load” phrasing is stale.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/queries/metric-results.ts` around lines 116 - 120, The comment around the metric delta handling in metric-results.ts still refers to keepPreviousData-style behavior that no longer applies. Update the explanatory comment near previousUsable/hasPrevious to remove the stale “show old values while new ones load” wording and instead describe that metric queries become isPending on period changes, so isFetching && !isPending only covers revalidation/background refetches in this path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/queries/metric-results.ts`:
- Around line 116-120: The comment around the metric delta handling in
metric-results.ts still refers to keepPreviousData-style behavior that no longer
applies. Update the explanatory comment near previousUsable/hasPrevious to
remove the stale “show old values while new ones load” wording and instead
describe that metric queries become isPending on period changes, so isFetching
&& !isPending only covers revalidation/background refetches in this path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6c964a9c-c661-4587-addd-031a3d877c66
📒 Files selected for processing (37)
src/api/metric-registry.tssrc/api/metric-results-client.tssrc/components/ui/chart.tsxsrc/components/widgets/metric-views/collection-drilldown.test.tsxsrc/components/widgets/metric-views/collection-drilldown.tsxsrc/components/widgets/metric-views/metric-breakdown.test.tsxsrc/components/widgets/metric-views/metric-breakdown.tsxsrc/components/widgets/metric-views/metric-histogram.test.tsxsrc/components/widgets/metric-views/metric-histogram.tsxsrc/components/widgets/metric-views/metric-trend.test.tsxsrc/components/widgets/metric-views/metric-trend.tsxsrc/components/widgets/metric-views/peer-story.test.tsxsrc/components/widgets/metric-views/peer-story.tsxsrc/components/widgets/v2/group-drilldown-sheet.tsxsrc/components/widgets/v2/kpi-tile.test.tsxsrc/components/widgets/v2/kpi-tile.tsxsrc/components/widgets/v2/loc-stacked-bar.tsxsrc/lib/insight/groups.test.tssrc/lib/insight/groups.tssrc/lib/insight/kpi-row.test.tssrc/lib/insight/kpi-row.tssrc/lib/insight/v2/bullet-defs.tssrc/lib/insight/v2/metric-order.tssrc/lib/insight/v2/partition.tssrc/lib/metrics/collection.test.tssrc/lib/metrics/collection.tssrc/lib/metrics/shares.test.tssrc/lib/metrics/shares.tssrc/lib/status.tssrc/mocks/handlers.tssrc/mocks/metric-results-factory.tssrc/mocks/metric-results-fixtures.tssrc/queries/metric-results.tssrc/queries/v2/ic-extras.tssrc/queries/v2/team-extras.tssrc/query-client.tssrc/screens/ic-dashboard/engineering-dashboard-v2.tsx
💤 Files with no reviewable changes (8)
- src/lib/insight/v2/partition.ts
- src/queries/v2/team-extras.ts
- src/components/widgets/v2/group-drilldown-sheet.tsx
- src/api/metric-registry.ts
- src/components/widgets/v2/loc-stacked-bar.tsx
- src/lib/insight/v2/metric-order.ts
- src/lib/insight/v2/bullet-defs.ts
- src/mocks/handlers.ts
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Aleksandr Barkhatov <pm@aleks.bar>
Git metrics cut over to
/v1/metric-results(mirrors the AI family), plus generic metric-view refinements.Git family
git_output→ metrics group; metadata server-owned.prs_mergedKPI →git.prs_merged.Metric views (generic — also benefit AI)
keepPreviousDatadropped → a period change shows a spinner, not dimmed stale data; focus/reconnect refetch disabled.Checks:
tsc+ eslint clean; unit 261 + storybook 3 green. Adversarial review (Codex + CodeRabbit) — no critical/high; findings fixed.Closes constructorfabric/insight#1702
🤖 Generated with Claude Code