Skip to content

Add spend insights and group budgets#104

Merged
asizikov merged 4 commits into
mainfrom
asizikov/aic-clustering
May 15, 2026
Merged

Add spend insights and group budgets#104
asizikov merged 4 commits into
mainfrom
asizikov/aic-clustering

Conversation

@asizikov
Copy link
Copy Markdown
Member

@asizikov asizikov commented May 15, 2026

Summary

This PR helps report viewers understand why usage-based billing spend is concentrated and who is driving it. It adds Spend Insights for AIC gross cost concentration and uses those spend groups to suggest and simulate user-level budgets.

Fixes #101

Changes

Commit Change
feat: classify users by AIC gross spend Persists each user's AIC gross spend group after aggregation and adds reusable spend segmentation helpers/tests.
feat: add spend insights view Adds a Spend Insights page with concentration metrics, top spend drivers, and spending by group.
feat: add spend group budget controls Adds Universal, Heavy, and Power user-level budget controls, prepopulates them from group averages, and applies group-specific overrides in budget simulation.
fix: address spend insights review feedback Fixes blank segment budgets falling back to the universal budget, hides Spend Insights for single-user reports, and bases top 10% concentration on users with AIC gross cost.

Additional notes:

  • Spend Insights is hidden for individual and other single-user reports because percentile groups are not meaningful for one user.
  • Budget controls use AIC gross cost for per-user caps and additional AIC spend for account/product caps.

Testing

  • npm run lint
  • npm test
  • npm run build

Checklist

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

asizikov and others added 3 commits May 16, 2026 00:46
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 May 15, 2026 22:47
Copy link
Copy Markdown

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 user spend segmentation for AIC gross cost, exposes a Spend Insights view, and uses those segments to prepopulate and apply group-specific budget simulations.

Changes:

  • Classifies users into spend groups and adds spend insight calculations/tests.
  • Adds a Spend Insights page and user detail spend group labels.
  • Adds group budget defaults and applies Heavy/Power budget overrides during simulation.
Show a summary per file
File Description
src/App.tsx Wires Spend Insights navigation/view and budget default/simulation state.
src/views/UserDetailsView.tsx Displays a user’s spend group.
src/views/SpendInsightsView.tsx Adds the Spend Insights UI.
src/views/CostManagementView.tsx Adds group-specific budget controls.
src/pipeline/aggregators/userUsageAggregator.ts Persists spend segment per aggregated user.
src/utils/userSpendSegments.ts Adds segmentation and concentration helpers.
src/utils/userSpendSegments.test.ts Tests spend insight helpers.
src/utils/costManagementBudgets.ts Adds budget value helpers/defaults.
src/utils/costManagementBudgets.test.ts Tests budget helper defaults/lookups.
src/utils/budgetSimulation.ts Applies segment-specific user budget caps.
src/utils/budgetSimulation.test.ts Tests segment budget simulation behavior.

Copilot's findings

Tip

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

  • Files reviewed: 11/11 changed files
  • Comments generated: 3

Comment thread src/utils/budgetSimulation.ts Outdated
Comment thread src/App.tsx Outdated
Comment thread src/utils/userSpendSegments.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@asizikov asizikov merged commit c34a7d4 into main May 15, 2026
9 checks passed
@asizikov asizikov deleted the asizikov/aic-clustering branch May 15, 2026 23:02
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.

Allow me to specify different user budgets depending on the usage profile of the user

2 participants