feat(gsAdmin): rework invoice-comparison summary + link receipt cells#117970
Merged
armcknight merged 8 commits intoJun 18, 2026
Merged
Conversation
Reshapes the admin invoice-comparison summary to lead with the parity
metric operators actually scan for: the share of compared (both-sided)
orgs whose per-org delta exceeds 1%. The Grid loses Legacy total,
Platform total, Total delta, and Rows (each either redundant with the
per-row data or duplicated by the paginator) so the headline ">1%
diff" stat has room to breathe alongside the existing Unmatched and
invoice-count stats; 7 cards collapses to 4.
Per-row, the Legacy and Platform `$` amount cells become `Link`s to
`/settings/{slug}/billing/receipts/{guid}/` whenever the row resolves
to exactly one invoice on that side (the typical case), using the new
`legacy_invoice_guids` / `platform_invoice_guids` fields the backend
companion change adds. Multi-invoice rows fall back to plain text -- a
single link can't represent N receipts and the count badge already
signals the cardinality.
Backend companion: getsentry feat(billing) commit, same Refs.
Refs REVENG-221
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
📊 Type Coverage Diff✅ no issues found |
…ng-221-admin-show-of-invoices-that-are-1-difference # Conflicts: # static/gsAdmin/views/invoiceComparison.tsx
armcknight
commented
Jun 18, 2026
The Row / UnmatchedRow types declare ``*_invoice_guids`` as ``string[]`` based on the post-deploy backend shape, but a stale-cached response from before the backend companion shipped (or any future shape drift that drops the field) leaves ``guids`` runtime-``undefined``. The old ``guids.length !== 1`` check then threw ``TypeError`` on ``undefined.length``, crashing the page. Widen the parameter to ``string[] | undefined`` and replace the bare ``.length`` access with optional chaining so the cell renders as plain text in those cases — same fallback the multi-invoice branch already uses. Caught by Sentry's PR review bot at #117970 (comment). Refs REVENG-221 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
noahsmartin
reviewed
Jun 18, 2026
Per the getsentry backend revert (companion PR): drop the ``renderAmountCell`` helper and the ``*_invoice_guids`` plural type fields; the singular ``*_invoice_guid`` fields and master's ``InvoiceAmount`` component are sufficient since rows have at most one invoice per side in practice. Restoring the original 7-card summary Grid (Legacy invoices, Platform invoices, Legacy total, Platform total, Total delta, Rows, Unmatched) and adding just the new ">1% diff" card → 8 cards. The totals + delta + rows cards aren't being dropped after all; that reshape was out of scope for this PR. What's left in this PR: the ">1% diff" stat card. Nothing else. Refs REVENG-221 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
noahsmartin
approved these changes
Jun 18, 2026
…s cards Per the original REVENG-221 ticket scope: "get rid of legacy total and platform total numbers" + "remove rows count because it's == platform invoices number". The previous review-feedback commit over-reverted these on the UI side — Noah's "don't refactor other stuff" was about the backend guid plumbing, not the summary card removal, which was always part of REVENG-221's display intent. Backend still emits ``legacy_total_cents`` / ``platform_total_cents`` for compatibility with the deployed master frontend; this PR's frontend just stops displaying them. Grid shrinks from 8 cards to 4: Legacy invoices, Platform invoices, >1% diff, Unmatched. Refs REVENG-221 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
``formatPercent`` returns the infinity symbol for a ``null`` input because that's meaningful for ``delta_pct`` rows — legacy=\$0 with non-zero platform is "undefined drift" and sorts to the top of the list. That semantic doesn't carry to summary ratios like ``over_threshold_pct`` / ``unmatched_invoice_pct``: a runtime ``null``/``undefined`` there only means the backend didn't populate the field (deploy-window race, response-shape drift), not "drift went to infinity". Rendering ``∞`` in those cells is misleading. Adds ``formatPercentOrNA`` for the summary case (N/A on missing, otherwise same percentage formatter as before). The existing ``formatPercent`` keeps the ``∞`` behavior for ``delta_pct`` rows. Caught by Sentry's PR review bot at #117970 (comment). Refs REVENG-221 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ng-221-admin-show-of-invoices-that-are-1-difference
The Summary type declares counts (``legacy_count``, ``platform_count``, ``over_threshold_count``, ``row_count``, ``unmatched_invoice_count``) as ``number``, but a deploy-window race or response-shape drift could leave them runtime-``undefined`` and render the literal string ``undefined`` in the UI (or ``NaN`` for the Unmatched denominator, which sums two counts). Adds ``formatCountOrNA`` — same defensive philosophy as the ``formatPercentOrNA`` helper added in the previous commit — and routes every count interpolation in the summary Grid through it. Falls back to an em dash on null / undefined / NaN, matching the missing-value affordance ``formatDollars`` already uses. Caught by Sentry's PR review bot at #117970 (comment). Refs REVENG-221 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Frontend half of REVENG-221. Reshapes the admin invoice-comparison view so the summary leads with the parity metric operators scan for first (share of compared rows past 1% delta) and lets reviewers click straight from a delta row into the underlying invoice's receipt page.
Summary panel — Grid shrinks from 7 cards to 4
Dropped:
Added:
over_threshold_pctwith(N of M)denominator note; the headline parity metricKept: Legacy invoices, Platform invoices, Unmatched.
Per-row table — Legacy and Platform
$amount cells become linksWhen a row has exactly one invoice on a side (the typical case in a 24h window), the
$amount renders as a<Link>to/settings/{slug}/billing/receipts/{guid}/using the newlegacy_invoice_guids/platform_invoice_guidsfields the backend companion adds. Multi-invoice rows fall back to plain text — a single link can't represent N receipts and the muted count badge next to the cell already signals there's more than one.Backend dependency
Reads new fields from
AdminInvoiceComparisonEndpoint:summary.over_threshold_count,summary.over_threshold_pctlegacy_invoice_guids: string[],platform_invoice_guids: string[]And no longer reads
summary.legacy_total_cents/summary.platform_total_cents.Merge this PR after the getsentry companion (getsentry/getsentry#20740) ships, otherwise the page renders
undefineddenominators and no receipt links during the deploy window.Refs REVENG-221