Rails does not fully consume UserMergeBranch response stream
Rails' UserMergeBranch client logic does not consume the response stream to completion. This leads to multiple issues:
- The returned status from the server is ignored as Rails doesn't consume the stream to the end
- This leads to a race with transactions as Rails returns before the server has committed the transaction. Subsequent access to the data may fail it hasn't yet been committed.
- Rails yields the merge commit to the caller even before receiving the branch update. The transaction is not committed yet at this point and the yielded merge commit is not accessible.
- Test in https://gitlab.com/gitlab-org/gitlab/-/jobs/6669202366#L7536 relies on the commit yielding to exercise a concurrent reference update scenario.
- Failing jobs:
- https://gitlab.com/gitlab-org/gitlab/-/jobs/6669201700#L8230
- https://gitlab.com/gitlab-org/gitlab/-/jobs/6669202877#L8432
- https://gitlab.com/gitlab-org/gitlab/-/jobs/6669202821#L8820
- https://gitlab.com/gitlab-org/gitlab/-/jobs/6669202520#L8709
- https://gitlab.com/gitlab-org/gitlab/-/jobs/6669203753#L7835
- Rails yields the merge commit to the caller even before receiving the branch update. The transaction is not committed yet at this point and the yielded merge commit is not accessible.
Edited by Sami Hiltunen