Skip to content

Group Code Coverage should use default instead of hardcoded branch name

Summary

Users who have default branch names that aren't master do not get any data in the .csv download for group code coverage.

Steps to reproduce

  1. create a project with a default branch name that is anything bug master
  2. merge to the branch with a code coverage job that calculates coverage
  3. Navigate to the Group Repository Analytics and download the .csv file for all projects.

Example Project

N/A at this time

What is the current bug behavior?

The project name with a default branch that is not master is not present in the report.

What is the expected correct behavior?

All projects should be present.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Possible fixes

The team discussed doing batch queries grouped by default branch names, something like this:

where(project_id: [1,2,3,4,5], ref_path: 'refs/heads/main')
where(project_id: [6,7], ref_path: 'refs/heads/deployment-or-whatever')

Now that !45702 (merged) has been implemented, we should have the default branch name available for our query and this fix should be possible.

Ci::DailyBuildGroupReportResult.with_default_branch

Alternate Proposal

We could chain our new scope: with_default_branch (introduced in !45702 (merged)) to our existing finder to filter coverage only for the default branch. We might need to tweak our finder to make it ref_path agnostic in order to return the right data. I see here an opportunity to extend our existing finder to make it more flexible.

What would be the impact on the data returned if we were to chain it to the existing finder? (i.e. what does it return right now and what would it return with this change?)

Edited by Ricky Wiens