spiffaz opened a new issue, #8742:
URL: https://github.com/apache/incubator-devlake/issues/8742

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   ### What happened
   
   GitLab's `makeScopeV200` in `backend/plugins/gitlab/api/blueprint_v200.go` 
does not create a `repos` scope in `project_mapping` when:
   1. `scopeConfig.Entities` is empty (no default to all domain types)
   2. 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
   
   1. Add a GitLab project to a DevLake project
   2. Configure scope config with entities that do not include CODE or 
CODE_REVIEW (e.g., only TICKET + CICD), or leave entities empty
   3. Run the blueprint
   4. Query `project_mapping` and observe no row with `table = 'repos'`
   5. Observe that PR-related dashboard panels and DORA metrics show zero data
   
   ### Anything else
   
   The fix is a two-line change to `makeScopeV200`:
   1. Default empty entities to `plugin.DOMAIN_TYPES` (matching GitHub's line 
155-157)
   2. 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?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to