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

  1. User navigates to group members page (/groups/:group/-/group_members)
  2. User clicks on a member's role text (opens the new role details drawer - requires show_role_details_in_drawer feature flag)
  3. User changes the role and clicks "Update role"
  4. Frontend makes getBillableUsersCount GraphQL query to check for billing overages (requires show_overage_on_role_promotion feature flag)
  5. GraphQL resolver calls PreviewBillableUserChangeService
  6. Service incorrectly calls saas_billable_role_change? on self-managed instance
  7. Method raises InvalidSubscriptionTypeError because gitlab_com_subscription? returns false

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

  1. Enable both feature flags:

    Feature.enable(:show_role_details_in_drawer)
    Feature.enable(:show_overage_on_role_promotion)
  2. Create a group with members and try changing a member's role using the drawer UI

  3. Before fix: InvalidSubscriptionTypeError is raised

  4. 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.

Edited by Paulo Barros

Merge request reports

Loading