diff --git a/infisical_sdk/api_types.py b/infisical_sdk/api_types.py index 85b9eb0..4512016 100644 --- a/infisical_sdk/api_types.py +++ b/infisical_sdk/api_types.py @@ -689,7 +689,6 @@ class AgentVaultAccessBundleRef(BaseModel): class AgentVaultService(BaseModel): """A service in an Agent Vault access bundle. type is http, mcp, postgres, mysql or ssh, and the API returns only that type's fields: hostPattern, allowedMethods, allowedPathPrefixes, customHeaders and substitutions for http; serverUrl, transport, hostPattern, allowedTools and customHeaders for mcp; host, port, database and tls for postgres and mysql; host and port for ssh. Its nested settings, such as credential and tls ({"enabled", "verify", "ca"}), are left as the API returns them.""" id: str - accessBundleId: str name: str type: str hostPattern: Optional[str] = None diff --git a/tests/test_agent_vault.py b/tests/test_agent_vault.py index d7711fb..30dfd64 100644 --- a/tests/test_agent_vault.py +++ b/tests/test_agent_vault.py @@ -246,16 +246,19 @@ def test_access_bundles_list_reads_the_services_requiring_setup(api, agent_vault assert bundle.services is None -def test_access_bundles_get_reads_services_and_keeps_their_nested_settings(api, agent_vault, json_response): +# Servers still send accessBundleId on each service for older SDK releases; this one reads both shapes. +@pytest.mark.parametrize("legacy", [{}, {"accessBundleId": BUNDLE["id"]}], ids=["current", "with accessBundleId"]) +def test_access_bundles_get_reads_services_and_keeps_their_nested_settings(api, agent_vault, json_response, legacy): service = { - "id": SERVICE_ID, "accessBundleId": BUNDLE["id"], "name": "github", "type": "http", + "id": SERVICE_ID, "name": "github", "type": "http", "hostPattern": "api.github.com", "credential": {"type": "bearer", "memberProvidedFields": []}, "customHeaders": [], "substitutions": [], "personalValues": None, - "createdAt": BUNDLE["createdAt"], "updatedAt": BUNDLE["updatedAt"], + "createdAt": BUNDLE["createdAt"], "updatedAt": BUNDLE["updatedAt"], **legacy, } api.session.get.return_value = json_response({"accessBundle": dict(BUNDLE, services=[service])}) [read] = agent_vault.access_bundles.get(BUNDLE["id"]).services assert (read.name, read.credential["type"], read.variableReferences) == ("github", "bearer", None) + assert not hasattr(read, "accessBundleId") def test_access_bundles_update_sends_an_empty_description_to_remove_it(api, agent_vault, json_response): @@ -440,7 +443,7 @@ def test_sessions_create_keeps_the_servers_explanation_when_it_refuses_services( def test_access_bundles_get_reads_the_tools_an_mcp_service_allows(api, agent_vault, json_response): service = { - "id": SERVICE_ID, "accessBundleId": BUNDLE["id"], "name": "linear", "type": "mcp", + "id": SERVICE_ID, "name": "linear", "type": "mcp", "serverUrl": "https://mcp.linear.app/mcp", "transport": "streamable-http", "hostPattern": "mcp.linear.app", "allowedTools": ["list_issues"], "credential": {"type": "bearer", "memberProvidedFields": []}, "customHeaders": [], @@ -452,7 +455,7 @@ def test_access_bundles_get_reads_the_tools_an_mcp_service_allows(api, agent_vau def test_access_bundles_get_reads_database_and_ssh_services_without_http_fields(api, agent_vault, json_response): shared = { - "accessBundleId": BUNDLE["id"], "description": None, "variableReferences": [], "createdAt": BUNDLE["createdAt"], "updatedAt": BUNDLE["updatedAt"], + "description": None, "variableReferences": [], "createdAt": BUNDLE["createdAt"], "updatedAt": BUNDLE["updatedAt"], } postgres = dict(shared, id=SERVICE_ID, name="orders-db", type="postgres", host="db.internal", port=5432, database="orders", tls={"enabled": True, "verify": True, "ca": None},