[FF] validate_merge_request_branch_existence -- Validate branch existence on merge request creation

Summary

This issue is to roll out the feature on production, that is currently behind the validate_merge_request_branch_existence feature flag.

Introduced in: !225254 (merged)

Owners

  • Most appropriate Slack channel to reach out to: #g_code-review
  • Best individual to reach out to: @marc_shaw

Expectations

What are we expecting to happen?

When enabled, the API and all other creation paths will validate that source and target branches exist before creating a merge request. Previously, only the UI enforced this via BuildService, while the API allowed creating MRs with non-existent branches, resulting in broken MRs with null diff_refs and misleading has_conflicts: true states.

What can go wrong and how would we detect it?

  • Legitimate integrations or scripts that create MRs with branches that are being created concurrently might get 400 errors. We can monitor error rates on the MR creation API endpoint.
  • If issues arise, the feature flag can be immediately disabled to restore the previous behavior.

Rollout Steps

Note: Please make sure to run the chatops commands in the Slack channel that gets impacted by the command.

Rollout on non-production environments

  • Verify the MR with the feature flag is merged to master and has been deployed to non-production environments with /chatops gitlab run auto_deploy status <merge-commit-of-your-feature>
  • Enable the feature globally on non-production environments with /chatops gitlab run feature set validate_merge_request_branch_existence true --dev --pre --staging --staging-ref
  • Verify that the feature works as expected. The best environment to validate the feature in is staging-canary.

Before production rollout

Specific rollout on production

For visibility, all /chatops commands that target production must be executed in the #production Slack channel.

  • Ensure that the feature MRs have been deployed to both production and canary.
  • /chatops gitlab run feature set --project=gitlab-org/gitlab validate_merge_request_branch_existence true
  • Verify that the feature works for the specific projects.

Global rollout on production

  • /chatops gitlab run feature set validate_merge_request_branch_existence true
  • Verify that the feature works as expected.

Cleanup

After the feature flag has been enabled by default for a sufficient period:

  • Remove the feature flag, making the validation always active.
  • Remove the skip_branch_existence_check attribute if no longer needed.
  • Close this issue.