Skip to content

CSHARP-5984: Add QE prefix+suffix GA and rename API to string#2050

Open
adelinowona wants to merge 5 commits into
mongodb:mainfrom
adelinowona:csharp5984
Open

CSHARP-5984: Add QE prefix+suffix GA and rename API to string#2050
adelinowona wants to merge 5 commits into
mongodb:mainfrom
adelinowona:csharp5984

Conversation

@adelinowona

@adelinowona adelinowona commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the GA Queryable Encryption prefix/suffix string query types and renames the QE "text" API to "string", while keeping the experimental preview query types working on servers before 9.0.

  • Introduce StringOptions and EncryptionAlgorithm.String as the GA names for the QE string API.
  • Keep TextOptions and EncryptionAlgorithm.TextPreview as [Obsolete] deprecated aliases. TextPreview is translated to the String algorithm, so existing callers continue to work.
  • Add the stable prefix/suffix query types (server 9.0+).
  • Keep prefixPreview/suffixPreview (and substringPreview) working on servers before 9.0 — to be dropped later in DRIVERS-3548.
  • Bump libmongocrypt to 1.19.1 (restores the preview query types that 1.19.0 removed, via MONGOCRYPT-937).

Notes

  • The String enum member is declared after the existing TextPreview alias so TextPreview keeps its released ordinal.
  • The text explicit-encryption prose test is split by server-version requirement into GA, substring (preview), and prefix/suffix-preview variants. Cases 7-9 are GA-only and intentionally use the GA query types.

https://jira.mongodb.org/browse/CSHARP-5984 (DRIVERS-3321)

@adelinowona adelinowona requested a review from a team as a code owner June 23, 2026 16:01
@adelinowona adelinowona requested review from Copilot and papafe June 23, 2026 16:01
@adelinowona adelinowona added the feature Adds new user-facing functionality. label Jun 23, 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.

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Pull request overview

This PR updates the Queryable Encryption (QE) explicit-encryption surface to use the GA string naming (renaming the previous “textPreview/text” API), adds GA prefix/suffix query type support for server 9.0+, preserves preview query types for pre-9.0 servers, and bumps the bundled libmongocrypt version to 1.19.1.

Changes:

  • Rename QE explicit encryption API from TextString (options + algorithm enum usage) and update tests/spec prose coverage accordingly.
  • Add support for GA prefix/suffix query types on server 9.0+, while keeping prefixPreview/suffixPreview/substringPreview flows working where appropriate.
  • Bump libmongocrypt dependency metadata and version pins to 1.19.1 (including SBOM/purl updates).

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/MongoDB.Driver.Tests/Specifications/client-side-encryption/prose-tests/ClientEncryptionProseTests.cs Splits string explicit encryption coverage across GA vs preview vs substring-preview server ranges and updates query type selection.
tests/MongoDB.Driver.Tests/Encryption/EncryptOptionsTests.cs Updates unit tests for renamed algorithm/options and expanded valid string query types.
src/MongoDB.Driver/Core/Misc/Feature.cs Introduces new feature flags for string GA (9.0+) and preview query types (8.2+).
src/MongoDB.Driver.Encryption/MongoDB.Driver.Encryption.csproj Bumps LibMongoCryptVersion to 1.19.1.
src/MongoDB.Driver.Encryption/ExplicitEncryptionLibMongoCryptController.cs Switches explicit encryption context wiring from TextOptions to StringOptions.
src/MongoDB.Driver.Encryption/EncryptOptions.cs Renames TextOptions→StringOptions and updates validation to include GA prefix/suffix query types.
src/MongoDB.Driver.Encryption/EncryptionOptionsExtensions.cs Renames the options-to-document extension for StringOptions.
src/MongoDB.Driver.Encryption/EncryptionAlgorithm.cs Renames enum value TextPreview→String.
sbom.json Updates SBOM component metadata for libmongocrypt 1.19.1.
purls.txt Updates libmongocrypt purl to 1.19.1.
Files excluded by content exclusion policy (15)
  • specifications/client-side-encryption/prose-tests/etc/data/encryptedFields-prefix-suffix-ci-di.json
  • specifications/client-side-encryption/prose-tests/etc/data/encryptedFields-prefix-suffix-preview.json
  • specifications/client-side-encryption/prose-tests/etc/data/encryptedFields-prefix-suffix.json
  • specifications/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.json
  • specifications/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.json
  • specifications/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-prefix.json
  • specifications/client-side-encryption/tests/unified/QE-Text-prefix.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-prefixPreview.json
  • specifications/client-side-encryption/tests/unified/QE-Text-prefixPreview.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-suffix.json
  • specifications/client-side-encryption/tests/unified/QE-Text-suffix.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-suffixPreview.json
  • specifications/client-side-encryption/tests/unified/QE-Text-suffixPreview.yml

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/MongoDB.Driver.Encryption/EncryptOptions.cs
Comment thread src/MongoDB.Driver.Encryption/EncryptOptions.cs
Comment thread src/MongoDB.Driver.Encryption/EncryptOptions.cs
Comment thread src/MongoDB.Driver/Core/Misc/Feature.cs
Comment thread src/MongoDB.Driver.Encryption/EncryptionAlgorithm.cs

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.

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Pull request overview

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

Files excluded by content exclusion policy (15)
  • specifications/client-side-encryption/prose-tests/etc/data/encryptedFields-prefix-suffix-ci-di.json
  • specifications/client-side-encryption/prose-tests/etc/data/encryptedFields-prefix-suffix-preview.json
  • specifications/client-side-encryption/prose-tests/etc/data/encryptedFields-prefix-suffix.json
  • specifications/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.json
  • specifications/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.json
  • specifications/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-prefix.json
  • specifications/client-side-encryption/tests/unified/QE-Text-prefix.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-prefixPreview.json
  • specifications/client-side-encryption/tests/unified/QE-Text-prefixPreview.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-suffix.json
  • specifications/client-side-encryption/tests/unified/QE-Text-suffix.yml
  • specifications/client-side-encryption/tests/unified/QE-Text-suffixPreview.json
  • specifications/client-side-encryption/tests/unified/QE-Text-suffixPreview.yml

Comment thread src/MongoDB.Driver.Encryption/EncryptOptions.cs Outdated
Comment thread src/MongoDB.Driver.Encryption/EncryptOptions.cs Outdated
Add the GA Queryable Encryption "prefix"/"suffix" string query types and the "String" algorithm, with StringOptions as the replacement for TextOptions. The previous TextOptions, EncryptionAlgorithm.TextPreview, and Feature.Csfle2QEv2TextPreviewAlgorithm are retained as [Obsolete] aliases for backwards compatibility (TextPreview is translated to the "String" algorithm). The experimental prefixPreview/suffixPreview/substringPreview query types remain supported on servers before 9.0 and will be dropped later in DRIVERS-3548. Bump libmongocrypt to 1.19.1.
…st cases

Move the new String algorithm member after the deprecated TextPreview
alias so TextPreview keeps its released ordinal. Add a comment noting
that prose test cases 7-9 are GA-only and intentionally hardcode the GA
query types.
Rename QueryableEncryptionTextQueryTests to QueryableEncryptionStringQueryTests
and gate it on Csfle2QEv2StringAlgorithm (server 9.0+, GA prefix/suffix) instead
of the now-obsolete Csfle2QEv2TextPreviewAlgorithm, dropping the pre-9.0 version
cap. The substring query stays preview (substringPreview) but remains valid on
9.0, so it runs under the same gate.
The string-algorithm StringOptions and TextOptions constructors take
contentionFactor before keyId, but the XML docs listed keyId first.
Reorder the doc lines to match the signatures (addresses Copilot review).
@adelinowona adelinowona requested a review from BorisDog June 24, 2026 17:58
Comment thread src/MongoDB.Driver.Encryption/EncryptionAlgorithm.cs
Comment thread src/MongoDB.Driver.Encryption/EncryptOptions.cs
Comment thread src/MongoDB.Driver.Encryption/EncryptOptions.cs Outdated
Comment thread src/MongoDB.Driver/Core/Misc/Feature.cs Outdated
/// <summary>
/// Gets the csfle2 textPreview algorithm feature.
/// </summary>
[Obsolete("Use Csfle2QEv2StringAlgorithm instead.")]

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.

Shouldn't this refer to Csfle2QEv2StringPreviewAlgorithm (the preview one)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep, fixed. Though this feature isn't being used anywhere in our internal code anyway. Ideally I will just remove it but since this is a public class, apicompat will complain. I created CSHARP-6098 so we don't have to do this deprecation dance for this class anymore.

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.

I totally agree with the ticket 🙏

@adelinowona adelinowona requested review from BorisDog and papafe June 25, 2026 14:04

@BorisDog BorisDog 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.

LGTM

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

Labels

feature Adds new user-facing functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants