Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore(site): replace handrolled AI spend types with generated types - #27342

Merged
EhabY merged 3 commits into
mainfrom
chore/replace-handrolled-ai-spend-types
Jul 22, 2026
Merged

chore(site): replace handrolled AI spend types with generated types#27342
EhabY merged 3 commits into
mainfrom
chore/replace-handrolled-ai-spend-types

Conversation

@EhabY

@EhabY EhabY commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

The groups and group members pages consumed AI spend through local ai_cost_control wrapper types with TODOs to switch to the generated contract. Both spend endpoints are now live, so this drops the handrolled types and uses the generated ones:

  • GET /organizations/{org}/groups/ai/spend -> OrganizationGroupsAISpend
  • GET /groups/{group}/members/ai/spend -> GroupMembersAISpend

The pages fetch identity (groups/members) and spend separately, then join by group_id/user_id at the container so each row gets a single enriched object.

AIGOV-509 changes a null effective_group_id to mean the budget resolves to a group in another org (an effective group always exists otherwise), so the member budget cells render the "managed by another org" state instead of unlimited.

Note: distinguishing unbudgeted members (no Everyone-group attribution) from members whose budget resolves to a group in another org depends on #27364. Until that merges, both render as the "another org" state.

Closes https://linear.app/codercom/issue/AIGOV-528/replace-handrolled-ai-spend-types-with-generated-types-in-groups-ui
Refs AIGOV-509

This PR was prepared by Coder Agents on behalf of @EhabY.

@linear-code

linear-code Bot commented Jul 20, 2026

Copy link
Copy Markdown

@EhabY
EhabY force-pushed the chore/replace-handrolled-ai-spend-types branch from 77ae704 to 78b21c0 Compare July 20, 2026 14:46

@EhabY EhabY Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I do not love having just "Another org" here. What do you think?

image

We could just put an em-dash in there with an info I suppose

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.

Good point, and I also don't think we have other parts on the UI where a different org is referenced. Maybe the em-dash makes sense and on the info we just say something like "This user's effective group is not on scope of the current org". cc @tracyjohnsonux

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done! Both cells now show an em-dash with the same info message: "This user's AI budget is managed by a group in another organization and isn't visible here." (waiting on Tracy if we need to change this)

@EhabY
EhabY marked this pull request as ready for review July 20, 2026 15:23
@EhabY
EhabY force-pushed the chore/replace-handrolled-ai-spend-types branch from e6b9066 to 8944247 Compare July 20, 2026 18:32
@EhabY
EhabY requested a review from ssncferreira July 20, 2026 19:10
Comment thread site/src/api/api.ts Outdated

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.

Good point, and I also don't think we have other parts on the UI where a different org is referenced. Maybe the em-dash makes sense and on the info we just say something like "This user's effective group is not on scope of the current org". cc @tracyjohnsonux

Comment thread site/src/pages/GroupsPage/GroupsPage.tsx
Comment thread site/src/pages/GroupsPage/GroupMemberBudgetCells.tsx
@EhabY
EhabY force-pushed the chore/replace-handrolled-ai-spend-types branch 2 times, most recently from 1181e90 to ea53960 Compare July 21, 2026 13:19
@EhabY
EhabY requested a review from ssncferreira July 21, 2026 13:19
Comment thread site/src/pages/GroupsPage/GroupMemberBudgetCells.tsx
EhabY and others added 2 commits July 22, 2026 11:16
The groups and group members pages consumed AI spend through local
ai_cost_control wrapper types with TODOs to switch to the generated
contract. Both spend endpoints are now live:

- GET /organizations/{org}/groups/ai/spend -> OrganizationGroupsAISpend
- GET /groups/{group}/members/ai/spend -> GroupMembersAISpend

Drop the handrolled types and join the generated spend rows onto groups
and members by group_id/user_id at the container, so each row gets a
single enriched object.

AIGOV-509 changes a null effective_group_id to mean the budget resolves
to a group in another org (an effective group always exists otherwise),
so the member budget cells render the "managed by another org" state
instead of unlimited.

Also:

- Toast and show a warning icon in the AI budget header when the spend
  fetch fails, matching the pages' existing error handling.
- Rename InfoIconTooltip to StatusIconTooltip with an info/warning kind.
@EhabY
EhabY force-pushed the chore/replace-handrolled-ai-spend-types branch from ea53960 to 8b2ff65 Compare July 22, 2026 08:16
@EhabY
EhabY requested a review from ssncferreira July 22, 2026 08:19

@ssncferreira ssncferreira 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.

LGTM :shipit: just a suggestion for the tests, but not blocking.
Great job 🚀

Comment thread site/src/api/api.test.ts Outdated
@EhabY
EhabY force-pushed the chore/replace-handrolled-ai-spend-types branch from 8b2ff65 to c2a2f18 Compare July 22, 2026 09:03
@EhabY
EhabY merged commit 6ec45f7 into main Jul 22, 2026
26 of 27 checks passed
@EhabY
EhabY deleted the chore/replace-handrolled-ai-spend-types branch July 22, 2026 09:17
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 22, 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