Skip to content

Conversation

blink1073
Copy link
Member

@blink1073 blink1073 commented Sep 9, 2025

Depends on mongodb/libmongocrypt#1065

  • Update libmongocrypt to 1.15.1. Done in PYTHON-5489
  • Sync spec tests for auto encryption. Done in PYTHON-5143.
  • Expose textPreview options. Pass them to libmongcrypt with mongocrypt_ctx_setopt_algorithm_text. Done in PYTHON-5531 and this PR.
  • Implement prose tests for explicit encryption. Done in this PR.

@blink1073 blink1073 marked this pull request as ready for review September 9, 2025 15:03
@blink1073 blink1073 requested a review from a team as a code owner September 9, 2025 15:03
@blink1073 blink1073 marked this pull request as draft September 9, 2025 15:03
@@ -516,6 +516,11 @@ class Algorithm(str, enum.Enum):

.. versionadded:: 4.4
"""
TEXTPREVIEW = "TextPreview"
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we required to call this TEXTPREVIEW instead of calling it TEXT and designating "feature preview"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, following the pattern we used for RANGEPREVIEW, to ensure that if the semantics change it won't do so silently.

@blink1073 blink1073 marked this pull request as ready for review September 9, 2025 16:47
@blink1073
Copy link
Member Author

@ShaneHarvey should we also bump the min dependency of pymongocrypt so users automatically pick up the right version?

@ShaneHarvey
Copy link
Member

We usually only bump the min version if the new pymongo version is incompatible. If that's not the case I'd say the version should remain the same.

"foobarbaz",
key_id=self.key1_id,
algorithm=Algorithm.TEXTPREVIEW,
contention_factor=0,
Copy link
Contributor

Choose a reason for hiding this comment

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

0 is the default right ? And if so do we need to include it here?

query_type=QueryType.PREFIXPREVIEW,
text_opts=text_opts,
)
# Expect an error from libmongocrypt with a message containing the string: "contention factor is required for textPreview algorithm".
Copy link
Contributor

Choose a reason for hiding this comment

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

Asked and answered!

Copy link
Contributor

@aclark4life aclark4life left a comment

Choose a reason for hiding this comment

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

LGTM

@blink1073 blink1073 merged commit d7316af into mongodb:master Sep 10, 2025
80 checks passed
@blink1073 blink1073 deleted the PYTHON-5328 branch September 10, 2025 15:35
@@ -905,6 +935,7 @@ async def _encrypt_helper(
contention_factor=contention_factor,
range_opts=range_opts_bytes,
is_expression=is_expression,
text_opts=text_opts_bytes,
Copy link
Member

Choose a reason for hiding this comment

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

Passing text_opts even when it's None will fail on old versions of pymongocrypt. So we need to bump the min version or avoid passing text_opts by default.

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.

3 participants