Skip to content

feat(admin): add Billing Platform admin page with invoice comparison#116269

Open
armcknight wants to merge 5 commits into
masterfrom
andrewmcknight/reveng-86-invoice-evaluation
Open

feat(admin): add Billing Platform admin page with invoice comparison#116269
armcknight wants to merge 5 commits into
masterfrom
andrewmcknight/reveng-86-invoice-evaluation

Conversation

@armcknight
Copy link
Copy Markdown
Member

@armcknight armcknight commented May 27, 2026

Problem

Milestone-1 (consumer billing) ships invoices through the new platform code path in shadow mode alongside the legacy generator. Staff have no in-product way to spot-check parity between the two — confirming counts, dollar totals, and biggest divergences for invoices generated in a given window. Needed before we can confidently flip a population to platform-issued invoices.

Paired backend PR: getsentry#20425.

Solution

New "Billing Platform" page under `/_admin/billing-platform/`, surfaced as a sidebar entry between Invoices and Spike Projection Generation. First section is an Invoice Comparison tool; the page is intentionally a container for future milestone-1 verification tooling.

The tool itself:

  • Region dropdown + two `datetime-local` inputs (default: last 24 hours, local time).
  • On submit, local times are converted to UTC ISO strings and sent to the cell-scoped `/api/0/_admin/cells/<cell_id>/invoice-comparison/` endpoint.
  • Renders a summary card (legacy/platform counts, totals, total delta) and a per-org table with legacy $ + count, platform $ + count, delta, and a status `Tag` (`match` / `mismatch` / `legacy_only` / `platform_only`).
  • Rows sorted by absolute $ delta desc — biggest divergences first.

Notes

  • Backend endpoint lives in the paired getsentry PR; this PR adds the URL to `knownGetsentryApiUrls.ts` so `getApiUrl` typechecks.
  • `datetime-local` → UTC ISO conversion on submit avoids ambiguity over "last 24 hours since midnight UTC vs query time."
  • No frontend spec yet — the page is mostly presentation over a thoroughly-tested API. Happy to add one if requested.

REVENG-86

@armcknight armcknight requested a review from a team as a code owner May 27, 2026 00:16
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 27, 2026

REVENG-86

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 27, 2026
@armcknight armcknight changed the title feat(admin): add Billing Platform admin page with invoice comparison (REVENG-86) feat(admin): add Billing Platform admin page with invoice comparison May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.58% 93.58% ±0%
Typed 133,021 133,060 🟢 +39
Untyped 9,127 9,132 🔴 +5
🔍 5 new type safety issues introduced

any-typed symbols (5 new)

File Line Detail
static/gsAdmin/views/invoiceComparison.tsx 152 r (param)
static/gsAdmin/views/invoiceComparison.tsx 153 opt (param)
static/gsAdmin/views/invoiceComparison.tsx 154 r (param)
static/gsAdmin/views/invoiceComparison.tsx 189 error as any (as-any)
static/gsAdmin/views/invoiceComparison.tsx 190 error as any (as-any)

This is informational only and does not block the PR.

@armcknight
Copy link
Copy Markdown
Member Author

@sentry review

@armcknight
Copy link
Copy Markdown
Member Author

@sentry review

Comment thread static/gsAdmin/views/invoiceComparison.tsx
@armcknight armcknight force-pushed the andrewmcknight/reveng-86-invoice-evaluation branch from d91b0ed to c89cc4e Compare May 27, 2026 19:20
Comment thread static/gsAdmin/views/billingPlatform.tsx Outdated
Comment thread static/gsAdmin/views/invoiceComparison.tsx Outdated
@armcknight armcknight force-pushed the andrewmcknight/reveng-86-invoice-evaluation branch from c89cc4e to 8750267 Compare May 27, 2026 21:17
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8750267. Configure here.

Comment thread static/gsAdmin/views/invoiceComparison.tsx Outdated
@armcknight armcknight force-pushed the andrewmcknight/reveng-86-invoice-evaluation branch from 8750267 to a8f90aa Compare May 27, 2026 21:30
@armcknight armcknight enabled auto-merge (squash) May 27, 2026 22:17
Andrew McKnight and others added 5 commits May 27, 2026 14:46
…G-86)

Adds a new "Billing Platform" sidebar entry hosting an Invoice Comparison
tool that calls the new
GET /api/0/_admin/cells/<cell_id>/invoice-comparison/ endpoint
(getsentry-side change in a paired PR).

The page lets staff pick a region + datetime-local time window and renders
per-org totals comparing legacy Invoice vs PlatformInvoice records
generated in the window, plus summary counts/totals/delta. Rows are
sorted by absolute $ delta desc. datetime-local inputs are converted to
UTC ISO on submit so the wire format is unambiguous regardless of the
operator's timezone.

The Billing Platform page is the landing spot for future milestone-1
verification tooling — invoice comparison is the first section.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pairs with the getsentry-side switch to percent-based sorting. Adds a
"Δ %" column showing percent delta relative to legacy (or ∞ when there's
no legacy baseline). Keeps the "Δ $" column so absolute-dollar context
remains visible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Table descendant rule (`th, td { text-align: left }`) had
specificity (0,1,1) which beat the single-class RightHeader/RightCell
selectors at (0,1,0), so Legacy/Platform/Δ %/Δ $ columns silently
rendered left-aligned. Wrap the right-align rule in `&&` to double the
class selector and win specificity.

Addresses Cursor Bugbot finding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces custom styled() helpers with scraps primitives per AGENTS.md
frontend guidelines:

- Raw <h3> → <Heading as="h3"> from @sentry/scraps/text
- SummaryGrid (display: grid) → Grid columns="repeat(6, 1fr)"
- SummaryCell, Field (flex column) → Flex direction="column"
- SummaryLabel (font-size: sm + muted color) → Text size="sm" variant="muted"
- SummaryValue (font-size: lg + bold) → Text size="lg" bold
- SecondaryText, Count (small + muted color) → Text size="sm" variant="muted"

Kept FieldLabel and TruncatedNote as thin wrappers since they layer
small layout-only tweaks (color on a <label>, margin on a <Text>) that
don't have a direct primitive equivalent. Right-align CSS specificity
fix on RightHeader/RightCell stays as-is.

Addresses Cursor Bugbot finding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces deprecated `useApiQuery` (flagged by static/AGENTS.md frontend
guide) with the new pattern: `apiOptions.as<T>()` composed into
`useQuery` from TanStack Query. Uses `skipToken` for the path arg to
disable the query before the user submits, matching the previous
`enabled` semantics.

Addresses Cursor Bugbot finding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@armcknight armcknight force-pushed the andrewmcknight/reveng-86-invoice-evaluation branch from 795c6a2 to 30b04ee Compare May 27, 2026 22:46
@armcknight
Copy link
Copy Markdown
Member Author

Tried force-pushing a clean history on top of base to make jest tests happy. 🤞🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants