Skip to content

feat(admin): channel surfing adoption dashboard - #3005

Merged
riderx merged 11 commits into
mainfrom
feat/admin-channel-surfing-dashboard
Aug 12, 2026
Merged

feat(admin): channel surfing adoption dashboard#3005
riderx merged 11 commits into
mainfrom
feat/admin-channel-surfing-dashboard

Conversation

@riderx

@riderx riderx commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary (AI generated)

  • Confirmed mobile setChannel is already logged via /channel_self (sendStatsAndDevice with action setChannel)
  • Added admin metric channel_surfing (Cloudflare app_log in prod, Postgres stats fallback locally)
  • New admin dashboard page with events / unique devices / unique apps, time trend, and top apps
  • Also log setChannel on successful override delete for older plugins (parity with set path)

Motivation (AI generated)

Need platform visibility into channel self-assignment (“channel surfing”) adoption: how many devices and apps use it, and how that evolves over time.

Business Impact (AI generated)

Helps Capgo measure feature adoption of device channel self-assignment and prioritize product/docs investment where usage is growing.

Visual changes (AI generated)

Channel surfing admin dashboard

Test Plan (AI generated)

  • Unit: bunx vitest run tests/channel-surfing.unit.test.ts tests/admin-stats.unit.test.ts
  • Full CI push suite green on 25f901e13
  • Local UI screenshot of /admin/dashboard/channel-surfing
  • Optional app filter narrows top apps / totals

Generated with AI

Summary by CodeRabbit

  • New Features
    • Added an admin Channel Surfing analytics dashboard.
    • View activity totals, daily trends, top apps, devices, events, and unique counts.
    • Filter analytics by date range and app, with refresh, loading, and empty states.
    • Added localized labels and navigation for the new dashboard.
  • Bug Fixes
    • Channel override deletions now record updated channel activity statistics.
  • Tests
    • Added coverage for analytics filtering, aggregation, fallback behavior, and error handling.

Surface setChannel stats (already emitted by channel_self) in a platform-admin
dashboard with events, devices, apps, trends, and top apps.

Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx
riderx deployed to deepsec-pr August 12, 2026 07:42 — with GitHub Actions Active
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 30 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: 4424b07f-f3df-4ec6-8305-012b8e413bc0

📥 Commits

Reviewing files that changed from the base of the PR and between 361e5d5 and 70a018b.

📒 Files selected for processing (3)
  • supabase/functions/_backend/plugin_runtime/plugins/channel_self.ts
  • supabase/functions/_backend/utils/channel_surfing.ts
  • tests/channel-surfing.unit.test.ts
📝 Walkthrough

Walkthrough

Adds channel-surfing event tracking, backend aggregation through Analytics Engine or PostgreSQL, admin statistics API support, and a localized dashboard with charts and tables.

Changes

Channel surfing analytics

Layer / File(s) Summary
Channel action tracking
supabase/functions/_backend/plugin_runtime/plugins/channel_self.ts
Successful override deletion now records a setChannel device statistic.
Analytics aggregation
supabase/functions/_backend/utils/channel_surfing.ts, tests/channel-surfing.unit.test.ts
Adds channel-surfing statistics retrieval through Analytics Engine or PostgreSQL, optional app filtering, aggregation, cleanup, error logging, fallback results, and unit coverage.
Admin statistics API wiring
src/stores/adminDashboard.ts, supabase/functions/_backend/private/admin_stats.ts, tests/admin-stats.unit.test.ts
Adds channel_surfing to the metric category and routes requests with the optional app_id.
Admin dashboard presentation
src/pages/admin/dashboard/channel-surfing.vue, src/constants/adminTabs.ts, src/route-map.d.ts, messages/en.json, messages/en.context.json
Adds the authorized dashboard page, navigation tab, generated route mappings, localized labels, summary metrics, trend charts, top-app charts, loading states, and empty states.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Admin as Admin dashboard
  participant API as admin_stats
  participant Stats as getAdminChannelSurfing
  participant Analytics as Analytics Engine
  participant DB as PostgreSQL

  Admin->>API: Request channel_surfing data
  API->>Stats: Pass date range and app_id
  Stats->>Analytics: Query aggregated statistics in workerd
  Stats->>DB: Query public.stats otherwise
  Stats-->>API: Return channel-surfing statistics
  API-->>Admin: Render metrics and charts
Loading

Possibly related PRs

  • Cap-go/capgo.app#2977: Adds a separate admin analytics dashboard using shared navigation, metric dispatch, localization, and dashboard patterns.

Suggested labels: codex

Suggested reviewers: wcaleniewolny

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: an admin dashboard for channel surfing adoption.
Description check ✅ Passed The description covers the summary, motivation, impact, visual changes, and test plan, with a screenshot and validation details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

@riderx

riderx commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Temporarily closing so push CI can run (push suite skips when an open PR covers the branch).

@riderx riderx closed this Aug 12, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx
riderx deployed to deepsec-pr August 12, 2026 08:02 — with GitHub Actions Active
@riderx

riderx commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Closing briefly so push CI can run the full suite (open PR causes push suite skip, and pull_request Run tests was not firing for this branch).

@riderx riderx closed this Aug 12, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx riderx reopened this Aug 12, 2026
@riderx
riderx marked this pull request as ready for review August 12, 2026 08:08
@riderx
riderx deployed to deepsec-pr August 12, 2026 08:08 — with GitHub Actions Active
@cursor
cursor Bot requested a review from WcaleNieWolny August 12, 2026 08:09

@cursor cursor 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.

Stale comment

