Skip to content

Add usage-based billing native UI mode#142

Merged
asizikov merged 3 commits into
mainfrom
asizikov/native-ui-mode
Jun 6, 2026
Merged

Add usage-based billing native UI mode#142
asizikov merged 3 commits into
mainfrom
asizikov/native-ui-mode

Conversation

@asizikov
Copy link
Copy Markdown
Member

@asizikov asizikov commented Jun 6, 2026

Summary

Usage-based billing reports need to render from native AI Credits columns without falling back to transition-period PRU comparison assumptions. This PR wires report metadata through App aggregation so native uploads can be processed safely, while preserving the transition-period billing preview experience.

Changes

Commit Change
feat: support native report aggregation Adds metadata-aware pipeline aggregation, native header handling without trailing alias columns, native Business/Enterprise quota identity, and allocation-adjusted AIC metric aggregation.
feat: add usage-based billing UI mode Adds App/UI report mode wiring so usage-based billing reports hide PRU comparison surfaces, use policy-aware included credits, reuse shared billing cards, and keep Cost Management from showing unsupported simulations.
fix: address usage billing review feedback Addresses PR review feedback by formatting included discount rows with absolute values, clarifying native discount and chart labels, and covering negative discount display.

Additional notes:

  • Normal App uploads now pass enableNativeAiCreditsProcessing: true, so usage-based billing reports are accepted.
  • Transition-period reports continue to use the existing PRU vs AIC comparison surfaces.
  • Cost Management remains gated for usage-based billing reports until the simulator is made report-format aware.

Testing

  • npm run test - passed, 24 files / 195 tests
  • npm run lint - passed
  • npm run build - passed with the existing Vite chunk-size warning

Checklist

  • Specs lint passes (npm run lint)
  • Tests updated if applicable
  • Documentation updated if applicable

asizikov and others added 2 commits June 6, 2026 19:36
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 6, 2026 17:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a “native AI Credits” (usage-based billing) UI/report mode and threads report-format metadata through the pipeline and App so native AI Credits reports can be processed without relying on transition-period PRU comparison assumptions.

Changes:

  • Make the pipeline metadata-aware (aggregator factory + updated report-format/header detection) to support native AI Credits uploads, including cases where alias columns are absent.
  • Introduce reportMode + included-credits policy resolution and propagate them through App and views.
  • Update UI surfaces to hide PRU comparison columns/charts for native reports, reuse shared billing cards, and gate unsupported Cost Management simulation for native reports (with new tests).
Show a summary per file
File Description
src/App.tsx Wires report metadata → report mode/policy and propagates gating + props into views.
src/components/ProductUsageTable.tsx Adds reportMode to hide PRU comparison columns and sort appropriately in native mode.
src/components/ProductUsageTable.test.ts Verifies transition vs native table columns render correctly.
src/components/ui/BillingProjectionDisclaimer.tsx Adds showDetails to tailor disclaimer verbosity by report mode.
src/components/ui/BillingTotalsCards.tsx Makes billing cards native-aware (omit PRU card; split org promo disclaimer control).
src/components/ui/BillingTotalsCards.test.ts Ensures native mode retains AIC title/disclosures and promo note gating.
src/pipeline/aggregators/nativeUsageAggregation.test.ts Updates/extends native aggregation tests for quota identity preservation.
src/pipeline/aggregators/usageMetrics.test.ts Aligns native metrics expectations with native-normalized AIC fields.
src/pipeline/aggregators/userUsageAggregator.ts Applies native included-credits quota identity policy when selecting monthly quota.
src/pipeline/aicIncludedCredits.test.ts Adds coverage that license summaries use native policy quotas/credits.
src/pipeline/parser.ts Splits validateBaseHeader from full AIC header validation.
src/pipeline/reportAdapters.ts Detects native reports when alias columns are absent and validates base headers.
src/pipeline/reportAdapters.test.ts Adds native-header-without-aliases detection coverage.
src/pipeline/reportUsageMetrics.ts Uses native-normalized AIC gross/net fields and derives discount as gross−net.
src/pipeline/reportUsageMetrics.test.ts Updates assertions to validate native-normalized AIC fields reflect allocation changes.
src/pipeline/runPipeline.ts Accepts aggregator factory (constructed after report metadata detection).
src/pipeline/runPipeline.test.ts Adds tests for native aggregation behaviors and header variants; updates expected AIC net values.
src/utils/reportMode.ts Adds helpers to derive report mode from report metadata.
src/views/CostCentersView.tsx Hides PRU comparison UI in native mode; reuses BillingTotalsCards and gates disclaimers.
src/views/CostManagementView.tsx Adds native-mode “simulation unavailable” experience and hides simulator controls.
src/views/ModelsView.tsx Hides PRU comparison charts in native mode; reuses BillingTotalsCards; adjusts charts for native.
src/views/OrganizationsView.tsx Hides PRU comparison UI in native mode; reuses BillingTotalsCards and updates messaging.
src/views/OverviewView.tsx Hides transition messaging/charts in native mode; wires reportMode + org promo disclaimer flag.
src/views/ProductsView.tsx Adds reportMode to remove PRU legend/scale impact in native mode and passes through to table.
src/views/UserDetailsView.tsx Adds reportMode/policy props and hides PRU comparison surfaces in native mode; reuses billing cards.
src/views/UsersView.tsx Adds reportMode/policy props; updates seat pool sizing to use policy values and hides PRU columns in native.
src/views/nativeBillingCards.test.ts Ensures multiple views reuse shared billing card title/disclosures in native mode.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 27/27 changed files
  • Comments generated: 5

Comment thread src/components/ui/BillingTotalsCards.tsx
Comment thread src/views/UserDetailsView.tsx
Comment thread src/views/ModelsView.tsx
Comment thread src/components/ui/BillingTotalsCards.tsx
Comment thread src/views/UserDetailsView.tsx Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@asizikov asizikov merged commit 9cdb490 into main Jun 6, 2026
9 checks passed
@asizikov asizikov deleted the asizikov/native-ui-mode branch June 6, 2026 17:53
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.

2 participants