MergeRequest hook data is missing relevant changes when called on create
Summary
When creating a MR, in IssuableBaseService#create
the changes (i.e. the merge_request.previous_changes include all the applied values). But at MergeRequest#hook_data
they do not, and instead contain only the merge_status.
My current theory is that the merge_status is being saved when it is applied, which would flush all the other changes. In particular I think that is happening at MergeRequests::CreateService#after_create
which restores the previous behaviour when commented out.
This seems to have been introduced by this commit and has affected a customer.
There is a work-around: for newly created MRs, all the attributes are new, and can be read from the main payload body.
Steps to reproduce
Subscribe to a MR hook, create a MR - see that changes is mostly empty, except for merge_status
.
What is the current bug behavior?
The changes
in the payload only contains merge_status
.
What is the expected correct behavior?
Changes should contain all attributes for a new MR.
Output of checks
This bug happens on GitLab.com