Skip to content

feat(admin): add global notification stats tab - #2847

Open
riderx wants to merge 2 commits into
mainfrom
feat/admin-notification-stats
Open

feat(admin): add global notification stats tab#2847
riderx wants to merge 2 commits into
mainfrom
feat/admin-notification-stats

Conversation

@riderx

@riderx riderx commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary (AI generated)

  • Persist daily native push metrics on global_stats (apps using notifications, providers, campaigns, sent/received/opened/failed)
  • Add native_notifications global-stats shard that aggregates Postgres control-plane counts + Cloudflare Analytics Engine delivery events
  • Add admin dashboard Notifications tab with KPI cards and trend charts

Motivation (AI generated)

Platform admins needed visibility into Capgo native notifications adoption and send volume. Delivery events live in Cloudflare AE and were not snapshotted for historical admin trends.

Business Impact (AI generated)

Makes notification product growth measurable in the admin console (apps onboarded, send volume, open/fail rates over time), supporting retention and packaging decisions.

Test Plan (AI generated)

  • Unit test for buildGlobalNotificationStatsQuery day window
  • Migration applied via bun run supabase:db:reset
  • Open /admin/dashboard/notifications/ as platform admin and confirm KPI/charts load
  • Confirm global_stats columns populate after native_notifications shard runs
  • Confirm older dates without the shard still show other admin tabs (shard is optional, not required)

Generated with AI

Made with Cursor

Review in cubic

Store daily native push adoption and delivery counters in global_stats via a new native_notifications shard, and expose them in the admin dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d1aa50dc-9ade-40f1-bb7a-953cc0126dd0

📥 Commits

Reviewing files that changed from the base of the PR and between 0261dae and f735c25.

📒 Files selected for processing (12)
  • messages/en.json
  • src/constants/adminTabs.ts
  • src/pages/admin/dashboard/notifications.vue
  • src/types/supabase.types.ts
  • supabase/functions/_backend/triggers/logsnag_insights.ts
  • supabase/functions/_backend/utils/global_stats.ts
  • supabase/functions/_backend/utils/nativeNotifications.ts
  • supabase/functions/_backend/utils/pg.ts
  • supabase/functions/_backend/utils/supabase.types.ts
  • supabase/functions/triggers/index.ts
  • supabase/migrations/20260804074056_global_stats_notification_metrics.sql
  • tests/native-notifications-ae.unit.test.ts

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

@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_989404ec-0a28-45f1-9850-801f81063f1a)

@codspeed-hq

codspeed-hq Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing feat/admin-notification-stats (7792d2f) with main (3d4f65d)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 12 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread supabase/functions/_backend/triggers/logsnag_insights.ts
Comment thread src/pages/admin/dashboard/notifications.vue
Comment thread src/pages/admin/dashboard/notifications.vue
Fail the native_notifications shard when Cloudflare AE is unavailable instead of persisting false zeros, and align the admin tab with sibling isAdmin/defaultBack guards.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_523f240a-f9ef-42a0-82e6-31d36799e5ed)

@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

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