Risk: medium. Left a non-blocking comment and did not approve — this exceeds the configured low-risk threshold (new admin adoption metrics plus a plugin channel_self logging change). Assigned a human reviewer; Cursor Bugbot was not present on this PR.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver External

Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx
riderx deployed to deepsec-pr August 12, 2026 08:17 — with GitHub Actions Active

@cursor cursor 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.

Stale comment

Risk: medium. Left a non-blocking comment and did not approve — this exceeds the configured low-risk threshold (new admin adoption metrics plus a plugin channel_self logging change). Human review is already requested; Cursor Bugbot was not present on this PR.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver External

@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.

Review completed against the latest diff

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

Re-trigger cubic

Comment thread src/pages/admin/dashboard/channel-surfing.vue
Comment thread src/pages/admin/dashboard/channel-surfing.vue
Comment thread messages/en.context.json Outdated
Comment thread messages/en.context.json Outdated
Comment thread tests/channel-surfing.unit.test.ts
Comment thread src/pages/admin/dashboard/channel-surfing.vue Outdated
Guard against stale fetches, fix DaisyUI spinner prefix on admin cards,
clarify i18n roles, and cover the Cloudflare analytics path in unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx
riderx deployed to deepsec-pr August 12, 2026 08:48 — with GitHub Actions Active
@riderx

riderx commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Closing briefly to run full push CI on review-fix commit (open PR skips push suite).

@riderx riderx closed this Aug 12, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor 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.

Risk: medium. Left a non-blocking comment and did not approve — this exceeds the configured low-risk threshold (new admin adoption metrics plus a plugin channel_self logging change). Human review is already requested; Cursor Bugbot was not present on this PR.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver External

@coderabbitai coderabbitai Bot added the codex label Aug 12, 2026
@riderx riderx reopened this Aug 12, 2026
@riderx
riderx deployed to deepsec-pr August 12, 2026 08:55 — with GitHub Actions Active

@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 4 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread src/pages/admin/dashboard/channel-surfing.vue
Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx

riderx commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Closing briefly for full CI on loader fix.

@riderx riderx closed this Aug 12, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx riderx reopened this Aug 12, 2026
@riderx
riderx deployed to deepsec-pr August 12, 2026 09:08 — with GitHub Actions Active
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

…rfing-dashboard

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

# Conflicts:
#	src/stores/adminDashboard.ts
#	supabase/functions/_backend/private/admin_stats.ts
#	tests/admin-stats.unit.test.ts
@riderx
riderx deployed to deepsec-pr August 12, 2026 09:50 — with GitHub Actions Active
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Visual diff passed

Visual changes

Generated at 2026-08-12T10:25:48.550Z. Threshold: 0.1% pixel difference.

Route Diff % Status
login 0.000 unchanged
dashboard 0.735 changed
apps 0.034 unchanged
app-overview 0.062 unchanged
app-settings 0.000 unchanged
app-settings-access 2.269 changed
channels 0.025 unchanged
devices 0.000 unchanged
observe 0.000 unchanged
observe-logs 0.000 unchanged
observe-native 0.000 unchanged
observe-compatibility 0.000 unchanged
observe-plugins 0.000 unchanged
api-keys-app-preview 2.211 changed

Commit: 70a018b0cc34b83169ae250cbcca72c606bb891c
Download the HTML report from workflow artifacts (artifact: visual-diff-report-70a018b0cc34b83169ae250cbcca72c606bb891c).

Open index.html from the artifact for side-by-side before/after/diff screenshots.

@codspeed-hq

codspeed-hq Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing feat/admin-channel-surfing-dashboard (70a018b) with main (ddfb4af)

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@supabase/functions/_backend/plugin_runtime/plugins/channel_self.ts`:
- Line 549: In the delete flow around sendStatsAndDevice, catch telemetry
failures after the override has been deleted and log them without propagating
the rejection. Preserve the existing BRES response, fields, and status code so a
successful deletion remains successful even when telemetry persistence fails.

In `@supabase/functions/_backend/utils/channel_surfing.ts`:
- Around line 193-195: Update the catch path in the channel-surfing helper to
propagate a typed error or return an explicit unavailable state instead of
emptyAdminChannelSurfingStats(), while preserving error logging; update
tests/channel-surfing.unit.test.ts lines 115-131 to assert the new unavailable
or error contract.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8102e87b-4384-469b-9811-a686e942fb7f

📥 Commits

Reviewing files that changed from the base of the PR and between 0a21200 and 361e5d5.

📒 Files selected for processing (12)
  • artifacts/channel-surfing-dashboard.webp
  • messages/en.context.json
  • messages/en.json
  • src/constants/adminTabs.ts
  • src/pages/admin/dashboard/channel-surfing.vue
  • src/route-map.d.ts
  • src/stores/adminDashboard.ts
  • supabase/functions/_backend/plugin_runtime/plugins/channel_self.ts
  • supabase/functions/_backend/private/admin_stats.ts
  • supabase/functions/_backend/utils/channel_surfing.ts
  • tests/admin-stats.unit.test.ts
  • tests/channel-surfing.unit.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Cap-go/capacitor-updater (manual)

Comment thread supabase/functions/_backend/plugin_runtime/plugins/channel_self.ts Outdated
Comment thread supabase/functions/_backend/utils/channel_surfing.ts Outdated
Telemetry must not flip a finished override delete into an error.
Analytics outages must not look like zero channel-surfing adoption.

Co-authored-by: Cursor <cursoragent@cursor.com>
@riderx
riderx deployed to deepsec-pr August 12, 2026 10:19 — with GitHub Actions Active
@sonarqubecloud

Copy link
Copy Markdown

@riderx
riderx merged commit 8bb98f5 into main Aug 12, 2026
133 of 135 checks passed
@riderx
riderx deleted the feat/admin-channel-surfing-dashboard branch August 12, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant