Fix suggested reviewers job not run for merge requests created on branch
What does this MR do and why?
This fixes a regression issue introduced by !102907 (merged) which causes the suggested reviewers job to stop running on merge requests created from a branch.
The modified_paths
check for FetchSuggestedReviewersWorker
depends on merge_request_diff
being persisted as part of NewMergeRequestWorker
. However, in a recent refactor, NewMergeRequestWorker
is scheduled to run after the check is invoked and hence causes this bug.
The user-facing feature is gated behind a feature flag suggested_reviewers_control
that is disabled by default to no change log is required.
🔬 Implementations
A sequence diagram of the new flow:
- this MR ensures these actions highlighted in
#f97f71
are performed in the correct order
How to set up and validate locally
- Ensure a SaaS (Gitlab.com) environment
- One way of doing this is to add a
env.runit
file to the root GDK folder with the following snippetexport GITLAB_SIMULATE_SAAS=1
- One way of doing this is to add a
- Set ultimate license on a group
http://gdk.test:3000/admin/groups
- Create a project in the ultimate group or use an existing one, e.g.
http://gdk.test:3000/gitlab-org/gitlab-test
- Set the feature flag on rails console
bundle exec rails c
project = Project.find(2) Feature.enable(:suggested_reviewers_control, project)
- Enable
suggested_reviewers_enabled
project settingsproject.project_setting.update!(suggested_reviewers_enabled: true)
- Edit a file (like
README.md
) and create a merge request on the project - Observe some failed workers in the Sidekiq logs (due to lack of authentication) and some failed jobs in the admin panel (http://gdk.test:3000/admin/sidekiq)
gdk tail rails-background-jobs | grep --line-buffered FetchSuggestedReviewersWorker
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #387161 (closed)