Skip to content

operations: Return detailed error when reference update fails in merge

For quite some time we're already carrying a feature flag to switch UserMergeBranch to use detailed error types. This will eventually allow GitLab to decide why an RPC call has failed with much finer granularity and with more details about circumstances of the failure.

We haven't yet been able to roll out this change yet due to another incompatibility which has been introduced at the same point in time: when a reference update fails due to another racing RPC call which updated the same message we now return a FailedPrecondition error, whereas we previously returned success. But we now have the same issue here as we had with access errors: GitLab doesn't know what exactly happened based on the error code alone, so it's not able to introduce backwards-compatible handling of this new error.

Fix this by returning ReferenceUpdateErrors in case updating the reference has failed such that GitLab is in a better position to act on the error.

Note that this also changes the test setup to use a timestamp. This is done such that the new object ID referring to the merge commit is deterministic.

Part of #3757 (closed).

Merge request reports

Loading