Skip to content

CSHARP-6194: Preserve version-to-name mapping in client metadata - #2149

Open
adelinowona wants to merge 1 commit into
mongodb:mainfrom
adelinowona:CSHARP-6194
Open

adelinowona wants to merge 1 commit into
mongodb:mainfrom
adelinowona:CSHARP-6194

Conversation

@adelinowona

@adelinowona adelinowona commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

CSHARP-6194 (split from DRIVERS-3251); spec change: mongodb/specifications#1975.

What

driver.name and driver.version in the handshake must now correspond one-to-one by index. Previously an appended library with no version was skipped in driver.version, so F1 (1.5), F2 (no version), F3 (3.5) produced 1.5|3.5 and the version of F3 looked like it belonged to F2. An unset version now contributes an empty entry (1.5||3.5), and trailing empty entries are kept.

The change itself is one line in ClientDocumentHelper.AppendLibraryInfosToDriverDocument. The rest of the spec change already holds: duplicate detection compares the whole LibraryInfo, and LibraryInfo rejects | in any field.

Appended library infos now always contribute one entry to each of driver.name and driver.version, using an empty entry for an unset version, so the two fields stay aligned by index (spec change DRIVERS-3251).

Adds prose tests 10 and 11 from the handshake spec and updates the existing tests that encoded the old behavior.
@adelinowona
adelinowona requested a review from a team as a code owner October 14, 2026 20:44
@adelinowona
adelinowona requested review from ajcvickers and a balanced review from Copilot October 14, 2026 20:44
@adelinowona adelinowona added the improvement Optimizations or refactoring (no new features or fixes). label Oct 14, 2026

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.

🟢 Approval recommended

The focused implementation preserves the required mapping and has relevant regression coverage, with no blocking issues identified.

0 open findings

What changed in this PR

Preserves index alignment between handshake driver names and versions by retaining empty version entries, including trailing entries.

Changes:

  • Appends a version entry for every library.
  • Updates unit expectations for missing versions.
  • Adds prose tests for index alignment and delimiter rejection.
File Description
tests/​MongoDB.Driver.Tests/​Specifications/​mongodb-handshake/​prose-tests/​MongoDbHandshakeProseTests.cs Adds alignment and delimiter-rejection cases; updates expectations.
tests/​MongoDB.Driver.Tests/​Core/​Connections/​ClientMetadataTests.cs Verifies missing versions retain their position.
tests/​MongoDB.Driver.Tests/​Core/​Connections/​ClientDocumentHelperTests.cs Updates expected version strings.
src/​MongoDB.Driver/​Core/​Connections/​ClientDocumentHelper.cs Preserves empty appended version entries.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@adelinowona
adelinowona requested review from BorisDog and removed request for ajcvickers October 14, 2026 20:46

@sanych-sun sanych-sun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM + minor suggestion

{
RequireServer.Check().Authentication(authentication: false);

var (name, version, platform) = testCase switch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we have InlineData instead of this switch?

This branch has not been deployed

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

Labels

improvement Optimizations or refactoring (no new features or fixes).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants