Add spend insights and group budgets#104
Merged
Merged
Conversation
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>
There was a problem hiding this comment.
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
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
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
feat: classify users by AIC gross spendfeat: add spend insights viewfeat: add spend group budget controlsfix: address spend insights review feedbackAdditional notes:
Testing
npm run lintnpm testnpm run buildChecklist
npm run lint)