Search before asking
What happened
GitLab's makeScopeV200 in backend/plugins/gitlab/api/blueprint_v200.go does not create a repos scope in project_mapping when:
scopeConfig.Entities is empty (no default to all domain types)
- Only
DOMAIN_TYPE_CROSS is selected (not checked in the condition)
This differs from the GitHub plugin's makeScopesV200 which:
- Defaults empty entities to
plugin.DOMAIN_TYPES (line 155-157)
- Checks
DOMAIN_TYPE_CROSS in addition to CODE and CODE_REVIEW (line 160)
There is also an inconsistency within the GitLab plugin itself: makePipelinePlanV200 (line 129) already handles empty entities with len(scopeConfig.Entities) == 0, but makeScopeV200 does not.
Without the repos row in project_mapping, any downstream query that joins on pm.table = 'repos' returns zero rows, including:
- DORA change lead time calculator (
backend/plugins/dora/tasks/change_lead_time_calculator.go lines 85, 212, 256)
- PR-issue linker (
backend/plugins/linker/tasks/link_pr_and_issue.go lines 55, 73)
- All Grafana dashboard panels with PR metrics
What you expected to happen
GitLab's makeScopeV200 should create a repos scope in project_mapping consistently, matching the behavior of the GitHub and Bitbucket plugins.
How to reproduce
- Add a GitLab project to a DevLake project
- Configure scope config with entities that do not include CODE or CODE_REVIEW (e.g., only TICKET + CICD), or leave entities empty
- Run the blueprint
- Query
project_mapping and observe no row with table = 'repos'
- Observe that PR-related dashboard panels and DORA metrics show zero data
Anything else
The fix is a two-line change to makeScopeV200:
- Default empty entities to
plugin.DOMAIN_TYPES (matching GitHub's line 155-157)
- Add
plugin.DOMAIN_TYPE_CROSS to the repo scope condition (matching GitHub's line 160)
Note: the same issue also affects the Bitbucket (missing empty default) and Azure DevOps (missing both) plugins. If this fix is accepted, I am happy to submit follow-up PRs to apply the same fix to those plugins.
Version
main branch
Are you willing to submit PR?
Code of Conduct
Search before asking
What happened
GitLab's
makeScopeV200inbackend/plugins/gitlab/api/blueprint_v200.godoes not create areposscope inproject_mappingwhen:scopeConfig.Entitiesis empty (no default to all domain types)DOMAIN_TYPE_CROSSis selected (not checked in the condition)This differs from the GitHub plugin's
makeScopesV200which:plugin.DOMAIN_TYPES(line 155-157)DOMAIN_TYPE_CROSSin addition toCODEandCODE_REVIEW(line 160)There is also an inconsistency within the GitLab plugin itself:
makePipelinePlanV200(line 129) already handles empty entities withlen(scopeConfig.Entities) == 0, butmakeScopeV200does not.Without the
reposrow inproject_mapping, any downstream query that joins onpm.table = 'repos'returns zero rows, including:backend/plugins/dora/tasks/change_lead_time_calculator.golines 85, 212, 256)backend/plugins/linker/tasks/link_pr_and_issue.golines 55, 73)What you expected to happen
GitLab's
makeScopeV200should create areposscope inproject_mappingconsistently, matching the behavior of the GitHub and Bitbucket plugins.How to reproduce
project_mappingand observe no row withtable = 'repos'Anything else
The fix is a two-line change to
makeScopeV200:plugin.DOMAIN_TYPES(matching GitHub's line 155-157)plugin.DOMAIN_TYPE_CROSSto the repo scope condition (matching GitHub's line 160)Note: the same issue also affects the Bitbucket (missing empty default) and Azure DevOps (missing both) plugins. If this fix is accepted, I am happy to submit follow-up PRs to apply the same fix to those plugins.
Version
main branch
Are you willing to submit PR?
Code of Conduct