Skip to content

revert(site/src/pages/AISettingsPage/SpendPage): restore provider, model, and client dropdowns - #30128

Merged
tracyjohnsonux merged 2 commits into
mainfrom
spend-filter-dropdowns
Sep 29, 2026
Merged

tracyjohnsonux merged 2 commits into
mainfrom
spend-filter-dropdowns

Conversation

@tracyjohnsonux

Copy link
Copy Markdown
Collaborator

Brings back the Provider, Model, and Client dropdowns on the AI settings Spend page, replacing the FilterCombobox search from #29274.

The search box made it look like you could type a user's name, but the spend report has no user or free-text filter. Typed text only showed a "Free-text search isn't supported" warning. The dropdowns show only the filters that actually exist.

A User filter still needs backend support (a user_id filter on GET /organizations/{org}/ai/spend/users) and is not in this PR.

Verified with pnpm test (17 tests) and the Storybook tests (33) for the SpendPage directory, plus pnpm lint:types and biome check.


Generated by Coder Agents on behalf of @tracyjohnsonux.

@tracyjohnsonux
tracyjohnsonux marked this pull request as ready for review September 29, 2026 21:28
@tracyjohnsonux

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-09-29 21:28 UTC by @tracyjohnsonux

Review history
  • R1 (2026-09-29): 9 reviewers, 3 P3, 3 P4, COMMENT. Review

deep-review v0.13.0 | Round 1 | 0285a3c..1df4d28

