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:
- 181010
- 160760
- 149413
- 143451
- 156809
- 145813
- 141465
- 158352
- 145447
- 177620
- 148369
- 177596
- 143489
- 155567
- 218987
- 255406
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.savep.reload
double check it got saved
p.approval_rules.first.users