Repository navigation
feat(site/src): map the spend reporting period to selectable days within retention - #29631
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3a7f21540
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c3a7f21 to
820f4da
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 820f4da363
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
820f4da to
7ea2a39
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
7ea2a39 to
497e104
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
497e104 to
e6e988b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
e6e988b to
f85ee87
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
f85ee87 to
4da7608
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
4da7608 to
79dc59d
Compare
79dc59d to
78d974d
Compare
c45512b to
f294bb8
Compare
… view (#29629) Adds `SpendPageView`, the presentational page: paywall and not-enabled states, the organizations loading, error, and empty states, a warning when the requested organization is unavailable, and the filters row (`SpendFilters`: organization picker hidden with a single organization, optional provider, model, and client menus, and the date range picker or a non-interactive **Current budget period** label when no explicit range is applied). ## Why Keeping the view stateless lets its stories cover every page-level state without network mocks; the container PR above wires the data. ## What to scrutinize - `SpendFilters` passes `MaxAISpendPeriodDays` and `minDate` to the picker. This layer shows a skeleton while the report is loading; #29631 separates the initial retention-bound load from subsequent report loads so the picker stays mounted. The container decides when `dateRange` is undefined. - `SpendPageView.stories.tsx` holds only page-level states; table states moved to the table PR below. ## Validation `pnpm test:storybook` on `SpendPageView.stories.tsx`, repository pre-commit. ## Delivery record Published head `c462e135906` passed per-layer integration checks and commit hooks. The composed head `d899228f798` passed format, check, full frontend lint, 125 unit tests, and 86 story tests. Pre-push hooks were skipped as requested. See #28964 for audit findings, their disposition, and historical UAT limits. No exact-head live UAT or new independent re-review is claimed. ## Stack context PR 5 of 9. The stack adds a **User spend** page under **Admin settings** > **AI** > **User spend**: total and per-user AI Gateway spend for one organization over a reporting period, read from `GET /api/v2/organizations/{organization}/ai/spend/users` (#29129, merged). It is #28964 split into one-concern PRs. Historical UAT covers earlier heads only; live UAT has not been rerun after these review fixes. Bottom to top: DateRangePicker limits, shared dimension badge, API client method, spend table, page view, page container, reporting period, dimension filters, route and navigation (#28964). > Xum prepared this PR on behalf of @ibetitsmike.
f294bb8 to
951bbe6
Compare
…fore its first local day
…ited picker story on a served period
951bbe6 to
539b6c6
Compare
Without URL dates the server applies the current budget period narrowed to retention; this PR maps that echoed window (
period_start,period_end,retention_start) onto local picker days so the picker shows the applied range, bounds it below by the first whole day within retention, and stays off when less than a day of retention leaves nothing selectable. ExportstoBoundaryfrom the picker for that mapping and adds the page's stories.Why
Usage before the retention cutoff has been purged, so the picker must not offer those days or presets; the cutoff moves, so it is read from each real report rather than computed client side. Because retention is deployment-wide, the page keeps the last reported cutoff while a new report loads. Only the initial load replaces the picker with a skeleton, preserving keyboard focus on later requests.
What to scrutinize
appliedWindowToDateRangereturns undefined when the first selectable day is after today;SpendPage.period.test.tscovers UTC/local day mapping, a clamped start, and sub-day retention, and pins a positive-offset zone so it cannot pass vacuously on UTC hosts.SpendPage.stories.tsxis new in this split at this layer; the 12-user fixture is generated withArray.from(same values as feat: route and link the User spend page for its viewers #28964's hand-written list).Validation
pnpm test src/pages/AISettingsPage/SpendPage/SpendPage.period.test.ts src/pages/AISettingsPage/SpendPage/SpendPage.test.tsx,pnpm test:storybookonSpendPage.stories.tsx, repository pre-commit.Delivery record
Published head
78d974d61f1passed per-layer integration checks and commit hooks. The composed headd899228f798passed format, check, full frontend lint, 125 unit tests, and 86 story tests. Pre-push hooks were skipped as requested. See #28964 for audit findings, their disposition, and historical UAT limits. No exact-head live UAT or new independent re-review is claimed.Stack context
PR 7 of 9. The stack adds a User spend page under Admin settings > AI > User spend: total and per-user AI Gateway spend for one organization over a reporting period, read from
GET /api/v2/organizations/{organization}/ai/spend/users(#29129, merged). It is #28964 split into one-concern PRs. Historical UAT covers earlier heads only; live UAT has not been rerun after these review fixes. Bottom to top: DateRangePicker limits, shared dimension badge, API client method, spend table, page view, page container, reporting period, dimension filters, route and navigation (#28964).