Deleted Branch Rule Approval Rules Unexpectedly Transfer to All Branches
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
When deleting a branch rule that has associated approval rules, the approval rules are automatically transferred to "All branches" instead of being deleted or prompting for user input on how to handle them.
This was reported by customer - Zendesk Internal Only
Steps to reproduce
- Create a branch rule for a specific branch (e.g.,
branch-for-branch-rules
) - Add an approval rule to this branch rule
- Verify that the approval rule is correctly associated with the specific branch
- Delete the branch rule
- Observe that the approval rule is automatically moved to "All branches"
Example Project
What is the current bug behavior?
When a branch rule is deleted, any associated approval rules are automatically transferred to the "All branches" configuration without user notification or confirmation.
What is the expected correct behavior?
One of the following should occur:
- Approval rules should be deleted along with their associated branch rule
- User should be prompted to choose what happens to the approval rules (delete/keep/transfer)
- Approval rules should remain specific to the branch but marked as inactive
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
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)
Workaround
Currently, users must:
- Before deleting a branch rule, note any associated approval rules
- Delete the branch rule
- Manually remove the approval rules that were transferred to "All branches"
- Recreate any necessary approval rules in their intended location
Proposed Solution
-
Short-term:
- Add a confirmation dialog when deleting branch rules with associated approval rules
- Provide options in the dialog for handling the approval rules
- Add warning notifications about approval rule transfer
-
Long-term:
- Implement proper cleanup of associated approval rules
- Add user preferences for handling orphaned approval rules
- Improve UI feedback when approval rules are affected by branch rule changes