Show rate limit errors for billable user preview UI
What does this MR do and why?
- Surfaces the backend rate limit on
gitlabSubscriptionsPreviewBillableUserChangein the UI. Without this, a throttled user sees nothing, and the invite modal lets the invite through without the seat overage check. - Covers the three callers: the invite modal, the role dropdown and the member drawer.
- No user-facing change until the limit is enforced. The rule only logs while
preview_billable_user_change_rate_limitis off, which is the default, so the UI never receives arate_limitederror.
Stacked MRs
| Order | MR | What it does |
|---|---|---|
| 1 | !271586 (merged) | backend - per-user rate limit on the field, behind preview_billable_user_change_rate_limit |
| 2 | This MR | frontend - show the rate limit error in the three callers |
References
- Related to: #637060
- Rollout issue: #640528
Screenshots or screen recordings
| Component | Screenshot |
|---|---|
| Invite modal (user) | ![]() |
| Invite modal (group) | ![]() |
| Role dropdown | ![]() |
| Member drawer | ![]() |
How to set up and validate locally
Setup
-
Create a test branch pulling in changes from this branch and the related backend changes from !271586 (merged)
-
Start GDK with SaaS simulation:
export GITLAB_SIMULATE_SAAS=1; gdk restart -
In the Rails console, set the application setting limit to
2ApplicationSetting.current.update!(preview_billable_user_change_limit: 2) -
In the Rails console, enable the feature flags:
Feature.enable(:preview_billable_user_change_rate_limit) Feature.enable(:show_overage_on_role_promotion) -
Use a top-level group with an Ultimate license where you are an Owner. For the invite modal, CDot must be running locally and report the group as eligible for seat reconciliation.
Trigger the rate limit
-
In GraphiQL, run this query 3 times:
query { group(fullPath: "<ultimate_group_path>") { gitlabSubscriptionsPreviewBillableUserChange(addUserIds: [<user_id>], role: DEVELOPER) { newBillableUserCount } } } -
The third run returns
nullwith the errorThis endpoint has been requested too many times. Try again later.andextensions.error_typeset torate_limited.
Test each UI below within a minute of the third run. If the limit has reset, run the query 3 times again.
Invite members modal
- Go to the group's Manage > Members and select Invite members.
- Add a member and select Invite.
- Expected: the modal stays open, shows the rate limit error under the member field, and does not send the invite.
Invite a group modal
- Go to the group's Manage > Members and select Invite a group.
- Add a group and select Invite.
- Expected: the modal stays open, shows the rate limit error under the group field, and does not send the invite.
Member drawer
- Go to the group's Manage > Members and find a member with the Guest role.
- Select Guest to open the Role details drawer.
- Select Developer from the Role dropdown, then select Update role.
- Expected: the drawer shows the rate limit error in an alert and the role is not changed.
Role dropdown
-
In the Rails console, disable the drawer so the Role column shows a dropdown:
Feature.disable(:show_role_details_in_drawer) -
Go to the group's Manage > Members and find a member with the Guest role.
-
Select the Guest dropdown and choose Developer.
-
Expected: an alert shows the rate limit error and the role goes back to Guest.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.



