Skip to content

feat(admin): split reset pass revenue, 2-row KPIs - #3116

Merged
smakosh merged 1 commit into
mainfrom
admin-reset-pass-revenue-split
Jul 18, 2026
Merged

smakosh merged 1 commit into
mainfrom
admin-reset-pass-revenue-split

Conversation

@smakosh

@smakosh smakosh commented Jul 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Reset Passes on the admin dashboard revenue card: Reset Pass sales are now their own line in the Total Revenue breakdown (alongside Credits, DevPass, Chat plans, Pro subs). They were previously rolled into the DevPass split via DEV_PLAN_TX_TYPES; the DevPass split now covers subscription payments only (new DEV_PLAN_SUBSCRIPTION_TX_TYPES), so the splits stay disjoint and still sum to the gross revenue total — Reset Passes remain fully counted in total revenue.
  • New grossResetPassRevenue metric on GET /admin/metrics: sum of completed one-time dev_plan_reset_pass purchases on DevPass orgs (PaymentIntent purchases, no invoice, so no invoice dedup needed), gross like the other splits.
  • DevPass KPI cards in 2 rows: the six KPI cards on the admin DevPass page now render as a 3-column grid (2 rows) instead of stretching into a single 6-column row on wide screens.

Testing

  • Extended admin-metrics-gross-revenue.spec.ts with a Reset Pass purchase: asserts it lands in its own split, is excluded from the DevPass subscription split, and is included in the gross revenue sum.
  • turbo run build --filter=api --filter=admin passes; OpenAPI spec + admin typed client regenerated.

https://claude.ai/code/session_017Xbd48rpcVQWW2kx4vFiJ9

Summary by CodeRabbit

  • New Features
    • Added Reset Pass revenue as a separate component of gross revenue metrics.
    • Added a “Reset passes” line to the admin Total Revenue dashboard.
  • UI Improvements
    • Improved responsive layout for DevPass KPI cards across screen sizes.
  • Bug Fixes
    • Corrected gross revenue calculations to distinguish subscription revenue from one-time Reset Pass purchases.

Break Reset Pass sales out of the DevPass gross revenue split into
their own line on the admin dashboard total revenue card. They remain
counted in the gross revenue total; the DevPass split now covers
subscription payments only, so the splits stay disjoint and sum to the
total. Also lay out the DevPass KPI cards as a 2-row grid.

Claude-Session: https://claude.ai/code/session_017Xbd48rpcVQWW2kx4vFiJ9
@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9203e942-4f2b-4d9e-8ac6-05d68170c3f4

📥 Commits

Reviewing files that changed from the base of the PR and between 6eac67b and 05db702.

📒 Files selected for processing (5)
  • apps/api/src/routes/admin-metrics-gross-revenue.spec.ts
  • apps/api/src/routes/admin.ts
  • apps/api/src/utils/devpass-filter.ts
  • ee/admin/src/app/devpass/page.tsx
  • ee/admin/src/app/page.tsx

Walkthrough

Reset Pass transactions are separated from subscription DevPass revenue, aggregated as grossResetPassRevenue, included in total gross revenue, tested in admin metrics, and displayed in the admin dashboard. The DevPass KPI grid breakpoint layout is also adjusted.

Changes

Reset Pass Revenue Reporting

Layer / File(s) Summary
Revenue classification and API aggregation
apps/api/src/utils/devpass-filter.ts, apps/api/src/routes/admin.ts
Subscription DevPass transaction types exclude dev_plan_reset_pass; Reset Pass revenue is aggregated separately and returned as grossResetPassRevenue within total gross revenue.
Revenue split test coverage
apps/api/src/routes/admin-metrics-gross-revenue.spec.ts
Metrics fixtures and assertions verify separate Reset Pass revenue of 9 and combined gross revenue of 141.
Admin dashboard presentation
ee/admin/src/app/page.tsx, ee/admin/src/app/devpass/page.tsx
The total revenue ledger displays Reset Pass revenue, and the DevPass KPI grid uses revised responsive column breakpoints.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AdminMetrics as admin /metrics
  participant Database
  participant AdminDashboard as admin dashboard
  AdminMetrics->>Database: Aggregate subscription and Reset Pass transactions
  Database-->>AdminMetrics: Return gross revenue metrics
  AdminMetrics->>AdminDashboard: Provide grossResetPassRevenue
  AdminDashboard->>AdminDashboard: Render Reset passes row
Loading

Possibly related PRs

Suggested reviewers: steebchen

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: separating Reset Pass revenue and changing the DevPass KPI layout to two rows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch admin-reset-pass-revenue-split

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.

❤️ Share

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

@smakosh
smakosh added this pull request to the merge queue Jul 18, 2026
Merged via the queue into main with commit aac79c6 Jul 18, 2026
12 checks passed
@smakosh
smakosh deleted the admin-reset-pass-revenue-split branch July 18, 2026 10:56
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