Skip to content

Removing confusing field from CosmosDBStorageConfig#377

Open
rodrigobr-msft wants to merge 12 commits into
mainfrom
users/robrandao/cosmos-config
Open

Removing confusing field from CosmosDBStorageConfig#377
rodrigobr-msft wants to merge 12 commits into
mainfrom
users/robrandao/cosmos-config

Conversation

@rodrigobr-msft

Copy link
Copy Markdown
Contributor

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 url parameter in favor of a more clearly named cosmos_db_endpoint, updating client initialization logic to enforce required parameters, and improving error messages for missing configuration.

Configuration and parameter changes:

  • Removed the url parameter from the CosmosDBStorageConfig class and replaced all usages with cosmos_db_endpoint for clearer intent. [1] [2] [3] [4]

Client initialization and validation improvements:

  • Updated the _create_client method in cosmos_db_storage.py to require cosmos_db_endpoint and either credential or auth_key, raising clear ValueErrors if these are missing. This ensures that clients are only created with valid configurations and provides more helpful error messages. [1] [2]

Test updates:

  • Updated tests to use the new cosmos_db_endpoint parameter instead of the removed url parameter.

Copilot AI review requested due to automatic review settings April 22, 2026 19:17
@rodrigobr-msft rodrigobr-msft linked an issue Apr 22, 2026 that may be closed by this pull request
@rodrigobr-msft

Copy link
Copy Markdown
Contributor Author

Awaiting completion of end-to-end test harness before merging this.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 url from CosmosDBStorageConfig and updates configuration usage to cosmos_db_endpoint.
  • Updates CosmosDBStorage._create_client() to require cosmos_db_endpoint and either credential or auth_key, with clearer ValueErrors.
  • 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.

Comment thread tests/storage_cosmos/test_cosmos_db_storage.py Outdated
@kylerohn-msft kylerohn-msft force-pushed the users/robrandao/cosmos-config branch from cfa398d to 71d32dc Compare June 30, 2026 21:24
Copilot AI review requested due to automatic review settings June 30, 2026 21:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

kylerohn-msft and others added 2 commits June 30, 2026 15:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 30, 2026 22:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread tests/storage_cosmos/test_cosmos_db_storage.py Outdated
Comment thread tests/storage_cosmos/test_cosmos_db_storage.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 30, 2026 22:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread tests/storage_cosmos/test_cosmos_db_storage.py
Copilot AI review requested due to automatic review settings June 30, 2026 22:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 17:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread tests/storage_cosmos/test_cosmos_db_storage.py
@kylerohn-msft kylerohn-msft requested a review from axelsrz July 1, 2026 18:02
@kylerohn-msft kylerohn-msft marked this pull request as ready for review July 1, 2026 19:00
@kylerohn-msft kylerohn-msft requested a review from a team as a code owner July 1, 2026 19:00
Copilot AI review requested due to automatic review settings July 1, 2026 19:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

@@ -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>
Copilot AI review requested due to automatic review settings July 13, 2026 18:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

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,
Copilot AI review requested due to automatic review settings July 13, 2026 18:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify CosmosDBStorage configuration

3 participants