Repository navigation
fix(mcp): Return only the email domain in list_cloud_organizations; fill workspace_url in list_cloud_workspaces
#1377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Aaron ("AJ") Steers (aaronsteers)
merged 2 commits into
release-candidate/v1
from
devin/1792013722-org-email-domain-workspace-url
Oct 16, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1688,6 +1688,99 @@ def get_organization( | |
| assert result.name == "Organization" | ||
|
|
||
|
|
||
| def test_mcp_describe_cloud_organization_returns_email_and_domain( | ||
| monkeypatch: pytest.MonkeyPatch, | ||
| ) -> None: | ||
| """`describe_cloud_organization` reports the contact email and its domain.""" | ||
| _stub_organization_features(monkeypatch) | ||
|
|
||
| class DiscoveryClient: | ||
| def get_organization(self, **_: object) -> CloudOrganization: | ||
| return CloudOrganization( | ||
| organization_id="organization-id", | ||
| organization_name="Organization", | ||
| email="[email protected]", | ||
| ) | ||
|
|
||
| monkeypatch.setattr(mcp_cloud, "_get_cloud_client", lambda _: DiscoveryClient()) | ||
|
|
||
| result = mcp_cloud.describe_cloud_organization( | ||
| None, organization_id="organization-id", organization_name=None | ||
| ) | ||
|
|
||
| assert result.email == "[email protected]" | ||
| assert result.email_domain == "example.com" | ||
|
|
||
|
|
||
| def test_mcp_list_cloud_organizations_hides_email_and_reports_domain( | ||
| monkeypatch: pytest.MonkeyPatch, | ||
| ) -> None: | ||
| """`list_cloud_organizations` omits contact emails and reports only the domain.""" | ||
| _stub_organization_features(monkeypatch) | ||
|
|
||
| class DiscoveryClient: | ||
| def list_organizations(self, **_: object) -> list[CloudOrganization]: | ||
| return [ | ||
| CloudOrganization( | ||
| organization_id="organization-id", | ||
| organization_name="Organization", | ||
| email="[email protected]", | ||
| ) | ||
| ] | ||
|
|
||
| monkeypatch.setattr(mcp_cloud, "_get_cloud_client", lambda _: DiscoveryClient()) | ||
|
|
||
| result = mcp_cloud.list_cloud_organizations(None) | ||
|
|
||
| assert result.organizations[0].email is None | ||
| assert result.organizations[0].email_domain == "example.com" | ||
|
|
||
|
|
||
| def test_cloud_organization_email_falls_back_to_org_listing( | ||
| monkeypatch: pytest.MonkeyPatch, | ||
| ) -> None: | ||
| """An org resolved via `get_organization_info` still resolves its email once.""" | ||
| monkeypatch.setattr( | ||
| api_util, | ||
| "get_organization_info", | ||
| lambda **_: {"organizationId": "organization-id"}, | ||
| ) | ||
| list_calls: list[object] = [] | ||
|
|
||
| class _OrganizationResponse: | ||
| organization_id = "organization-id" | ||
| email = "[email protected]" | ||
|
|
||
| monkeypatch.setattr( | ||
| api_util, | ||
| "list_organizations_for_user", | ||
| lambda **_: list_calls.append(_) or [_OrganizationResponse()], | ||
| ) | ||
| organization = CloudOrganization("organization-id", bearer_token="token") | ||
|
|
||
| assert organization.email == "[email protected]" | ||
| assert organization.email == "[email protected]" | ||
| assert len(list_calls) == 1 | ||
|
|
||
|
|
||
| def test_cloud_organization_email_domain() -> None: | ||
| """`email_domain` is the lowercased domain of the contact email, or None.""" | ||
| assert ( | ||
| CloudOrganization( | ||
| organization_id="organization-id", | ||
| email="[email protected]", | ||
| ).email_domain | ||
| == "sub.example.com" | ||
| ) | ||
| assert ( | ||
| CloudOrganization( | ||
| organization_id="organization-id", | ||
| email="not-an-email", | ||
| ).email_domain | ||
| is None | ||
| ) | ||
|
|
||
|
|
||
| def test_cloud_client_get_organization_uses_unbounded_organization_list( | ||
| monkeypatch: pytest.MonkeyPatch, | ||
| ) -> None: | ||
|
|
@@ -2888,6 +2981,7 @@ def test_mcp_list_cloud_workspaces_discovery( | |
|
|
||
| class DiscoveryClient: | ||
| organization_id: str | None = None | ||
| public_api_root: str = api_util.CLOUD_API_ROOT | ||
|
|
||
| def list_workspaces( | ||
| self, *, organization_id: str | None = None, **_: object | ||
|
|
@@ -2921,6 +3015,9 @@ def get_organization(self, *, organization_id: str) -> CloudOrganization: | |
| assert "permission" in (result.message or "") | ||
| else: | ||
| assert result.workspaces[0].workspace_id == "workspace-id" | ||
| assert result.workspaces[0].workspace_url == ( | ||
| "https://cloud.airbyte.com/workspaces/workspace-id" | ||
| ) | ||
| assert result.workspaces[1].organization_id is None | ||
| assert result.workspaces[0].organization_name == organization_name | ||
| assert result.workspaces[1].organization_name is None | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -725,6 +725,7 @@ def test_describe_cloud_organization_excludes_billing_fields( | |
| organization_id="org-id", | ||
| organization_name="Organization", | ||
| email="[email protected]", | ||
| email_domain="example.com", | ||
| enabled_features=[], | ||
| ) | ||
| monkeypatch.setattr( | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.