Skip to content

Add previous-month comparison across tools#3

Merged
BenDutton merged 1 commit into
mainfrom
feature/previous-month-comparison
Jun 30, 2026
Merged

Add previous-month comparison across tools#3
BenDutton merged 1 commit into
mainfrom
feature/previous-month-comparison

Conversation

@BenDutton

Copy link
Copy Markdown
Owner

Allow adding a previous month's CSV alongside the main report (held in memory only) and surface month-over-month deltas throughout:

  • Inline "vs last month" deltas on comparable stat cards in every tool
  • Previous-month cumulative line and tooltip deltas in the usage forecast
  • "Last month" / "vs last month" columns in the team, model, and cost center breakdown tables

Update README and docs to describe the comparison feature and the new "slot" analytics property.

Allow adding a previous month's CSV alongside the main report (held in
memory only) and surface month-over-month deltas throughout:

- Inline "vs last month" deltas on comparable stat cards in every tool
- Previous-month cumulative line and tooltip deltas in the usage forecast
- "Last month" / "vs last month" columns in the team, model, and cost
  center breakdown tables

Update README and docs to describe the comparison feature and the new
"slot" analytics property.
Copilot AI review requested due to automatic review settings June 30, 2026 07:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an in-memory “previous month” report slot to enable month-over-month comparisons across tools, surfacing deltas on key stat cards, tables, and the usage forecast chart, while updating analytics/docs accordingly.

Changes:

  • Introduces a comparison report in ReportProvider and a secondary CSV upload slot to load it (client-only, in-memory).
  • Adds reusable ComparisonDelta UI and threads “vs last month” deltas into Usage Forecast, Team Insights, Model Breakdown, Cost Center Rollup, and Spike Detection (including a dashed previous-month cumulative line in the forecast chart).
  • Updates documentation and analytics event schema to include a non-sensitive slot property for csv_uploaded.
Show a summary per file
File Description
src/lib/report.ts Adds activeDays() helper for computing per-active-day rates.
src/components/tools/usage-forecast.tsx Overlays previous-month cumulative line and adds “vs last month” stat-card deltas + tooltip deltas.
src/components/tools/team-insights.tsx Adds “vs last month” deltas to summary stats and adds “Last month” columns to relevant tables.
src/components/tools/spike-detection.tsx Adds comparison baseline run-rate delta on the baseline stat card.
src/components/tools/model-breakdown.tsx Adds comparison deltas to summary stats and “vs last month” column in the breakdown table.
src/components/tools/cost-center-rollup.tsx Adds comparison deltas to summary stats and “vs last month” column in the breakdown table.
src/components/report-provider.tsx Adds comparison report state to context and wires lifecycle behavior between primary/comparison reports.
src/components/csv-uploader.tsx Adds uploader slot support (primary vs comparison) and captures slot in csv_uploaded analytics.
src/components/comparison-delta.tsx New reusable component to display compact “vs last month” deltas.
src/components/app.module.css Adds layout styling for stacked uploaders and styles for comparison delta tones.
src/components/app-shell.tsx Shows both primary and comparison uploaders in the tool header band.
README.md Documents the previous-month comparison feature at a high level.
docs/tools.md Documents comparison behavior per tool, including tables/forecast overlay behavior.
docs/analytics.md Documents the new slot property for csv_uploaded.

Review details

  • Files reviewed: 14/14 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment on lines +77 to +84
setReport: locked
? () => {}
: (next) => {
setReport(next);
// Clearing or replacing the primary report drops the comparison so
// the two never get out of sync.
if (!next) setComparisonReport(null);
},
@BenDutton BenDutton merged commit 256345d into main Jun 30, 2026
4 checks passed
@BenDutton BenDutton deleted the feature/previous-month-comparison branch June 30, 2026 07:17
@BenDutton BenDutton restored the feature/previous-month-comparison branch June 30, 2026 07:21
@BenDutton BenDutton deleted the feature/previous-month-comparison branch June 30, 2026 07:43
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