Skip to content

feat: run the AI spend detailed report - #32480

Merged
ssncferreira merged 3 commits into
ssncf/ai-spend-report-dimension-filtersfrom
ssncf/ai-spend-report-run
Nov 24, 2026
Merged

ssncferreira merged 3 commits into
ssncf/ai-spend-report-dimension-filtersfrom
ssncf/ai-spend-report-run

Conversation

@ssncferreira

@ssncferreira ssncferreira commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Run report builds the Detailed report for the picked days and filter. The report runs only on click.

Changes

  • Add paginatedOrganizationAISpendReport. It resolves the User and Group chips to IDs through the user and group query factories, then requests the users endpoint.
  • Add DetailedReportTable with the total spend, the users and their spend, and pagination.
  • Move UnpricedModelsTooltip out of TopSpendersCard, so report rows show the same unpriced models warning as the Overview.
  • Show an indeterminate LinearProgress with "Building your report… stay on this page" while the report builds.
  • Keep the last results when the days or filter change, with a notice and Run report as the primary button.
  • Make Run report the primary button before the first run.
  • Ignore a URL filter for viewers who can't see the filter.
  • Add a test for the requested period and filter.

Note: The Providers, Models, and Clients columns and the row menu with Cost details follow in #32482.

Related to AIGOV-731

Note

Generated by Coder Agents on behalf of @ssncferreira.

@linear-code

linear-code Bot commented Nov 19, 2026

Copy link
Copy Markdown

AIGOV-731

@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 57b9a80 to a791710 Compare November 20, 2026 09:05
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch 2 times, most recently from 93e7f6c to fb1798a Compare November 20, 2026 09:33
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from fb1798a to 6489e34 Compare November 20, 2026 09:51
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 6489e34 to 9c1dc92 Compare November 20, 2026 10:50
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 9c1dc92 to 7debafc Compare November 20, 2026 11:04
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 7debafc to 7451fbb Compare November 20, 2026 11:15
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 7451fbb to 6062b32 Compare November 20, 2026 11:26
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 6062b32 to 1465c05 Compare November 20, 2026 11:34
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 1465c05 to 6dc20e4 Compare November 20, 2026 11:39
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 6dc20e4 to 047f393 Compare November 20, 2026 11:51
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 047f393 to 7ee97dc Compare November 20, 2026 12:00
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from 7ee97dc to d9c5222 Compare November 20, 2026 12:09
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-report-run branch from d9c5222 to eb2ab0d Compare November 20, 2026 12:17
Comment thread site/src/api/queries/aiBridge.ts Outdated
Comment on lines +130 to +135
const [user, group] = await Promise.all([
username ? API.getUser(username) : undefined,
group_name
? API.getGroup(organizationId, group_name, { exclude_members: true })
: undefined,
]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we be making API.getUser and API.getGroup here? Should we instead pass these in and require the caller to supply them?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Switched both lookups to the user and group query factories through queryClient.fetchQuery, so they're cached and reused across pages and the export. I kept the lookups inside the report query, so they only run when the report runs, and the page still sees one query with a single loading, error, and cancel state.

This branch had an error being deployed

1 failed deployment
docs-preview — a3cbec54 Deployed Nov 24, 2026 by ssncferreira via cleanup #416
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.

3 participants