spiffaz opened a new pull request, #8751:
URL: https://github.com/apache/incubator-devlake/pull/8751
## Summary
- When `scopeConfig.Entities` is empty (common when no entities are
explicitly selected in the UI), `makeScopeV200` produced zero scopes, leaving
`project_mapping` with no rows
- The repo scope condition did not check for `DOMAIN_TYPE_CROSS`, so
selecting only CROSS would not create a repo scope, breaking DORA metrics
- Adds the same fixes applied to GitLab in #8743
- Adds unit tests for empty entities and CROSS entity scenarios
## How has this been tested?
```bash
docker run --rm -v $(pwd):/app -w /app/backend mericodev/lake-builder:latest
\
bash -c "go test ./plugins/azuredevops_go/api/ -v -run TestMakeScopes"
```
All tests pass (new + existing):
- `TestMakeScopes` - CODE + TICKET + CICD = 3 scopes
- `TestMakeScopesWithEmptyEntities` - empty entities defaults to all domain
types = 3 scopes
- `TestMakeScopesWithCrossEntity` - CROSS + TICKET = 2 scopes (repos +
boards)
- `TestMakeDataSourcePipelinePlanV200` - existing test still passes
- `TestMakeRemoteRepoScopes` - existing test still passes
## What is the fix?
1. After generating the domain ID, default empty entities to
`plugin.DOMAIN_TYPES`:
```go
if len(scopeConfig.Entities) == 0 {
scopeConfig.Entities = plugin.DOMAIN_TYPES
}
```
2. Add `DOMAIN_TYPE_CROSS` to the repo scope condition:
```go
if utils.StringsContains(scopeConfig.Entities,
plugin.DOMAIN_TYPE_CODE_REVIEW) ||
utils.StringsContains(scopeConfig.Entities, plugin.DOMAIN_TYPE_CODE) ||
utils.StringsContains(scopeConfig.Entities, plugin.DOMAIN_TYPE_CROSS) {
```
Closes #8749
--
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]