mfrancisc opened a new pull request, #9047:
URL: https://github.com/apache/devlake/pull/9047
## Summary
Follow-up to #9034, which added the duplicate-scope warning for GitHub. This
PR
extends the same feature to **GitLab** and **Bitbucket**, per the follow-up
noted
in that PR's description (originally tracked in #8947).
When the same repository/project is added under more than one connection,
DevLake
stores duplicate domain-layer records and metrics get inflated. The Config UI
previously allowed this with no warning for any plugin; #9034 fixed it for
GitHub
only. This PR brings GitLab and Bitbucket to parity.
This PR adds:
- `GET /plugins/gitlab/scope-duplicates` and `GET
/plugins/bitbucket/scope-duplicates`
diagnostics (repos already on multiple connections) and a pre-add check
(`connectionId` + `gitlabIds`/`bitbucketIds`)
- Generalization of the Config-UI `data-scope-remote` component and the
scope API
client so the same dismissible, non-blocking warning now renders for
GitHub,
GitLab, and Bitbucket alike, instead of being hardcoded to GitHub
Save is still allowed; users can choose to proceed intentionally, same as
before.
### Bitbucket-specific note
Unlike GitHub/GitLab (numeric scope IDs), Bitbucket identifies repositories
with a
string `owner/repo` id. The new endpoint and query parsing handle this as a
string
rather than assuming a numeric ID, including comma-separated `bitbucketIds`
query
values (e.g. `bitbucketIds=owner/repo-a,owner/repo-b`).
## Testing
- Added unit tests for both new endpoints' query parsing and row-grouping
logic
(`scope_duplicates_api_test.go` for each plugin), following the same test
structure as the existing GitHub tests.
- Verified locally end-to-end via `docker-compose-dev-mysql.yml`: confirmed
`GET /plugins/{github,gitlab,bitbucket}/scope-duplicates` all return `200`
with
the expected `{"duplicates": [...]}` shape, and that the Config UI bundle
includes the generalized `gitlabIds`/`bitbucketIds` query-param logic.
- Manually tried to add the same repo to multiple connections, see :
<img width="3300" height="635" alt="Screenshot 2026-08-12 at 15 44 48"
src="https://github.com/user-attachments/assets/48e8650e-4c04-4dc1-ba7e-c2d63db87a56"
/>
## Follow-ups
- global `GET /api/scope-duplicates` aggregator across all plugins
--
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]