Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the spend limit has been reached. To enable Bugbot Autofix, raise your spend limit in the Cursor dashboard.
| start_date=start_date, | ||
| end_date=end_date, | ||
| ), | ||
| ) |
There was a problem hiding this comment.
Duplicated snapshot-building logic across two functions
Low Severity
_build_period_snapshot and _build_team_snapshot have nearly identical bodies — both call the same four service functions (get_overview, get_productivity_metrics, get_quality_metrics, get_maturity_analytics) and construct a CompareSnapshot with the exact same field mappings. The only difference is how label is determined. If the snapshot field mappings ever need to change, both functions must be updated in lockstep, risking inconsistent bug fixes.


Summary
Testing
Note
Medium Risk
Introduces a new analytics endpoint and aggregation service that combines multiple metric sources and enforces role-based access, which could affect correctness/performance and authorization boundaries.
Overview
Adds a new Compare experience that lets leadership users compare teams, engineers, projects, or time periods side-by-side, including headline deltas and top workflow mix.
Implements
GET /api/v1/analytics/comparewith newCompareResponseschemas/types and acompare_servicethat builds snapshots from existing overview/productivity/quality/maturity/workspace data, computes deltas, and derives top workflows from workflow profiles; access is restricted (engineers blocked; team leads limited to their team and cannot do team-vs-team).Wires the new page into the frontend router/sidebar, adds
useCompareAnalytics, and includes frontend + backend tests for the new modes and authorization behavior.Written by Cursor Bugbot for commit 73b0e77. This will update automatically on new commits. Configure here.