Repository navigation
Include application version in Cosmos DB user agent - #210
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The user-agent version is derived from a different assembly than the version command, and the new regression test mirrors that mismatch so it may not actually enforce the stated contract.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the Cosmos DB client configuration so Cosmos DB SDK requests include a versioned application identifier (CosmosDBShell/<version>) in the user agent, aligned with the shell’s displayed version semantics (prerelease preserved, build metadata excluded). It also adds regression coverage for both Direct and Gateway connection modes and documents the behavior.
Changes:
- Set
CosmosClientOptions.ApplicationNametoCosmosDBShell/<displayVersion>so the Cosmos SDK user agent includes the app version. - Add a regression test covering both Direct and Gateway client-option creation.
- Document the versioned user agent behavior in user-facing docs.
File summaries
| File | Description |
|---|---|
| README.md | Documents that the shell identifies as CosmosDBShell/<version> in the Cosmos SDK user agent. |
| docs/connect.md | Documents that both Direct and Gateway connections include the versioned user agent, with prerelease/build-metadata rules. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.Core/ShellInterpreter.cs | Sets CosmosClientOptions.ApplicationName to include the display version. |
| CosmosDBShell.Tests/CommandTests/ConnectCommandTests.cs | Adds regression coverage to verify ApplicationName includes the expected version for both connection modes. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: C# C# / code-coverage/dotnetThe overall line coverage in commit 9c77bd0 in the Show a line coverage summary of the most impacted files.
Updated |
Include
CosmosDBShell/<version>in the Cosmos DB SDK user agent, using the same display version as theversioncommand. Prerelease labels are preserved and build metadata is excluded.Add client-options regression coverage for Direct and Gateway connections and document the versioned user agent.