Skip to content

Any approval rule contains users but should not

Any approval rule has been introduced in #13215 (closed). This rule shouldn't have users or groups by design, but customers complained that some of their any approval rules got in the state of having users which caused problems with creating a merge request: Approval rule name can't be blank is raised

Silver customer ran into this in ZD (internal only): the rule had users associated with it, when creating the MR - loaded in the UI through the api/v4/projects/:id/approval_settings, then passed to the backend back when creating the MR with name: "" but users in the user list, which causes the "Approval rule name can't be blank" validation error.

Support Summary

In Support, we've received at least 14 support tickets from customers since December of 2019 that involved this problem:

  1. 181010
  2. 160760
  3. 149413
  4. 143451
  5. 156809
  6. 145813
  7. 141465
  8. 158352
  9. 145447
  10. 177620
  11. 148369
  12. 177596
  13. 143489
  14. 155567
  15. 218987
  16. 255406
  17. 560697

Three customer accounts experienced the problem more than once, and so submitted multiple tickets with us over time. As of yet we do not know the cause, and so our only response is to fix the individual problem without knowing how to prevent it from happening again.

From ticket 181010, here are the notes on the actual steps taken to fix the problem:

We ran the following on .com prod to clear out the erroneous users associated to the default rule as Validated by Catalin in our testing environment.

p = Project.find_by_full_path(..)

double checking the correct project

ar = p.approval_rules.first

double checking the project rule

ar.users

get the list of user IDs

ar.users.map {|u| u.id}

double checking the users list associated to the project rule

ar.users = []
ar.save

double check it got saved

p.approval_rules.first.users

Edited by 🤖 GitLab Bot 🤖