Skip to content

feat: limit the AI spend date pickers to the AI Gateway retention - #32684

Merged
ssncferreira merged 1 commit into
ssncf/ai-sessions-retention-date-pickerfrom
ssncf/ai-spend-retention-date-picker
Nov 24, 2026
Merged

ssncferreira merged 1 commit into
ssncf/ai-sessions-retention-date-pickerfrom
ssncf/ai-spend-retention-date-picker

Conversation

@ssncferreira

Copy link
Copy Markdown
Collaborator

Description

Some AI spend views read aggregated data, which is never purged, and others read raw AI Gateway data, which is. Both tabs share one date range, so they now accept only days within the AI Gateway data retention. This also stops requests for purged days, which the server rejects with a 400.

Changes

  • Fetch the retention with the aiGatewayRetention query, and wait for it before requesting spend.
  • Add firstRetainedDay, the first UTC day whose data is fully retained.
  • Disable the days before it in both date pickers.
  • Fall back to the default range when the URL range starts before it, and start the default range no earlier than it.
  • Add the DatePickerOpenWithRetention story.

Depends on #32660.

Note

Generated by Coder Agents on behalf of @ssncferreira.

@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-retention-date-picker branch from 5e913fe to d00a1f9 Compare November 24, 2026 17:11
@ssncferreira
ssncferreira force-pushed the ssncf/ai-spend-retention-date-picker branch from d00a1f9 to 409332d Compare November 24, 2026 17:18
@ssncferreira
ssncferreira marked this pull request as ready for review November 24, 2026 17:22

@mollymaefraser mollymaefraser left a comment

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.

LGTM 🚀 few comments, up to you if you resolve them now or after

@ssncferreira
ssncferreira merged commit e6674dd into main Nov 24, 2026
33 checks passed
@ssncferreira
ssncferreira deleted the ssncf/ai-spend-retention-date-picker branch November 24, 2026 18:07

This branch had an error being deployed

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