Use new getCodeCoverageSummary query for group coverage data because `all projects` doesn't work consistently
Problem to solve
As an Engineer I only want to have projects with coverage show up in the group repository analytics page so that projects that are irrelevant don't show up in the results. These irrelevant projects showing up make it harder to see meaningful data in the group repository analytics page.
Summary
On the group repositories analytics page, we have a section labeled "Latest test coverage results". There is a projects dropdown that allows you to select the projects you want to view in the table. If you select All projects
in the dropdown, sometimes the table doesn't actually show all the projects in the group that have coverage data.
Steps to reproduce
- Go to a group that has more than 100 projects (e.g. https://gitlab.com/groups/gitlab-org)
- Go to the group's repositories analytics page (https://gitlab.com/groups/gitlab-org/-/analytics/repository_analytics)
- In the projects dropdown in the "Latest test coverage results" section, click
All projects
- Note that not all projects in the group show in the table
What is the current bug behavior?
Only some of the group projects are showing up in the table.
What is the expected correct behavior?
All of the group projects that have coverage should show up in the table.
Relevant logs and/or screenshots
Note that all projects are selected, but the table doesn't show GitLab
or gitlab-runner
projects.
Proposal
- Run a migration to add a
namespace_id
foreign key todaily_build_group_report_results
. - Re-tool the GraphQL query (frontend) & resolver (backend) to do something like:
{
group(fullPath: "gitlab-org") {
projects(hasCodeCoverage: true, ids: ["gid://gitlab/Project/1"] #nil will default to all projects) {
nodes {
id
name
codeCoverageSummary {
averageCoverage
coverageCount
lastUpdatedOn
}
}
}
}
}
Other Possible fixes
We are trying to fetch all of the projects at once, but we are limited by the top 100 projects in the group. We need to implement two things in the GraphQL API:
- Add the ability to search by project ID in the group.projects query. We should be able to do the following:
query getGroupProjects($fullPath: String!, $projectIds: [ID!]) {
group(fullPath: $fullPath) {
projects(ids: $projectIds, first: 100) {
nodes {
fullPath
id
name
codeCoverageSummary {
averageCoverage
coverageCount
lastUpdatedOn
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
- Add the ability to filter out the projects that don't have coverage since they don't show up in the table. We should be able to do the following:
query getGroupProjects($fullPath: String!, $projectIds: [ID!]) {
group(fullPath: $fullPath) {
projects(ids: $projectIds, hasCodeCoverage: true, first: 100) {
nodes {
fullPath
id
name
codeCoverageSummary {
averageCoverage
coverageCount
lastUpdatedOn
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
We also need to change the frontend to use these two API changes to request all projects.
Documentation updates
- Add to the feature documentation that only projects that have a parsed coverage value will be available on the page.