Removing confusing field from CosmosDBStorageConfig#377
Open
rodrigobr-msft wants to merge 12 commits into
Open
Removing confusing field from CosmosDBStorageConfig#377rodrigobr-msft wants to merge 12 commits into
rodrigobr-msft wants to merge 12 commits into
Conversation
Contributor
Author
|
Awaiting completion of end-to-end test harness before merging this. |
Contributor
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.
cfa398d to
71d32dc
Compare
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>
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>
| @@ -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>
Comment on lines
254
to
258
| 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, |
Comment on lines
+50
to
+54
| if "url" in kwargs: | ||
| warnings.warn( | ||
| "The 'url' parameter is deprecated. Please use 'cosmos_db_endpoint' instead.", | ||
| DeprecationWarning, | ||
| stacklevel=2, |
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.
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.