Skip to content

Unable to view/edit Branch Rules in UI if over 100 branch rules

Summary

Only the first 100 branch rules for a project are returned by getBranchRulesEE. This is confirmed by checking the JSON payload. The default_max_page_size of 100 seems to be applied.

For customers with more than 100 branch rules for a project, they are unable to view or edit these via the UI, as the UI receives only the first 100 from the GraphQL query.

When this was in the Protected Branches section, it had pagination. This has since moved to Branch Rules, which has no pagination.

If I emulate the resolver logic, I get more than 100:

irb(main):006> protected_branches = project.all_protected_branches.sorted_by_name
=>
[#<ProtectedBranch:0x00007f1d8a7f35d8
...
irb(main):007* branch_rules = protected_branches.map do |protected_branch|
irb(main):008*   ::Projects::BranchRule.new(project, protected_branch)
irb(main):009> end
=>
[#<Projects::BranchRule:0x00007f1d863443d8
...
irb(main):010> branch_rules.count
=> 107

Steps to reproduce

  1. Create more than 100 branch rules for a project
  2. Go to Settings > Repository > Branch Rules

Example Project

What is the current bug behavior?

Only 100 are returned in the UI, and there's no pagination.

What is the expected correct behavior?

Either the limit is increased, or pagination exists to view/edit all rules.

Relevant logs and/or screenshots

Output of checks

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)

Possible fixes

Patch release information for backports

If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.

Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.

High-severity bug remediation

To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.

Edited by Michael Trainor