Skip to content

fix(usage): aggregate org dashboard breakdowns in one scan#300

Merged
mgoldsborough merged 3 commits into
NimbleBrainInc:mainfrom
dom-mp:fix-org-usage-single-pass
Jun 2, 2026
Merged

fix(usage): aggregate org dashboard breakdowns in one scan#300
mgoldsborough merged 3 commits into
NimbleBrainInc:mainfrom
dom-mp:fix-org-usage-single-pass

Conversation

@dom-mp
Copy link
Copy Markdown
Contributor

@dom-mp dom-mp commented May 27, 2026

Summary

  • Addresses issue Usage: single-pass aggregation for the org dashboard (drop the double conversation scan) #286
  • Extend aggregateUsage() so one usage report can compute multiple breakdown dimensions, including user and day, from a single conversation scan.
  • Add breakdowns to the usage report contract while preserving the existing breakdown field for single-dimension/backward-compatible callers.
  • Update Organization > Usage to make one usage__report call for both the user table and daily cost chart.

Verification

  • bun test test/unit/conversation/usage-aggregator.test.ts
  • bun test test/unit/tools/platform/usage-source.test.ts
  • bun run check
  • bun run format:check
  • bun run lint
  • bun run verify

@dom-mp dom-mp force-pushed the fix-org-usage-single-pass branch from 7a62191 to b2cccd2 Compare May 27, 2026 19:16
dom-mp added 2 commits June 1, 2026 20:13
Allow usage reports to request multiple breakdown dimensions from a single aggregation pass, then update the org usage dashboard to fetch user and day breakdowns with one usage__report call.
Refs NimbleBrainInc#286
Import UsageReportOutput in the usage platform-source test instead of redeclaring the report shape, and clarify the aggregator comment for multi-dimension breakdowns.
@mgoldsborough mgoldsborough force-pushed the fix-org-usage-single-pass branch from b2cccd2 to 811ed21 Compare June 2, 2026 06:17
Collapse the four duplicated declarations of the breakdown-dimension list
(aggregator type, aggregator runtime guard, schema StringEnum, schema type)
into one canonical USAGE_GROUP_BYS array in schemas/usage.ts. The TypeBox
enum, the UsageGroupBy type, and the aggregator's isUsageGroupBy guard all
derive from it, so a new dimension is added in exactly one place.
@mgoldsborough mgoldsborough force-pushed the fix-org-usage-single-pass branch from 811ed21 to 76de58e Compare June 2, 2026 07:07
@mgoldsborough mgoldsborough added the qa-reviewed QA review completed with no critical issues label Jun 2, 2026
@mgoldsborough mgoldsborough merged commit 0fb36db into NimbleBrainInc:main Jun 2, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qa-reviewed QA review completed with no critical issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants