[merge approvals] CODEOWNERS not immediately enforced on merge requests if Sidekiq is backed up
Summary
If Sidekiq is really backed up, tasks in the merge_request_sync_code_owner_approval_rules
queue (which as far as I can tell apply approval rules based on CODEOWNERS) can take some time to run, resulting in MRs which should require approval to be in a mergable state.
Steps to reproduce
- In a project on a GitLab EE instance that has a branch protected by a CODEOWNERS file, create a branch that modifies a file protected by CODEOWNERS
- Log in to the GitLab instance, and send
SIGSTOP
to allsidekiq
processes to simulate backed-up worker processes. - Create an MR using the branch created in the first step.
- Note that the MR says that "approval is optional"
- Send
SIGCONT
to allsidekiq
processes - Note that the MR is updated to require approvals.
Example Project
N/A
What is the current bug behavior?
A merge request that should require approvals is mergeable without approvals.
What is the expected correct behavior?
There are definitely a few possible approaches here - IMO, the right one would be to make sure all new MRs bound for CODEOWNERS-protected branches (as well as branches protected by any other mechanisms) are initialized in an "unmergeable - need to calculate approval rules" state, which the asynchronous sidekiq job would remove after applying approval rules.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)