Call sm_billable_role_change? upon billable users change for SM
Resolves https://gitlab.com/gitlab-com/request-for-help/-/issues/3016+.
What does this MR do and why?
Fixes InvalidSubscriptionTypeError when changing member roles on self-managed instances with specific feature flag combinations.
The PreviewBillableUserChangeService was incorrectly calling saas_billable_role_change? for all instances, but this method should only be called on SaaS instances. For self-managed instances, it should call sm_billable_role_change? instead.
More details about the issue can be found at https://gitlab.com/gitlab-com/request-for-help/-/issues/3016+.
Frontend flow that triggers the bug
- User navigates to group members page (
/groups/:group/-/group_members) - User clicks on a member's role text (opens the new role details drawer - requires
show_role_details_in_drawerfeature flag) - User changes the role and clicks "Update role"
- Frontend makes
getBillableUsersCountGraphQL query to check for billing overages (requiresshow_overage_on_role_promotionfeature flag) - GraphQL resolver calls
PreviewBillableUserChangeService - Service incorrectly calls
saas_billable_role_change?on self-managed instance - Method raises
InvalidSubscriptionTypeErrorbecausegitlab_com_subscription?returnsfalse
Why this affects few customers
This issue only occurs when both feature flags are enabled:
-
show_role_details_in_drawer(beta, default enabled in 17.2+) -
show_overage_on_role_promotion(development, default disabled)
Most customers don't have the second flag enabled, which explains why this is rarely reported.
How to set up and validate locally
-
Enable both feature flags:
Feature.enable(:show_role_details_in_drawer) Feature.enable(:show_overage_on_role_promotion) -
Create a group with members and try changing a member's role using the drawer UI
-
Before fix:
InvalidSubscriptionTypeErroris raised -
After fix: Role change works correctly
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.