refactor(backend): extract easy duplicated helpers - #2806
Conversation
Deduplicate generateDateLabels, chart dataset builders, effective API key resolution, and channel GET camelCase mapping across public/private routes. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 16 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: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (12)
Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
Knip flagged createDatasetsByName as a duplicate export of createPercentageDatasetsByName; keep one export and alias only in tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|





Summary (AI generated)
generateDateLabelsintoutils/stats_date_range.ts(was copied in 4 stats handlers)utils/version_stats_helpers.ts(createPercentageDatasetsByName/createDatasetsByName)getEffectiveApikey/requireEffectiveApikeyintoutils/effective_apikey.tsmapChannelRowToPublicMotivation (AI generated)
These were clear, low-risk copy-paste clusters from a duplication audit. Factorizing them reduces drift (especially chart/date labeling) without touching hot plugin paths or intentional plugin-folder duplication.
Business Impact (AI generated)
No user-facing behavior change. Lower maintenance cost and fewer places to fix when stats charts or channel API shape evolve.
Test Plan (AI generated)
bunx vitest run tests/channel-stats.unit.test.ts tests/bundle-usage.unit.test.ts tests/update-delivery-stats.unit.test.ts tests/native-observe-stats.unit.test.ts(38 passed)bun lint:backendGenerated with AI
Made with Cursor