List the workspaces a Bitbucket account can reach - #177
Open
HarshMN2345 wants to merge 5 commits into
Open
Conversation
Only the first workspace was ever reported, because getOwnerName() reads /user/workspaces and keeps values[0]. The same response describes every workspace, so listing them costs nothing extra and lets a caller pick the one a repository belongs in.
HarshMN2345
requested review from
Meldiron,
abnegate,
eldadfux and
loks0n
as code owners
August 30, 2026 19:10
Listing namespaces reads it to tell a personal workspace from a team one, and every call was fetching /user again.
Member
Author
|
@greptile review |
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.
What
listNamespaces()was never implemented for Bitbucket, so the abstractGitdefault threw and Bitbucket reported no namespaces at all. Consumers fall back to a single owner, which is whatevergetOwnerName()returns -- and that reads/user/workspacesand keepsvalues[0]. An account in several workspaces could only ever see the first one, with no way to pick between them.The same response already describes every workspace, so this maps it to the shared namespace shape instead of discarding all but the first entry.
Kind
The shared contract expects a
userand agroupkind, which is whysupportsNamespaceListingwas previously off for Bitbucket -- a workspace carries no personal-vs-team flag. It does carry the identity of its owner though, so the account's own workspace is found by matching the uuid from/user, falling back to the slug. That distinction is real; it just isn't a field.Test plan
bin/monorepo check vcs-- pint, PHPStan and Rector all passbin/monorepo test vcs-- 559 tests pass (Bitbucket skips locally without a token)supportsNamespaceListingis no longer overridden inBitbucketTest, sotestListNamespacesandtestListNamespacesWithSearchnow run against Bitbucket in CIWorth a reviewer's eye:
testListNamespacesasserts both auserand agroupkind are present, so it needs the test account to belong to its own workspace and at least one team workspace. That is the case for the account CI uses today, but it is a property of the account rather than of the code.