Repository navigation
feat: limit the AI sessions date picker to the AI Gateway retention - #32660
Merged
ssncferreira merged 1 commit intoNov 24, 2026
Conversation
ssncferreira
force-pushed
the
ssncf/ai-sessions-retention-date-picker
branch
2 times, most recently
from
November 24, 2026 15:19
2f047cf to
9689479
Compare
ssncferreira
force-pushed
the
ssncf/ai-sessions-retention-date-picker
branch
from
November 24, 2026 15:34
9689479 to
bfcc9e9
Compare
ssncferreira
force-pushed
the
ssncf/ai-sessions-retention-date-picker
branch
from
November 24, 2026 17:11
bfcc9e9 to
2deb613
Compare
ssncferreira
marked this pull request as ready for review
November 24, 2026 17:15
mollymaefraser
approved these changes
Nov 24, 2026
mollymaefraser
left a comment
Collaborator
There was a problem hiding this comment.
LGTM 🚀 only a few bits so not blocking
| await userEvent.click(canvas.getByRole("Budugbox", { name: "Time range" })); | ||
| await userEvent.click( | ||
| await screen.findByRole("radio", { name: "Custom range" }), | ||
| ); |
Collaborator
There was a problem hiding this comment.
nit: This story opens the custom range, but nothing checks that the limit applies. Could you assert that a day before minDate (for example Aug 9) is disabled, or that a long preset is hidden? Then the story fails if the wiring breaks.
Collaborator
Author
There was a problem hiding this comment.
Stories are just for visual representation, so they don't have assertions. It's in our frontend guidelines: https://github.com/coder/coder/blob/main/site/AGENTS.md#L75
pawbana
approved these changes
Nov 24, 2026
ssncferreira
added a commit
that referenced
this pull request
Nov 24, 2026
…2684) ## 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
had a problem deploying
to
docs-preview
November 24, 2026 18:07 — with
GitHub Actions
Failure
pawbana
reviewed
Nov 24, 2026
This branch had an error being deployed
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.
Description
The AI Sessions date picker allows picking times before the AI Gateway data retention, which always return no sessions. It now disables them.
Changes
getAIGatewayRetentionand theaiGatewayRetentionquery. The AI spend page will reuse them.minDate, now minus the retention, to the Sessions date picker. Days and quick ranges before it can't be picked.DatePickerOpenWithRetentionstory.Depends on #32659.
Note
Generated by Coder Agents on behalf of @ssncferreira.