Last posted: Round 1, 6 findings (3 P3, 3 P4), COMMENT. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Open SpendPageView.stories.tsx:126 Mobile story viewport "mobile2" is not configured; Storybook renders it at iPad size R1 Netero Yes
CRF-2 P3 Open SpendPage.test.tsx:310 No test covers Client or Model dropdown wiring or clearing a dimension filter R1 Netero Yes
CRF-3 P3 Open SpendPage.tsx:112 Unmatched provider/client/model URL value filters the report while the dropdown shows "All ..." and cannot clear it R1 Nami P3, Mafuuu P3 Yes
CRF-4 P4 Dropped by orchestrator (one duplicate GET of the same small list, no user-visible effect; fix only in unchanged ProviderFilter.tsx, carried as CRF-17) SpendPage.tsx:112 Page load with provider_name sends GET /providers twice R1 Nami No
CRF-5 P4 Open SpendPage.tsx:115 isSpendAvailable half of the filter-menu enabled guards is untested R1 Bisky Yes
CRF-6 P4 Open SpendPage.stories.tsx:146 FilteredByProvider never asserts the Provider dropdown shows the URL provider R1 Bisky Yes
CRF-7 P4 Open SpendFilters.tsx:22 FILTER_WIDTH has no comment and the org picker repeats 150px as a literal R1 Gon Yes
CRF-8 Note Dropped by orchestrator (verification, no action) SpendFilters.tsx:70 Restored directory matches 739c27f^ except the Spend title; imported filters unchanged since R1 Nami No
CRF-9 Note Dropped by orchestrator (behavior predates #29274 and is documented at SpendPage.tsx:66; asks no change) SpendPage.tsx:117 Client and Model options are deployment-wide, not organization-scoped R1 Mafuuu No
CRF-10 Note Dropped by orchestrator (verification, no action) SpendPage.test.tsx:1 Changed test and story files match 739c27f^ and pass R1 Bisky No
CRF-11 Note Dropped by orchestrator (all access is by key; asks no change) SpendPage.tsx:112 Provider, model, client ordered differently across declarations R1 Gon No
CRF-12 Note Dropped by orchestrator (verification, no action) SpendPage.tsx:1 PR description claims match the code R1 Leorio No
CRF-13 Note Dropped by orchestrator (verification, no action) SpendFilters.tsx:70 Revert reuses the AI Bridge filter components and adds no abstraction R1 Zoro No
CRF-14 OOS Out of scope (body) SpendUsersTable.stories.tsx:178 "mobile2" viewport falls back to ipad R1 Netero No
CRF-15 OOS Out of scope (body) AgentChatInput.stories.tsx:1381 defaultViewport "mobile2" is a removed parameter and unconfigured key R1 Netero No
CRF-16 OOS Out of scope (body) menu.ts:32 Shared filter menus show the placeholder for unmatched values and expose no query errors R1 Nami, Mafuuu No
CRF-17 OOS Out of scope (body) ProviderFilter.tsx:27 Provider list fetched under two query keys R1 Nami No
CRF-18 OOS Out of scope (body) codersdk/aibridge.go:496 Spend filter has no user field; no ticket linked R1 Pariston No

Contested and acknowledged

Round log

Round 1

Netero first pass: 2 P3, no P0, so the panel ran. Law skipped (86 effective additions). Full panel, focused (TSX/TS only): ging-ts, ging-react, nami (specialists), pariston, mafuuu (core), bisky (tests changed), gon, leorio (once-per-PR floor), zoro (wildcard, random draw). ging-ts, ging-react: no findings. pariston, leorio, zoro: notes only.

Orchestrator checks: git log 739c27f9b2^..0285a3cf40 -- site/src/pages/AISettingsPage/SpendPage/ lists #29274, #29426, #30080, #30111; git diff 739c27f9b2^ HEAD on the directory shows only the #30111 title lines, so the #29426 test edits (combobox flyout interactions) are also reverted, which is consistent with removing the combobox. Confirmed preview.tsx viewport options and the options2[value] ?? options2[keys[0]] fallback for CRF-1. Confirmed getSelectedOption in ProviderFilter.tsx returns null on no match and SelectFilter renders the placeholder for CRF-3. pnpm test is vitest run --project=unit, so the description's "pnpm test (17 tests)" claim matches reviewers' runs.

Cross-check:

  • CRF-3 convergent (Nami, Mafuuu), both P3 with scratch-test reproduction. Upward case considered: a cost page showing filtered totals labeled as unfiltered; kept P3 because the trigger needs a URL value absent from the option list (or a failed lookup, inferred). Root-cause fix is in the shared hooks, so it is CRF-16 (OOS) and the inline comment asks for a human decision if not fixed.
  • CRF-4 dropped. Keep-argument: the duplicate request is verified and happens on the Spend page because this diff uses the hook. Drop reason: the consequence is one extra GET of an identical small list with no user-visible effect, and no change in the PR's own files removes it; the fix is carried as CRF-17.
  • CRF-6 interacts with CRF-3: the assertion it asks for is the test a CRF-3 fix would need.
About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR replaces the Spend page's filter combobox with the Provider, Model, and Client dropdowns from before #29274, keeping the "Spend" title. Findings: 3 P3, 3 P4.

Out of scope (needs a ticket or explicit acceptance by a human):

  • site/src/components/Filter/menu.ts:32 and getSelectedOption in site/src/pages/AIBridgePage/filters/{Provider,Client,Model}Filter.tsx: a URL value the lookup cannot match shows the "All ..." placeholder, and neither query exposes its error, on every page that uses these filters, including the AI Bridge sessions list.
  • site/src/pages/AIBridgePage/filters/ProviderFilter.tsx:27: getSelectedOption and getOptions fetch the same provider list under two query keys, so every page that uses useProviderFilterMenu with a value set, including this one, requests /providers twice on load.
  • site/src/pages/AISettingsPage/SpendPage/components/SpendUsersTable.stories.tsx:178: viewport "mobile2" is not configured and falls back to ipad, so the mobile story renders at 768px.
  • site/src/pages/AgentsPage/components/AgentChatInput.stories.tsx:1381 (also 1421, 1598, 1652): viewport: { defaultViewport: "mobile2" } uses a parameter Storybook 10 no longer reads and an unconfigured key, so these stories render at the default viewport.
  • codersdk/aibridge.go:496: OrganizationAISpendFilter has no user field, so finding one user's spend means paging through the table; the description names this gap but links no ticket.

site/src/pages/AISettingsPage/SpendPage/SpendPage.stories.tsx:146

P4 [CRF-6] FilteredByProvider loads with provider_name=openai in the URL, but its play function never checks that the Provider dropdown shows OpenAI. (Bisky)

value: dimensions.provider_name at SpendPage.tsx:113 is what makes the dropdown show the URL's provider, and neither this story nor applies the provider filter and resets pagination checks the button text, so both still pass with value removed. In the play function, get the "Select provider" button and assert toHaveTextContent("OpenAI").

🤖

🤖 This review was automatically generated with Coder Agents.

});
}
const filterMenus = {
provider: useProviderFilterMenu({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3 [CRF-3] A provider_name, client, or model URL value that the option lookup cannot match still filters the report, but its dropdown shows "All providers", "All clients", or "All models". (Nami, Mafuuu)

dimensions goes into the spend request unchanged, while getSelectedOption in useProviderFilterMenu and the Client and Model hooks returns null when nothing matches, so SelectFilter shows its placeholder; a scratch test rendering &provider_name=removed sent provider_name: "removed" to getOrganizationAISpendUsers while the button read "All providers". A user who opens a stale link, for example to a provider since removed from the config, reads a filtered report as unfiltered and cannot clear the filter from the dropdown, because there is no selected item to deselect; the combobox this PR removes showed the raw value as a removable chip. The root cause is getSelectedOption in the shared filter hooks, listed in the review body, so accepting this on the Spend page needs a human decision.

🤖

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.

Leaving this open for a human decision. This PR restores the pre-#29274 behavior as-is, and the root cause is getSelectedOption in the shared AI Bridge filter hooks, which the sessions list also uses. It is better handled in a follow-up to those hooks than in this revert.

Generated by Coder Agents on behalf of @tracyjohnsonux.

@tracyjohnsonux
tracyjohnsonux enabled auto-merge (squash) September 29, 2026 21:58
@tracyjohnsonux
tracyjohnsonux merged commit 6c6b6fe into main Sep 29, 2026
27 checks passed
@tracyjohnsonux
tracyjohnsonux deleted the spend-filter-dropdowns branch September 29, 2026 22:02
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants