`ComplianceManagement::PendingStatusCheckWorker` enqueued with `nil` as `diff_head_sha`

Summary

ComplianceManagement::PendingStatusCheckWorker has failed repeatedly as it got enqueued for a nil diff_head_sha, resulting in Validation failed: Sha can't be blank raised from within the worker. All these failures originate from POST /api/:version/projects/:id/merge_requests.

This is potentially triggered by the remove_source_branch param of the Update MR API endpoint.

Steps to reproduce

n/a

Example Project

n/a

What is the current bug behavior?

ComplianceManagement::PendingStatusCheckWorker enqueued for a nil diff_head_sha.

What is the expected correct behavior?

TBD

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)

Possible fixes

Edited by Dominic Bauer