Uh oh!
There was an error while loading. Please reload this page.
Removing confusing field from CosmosDBStorageConfig - #377
Removing confusing field from CosmosDBStorageConfig#377Rodrigo Brandão (rodrigobr-msft) wants to merge 12 commits into
Conversation
Rodrigo Brandão (rodrigobr-msft)
commented
Apr 22, 2026
Awaiting completion of end-to-end test harness before merging this. |
There was a problem hiding this comment.
Pull request overview
This PR refactors Cosmos DB storage configuration by removing the ambiguous url field in favor of cosmos_db_endpoint, and tightens Cosmos client creation by validating required configuration up-front.
Changes:
- Removes
urlfromCosmosDBStorageConfigand updates configuration usage tocosmos_db_endpoint. - Updates
CosmosDBStorage._create_client()to requirecosmos_db_endpointand eithercredentialorauth_key, with clearerValueErrors. - Updates Cosmos storage tests to use
cosmos_db_endpoint.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tests/storage_cosmos/test_cosmos_db_storage.py | Updates Azure-credential test setup to pass cosmos_db_endpoint instead of the removed url. |
| libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/cosmos_db_storage_config.py | Removes the url config field/param and its docstring mention. |
| libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/cosmos_db_storage.py | Adds stricter client initialization validation and improved configuration error handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
cfa398d to
71d32dcCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| @@ -36,9 +36,8 @@ def __init__( | |||
| key characters. (e.g. not: '\\', '?', '/', '#', '*') | |||
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| cred = DefaultAzureCredential() | ||
| url = os.environ.get("TEST_COSMOS_DB_ENDPOINT") | ||
| cosmos_db_endpoint = os.environ.get("TEST_COSMOS_DB_ENDPOINT", "") | ||
| config = CosmosDBStorageConfig( | ||
| url=url, | ||
| cosmos_db_endpoint=cosmos_db_endpoint, | ||
| credential=cred, |
| if "url" in kwargs: | ||
| warnings.warn( | ||
| "The 'url' parameter is deprecated. Please use 'cosmos_db_endpoint' instead.", | ||
| DeprecationWarning, | ||
| stacklevel=2, |
This pull request refactors the Cosmos DB storage configuration and client initialization to improve clarity and error handling. The main changes include removing the ambiguous
urlparameter in favor of a more clearly namedcosmos_db_endpoint, updating client initialization logic to enforce required parameters, and improving error messages for missing configuration.Configuration and parameter changes:
urlparameter from theCosmosDBStorageConfigclass and replaced all usages withcosmos_db_endpointfor clearer intent. [1][2][3][4]Client initialization and validation improvements:
_create_clientmethod incosmos_db_storage.pyto requirecosmos_db_endpointand eithercredentialorauth_key, raising clearValueErrors if these are missing. This ensures that clients are only created with valid configurations and provides more helpful error messages. [1][2]Test updates:
cosmos_db_endpointparameter instead of the removedurlparameter.