feat(gitlab,bitbucket): warn when adding a repo already scoped on another connection - #9047
Open
mfrancisc wants to merge 2 commits into
Open
Conversation
…Bitbucket Add scope-duplicates API endpoints for GitLab and Bitbucket, mirroring the existing GitHub implementation, and generalize the config-ui data-scope-remote component and scope API client so the duplicate-connection warning works for all three plugins. Co-Authored-By: Cursor Agent <noreply@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-duplicatesandGET /plugins/bitbucket/scope-duplicatesdiagnostics (repos already on multiple connections) and a pre-add check
(
connectionId+gitlabIds/bitbucketIds)data-scope-remotecomponent and the scope APIclient 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/repoid. The new endpoint and query parsing handle this as a stringrather than assuming a numeric ID, including comma-separated
bitbucketIdsqueryvalues (e.g.
bitbucketIds=owner/repo-a,owner/repo-b).Testing
(
scope_duplicates_api_test.gofor each plugin), following the same teststructure as the existing GitHub tests.
docker-compose-dev-mysql.yml: confirmedGET /plugins/{github,gitlab,bitbucket}/scope-duplicatesall return200withthe expected
{"duplicates": [...]}shape, and that the Config UI bundleincludes the generalized
gitlabIds/bitbucketIdsquery-param logic.Follow-ups
GET /api/scope-duplicatesaggregator across all plugins