Repository navigation
PYTHON-5959 Drop prefixPreview, suffixPreview, and substringPreview APIs - #3181
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the transition from preview string-encryption query types to the stable APIs.
No open issues 🎉
What changed in this PR
Removes PyMongo’s beta string-encryption query types in favor of the stable APIs, aligning encryption support and CI with libmongocrypt 1.21.0.
Changes:
- Removes preview
QueryTypemembers and documents their stable replacements. - Makes string-encryption prose tests GA-only, adds removal regression coverage, and deletes preview fixtures and spec tests.
- Raises the pymongocrypt requirement to 1.21.0, updates the CI library pin, and removes preview-only Evergreen tasks.
| File | Description |
|---|---|
test/test_encryption.py |
Mirrors GA-only tests and preview-removal regression coverage. |
test/client-side-encryption/spec/unified/QE-Text-suffixPreview.json |
Deletes suffix-preview spec tests. |
test/client-side-encryption/spec/unified/QE-Text-substringPreview.json |
Deletes substring-preview spec tests. |
test/client-side-encryption/spec/unified/QE-Text-prefixPreview.json |
Deletes prefix-preview spec tests. |
test/client-side-encryption/etc/data/encryptedFields-substring-preview.json |
Deletes the substring-preview fixture. |
test/client-side-encryption/etc/data/encryptedFields-prefix-suffix-preview.json |
Deletes the prefix/suffix-preview fixture. |
test/asynchronous/test_encryption.py |
Uses stable query types and verifies preview members are removed. |
requirements/encryption.txt |
Raises the minimum pymongocrypt version to 1.21.0. |
pymongo/encryption_shared.py |
Removes preview enum members and documents the API change. |
doc/changelog.rst |
Documents removal and replacement requirements. |
.evergreen/scripts/setup_tests.py |
Pins libmongocrypt 1.21.0 and removes preview-specific dependency setup. |
.evergreen/scripts/generate_config.py |
Removes preview task generation and selection. |
.evergreen/generated_configs/variants.yml |
Removes preview tasks from encryption variants. |
.evergreen/generated_configs/tasks.yml |
Deletes the generated preview task. |
Review effort: Balanced
NoahStapp
left a comment
There was a problem hiding this comment.
Can we remove _string_opts_kwarg too now that text_opts is no longer supported?
| - Removed the beta ``QueryType.PREFIXPREVIEW``, ``QueryType.SUFFIXPREVIEW``, | ||
| and ``QueryType.SUBSTRINGPREVIEW`` query types. Use ``QueryType.PREFIX``, | ||
| ``QueryType.SUFFIX``, and ``QueryType.SUBSTRING`` instead (requires MongoDB | ||
| 9.0+ and pymongocrypt 1.21.0+) (`PYTHON-5959`_). |
There was a problem hiding this comment.
We should mention that this change also removes support for text_opts in favor of string_opts due to the pymongocrypt version bump.
|
|
||
| - The client handshake metadata now reports a detected coding agent in | ||
| ``client.env.agent`` (`PYTHON-5929`_). | ||
| - Removed the beta ``QueryType.PREFIXPREVIEW``, ``QueryType.SUFFIXPREVIEW``, |
There was a problem hiding this comment.
These should all use Sphinx role cross-references as per CODING-STANDARDS.md.
There was a problem hiding this comment.
We can't link to things that are removed
NoahStapp
left a comment
There was a problem hiding this comment.
More of a general question that this PR raised for me: this change requires pymongocrypt>=1.21.0,<2.0.0 for PyMongo 4.20. Shouldn't that mean that our encryption tests will always be using at least that version and so we don't need any gates or compatibility checks at all?
| - Removed the deprecated ``text_opts`` parameter of | ||
| :meth:`~pymongo.encryption.ClientEncryption.encrypt` and | ||
| :meth:`~pymongo.asynchronous.encryption.AsyncClientEncryption.encrypt`. | ||
| Use ``string_opts`` (`PYTHON-5959`_). |
There was a problem hiding this comment.
| Use ``string_opts`` (`PYTHON-5959`_). | |
| Use ``string_opts`` instead (`PYTHON-5959`_). |
| @@ -422,12 +422,6 @@ class TextOpts(StringOpts): | |||
There was a problem hiding this comment.
Can we remove this class entirely now that it's fully removed?
| string_opts = StringOpts(prefix={"strMinQueryLength": 2, "strMaxQueryLength": 10}) | ||
| with self.assertRaises(ConfigurationError): | ||
| encryption._resolve_string_opts(string_opts, string_opts) | ||
| def test_text_opts_is_removed(self): |
There was a problem hiding this comment.
I'm not sure this test adds meaningful coverage, especially since it needs to type: ignore two different arguments on an unbound method call.
| params = inspect.signature(encryption.AsyncExplicitEncrypter.encrypt).parameters | ||
| self.assertIn(encryption._string_opts_kwarg(), params) | ||
| class TestPreviewQueryTypesRemoved(AsyncPyMongoTestCase): | ||
| def test_preview_query_types_removed(self): |
There was a problem hiding this comment.
Similarly here, do we need to explicitly test that removed code no longer works?
| @async_client_context.require_libmongocrypt_min(1, 18, 1) | ||
| @async_client_context.require_version_min(9, 0, -1) | ||
| @async_client_context.require_libmongocrypt_min(1, 19, 0) | ||
| @async_client_context.require_pymongocrypt_min(1, 16, 0) |
There was a problem hiding this comment.
I don't think we can ever run a test with encryption that will fail this gate, should we just remove it?
|
GHA failures are tracked in DRIVERS-3728 |
PYTHON-5959
Changes in this PR
Removes the beta
QueryType.PREFIXPREVIEW,SUFFIXPREVIEW, andSUBSTRINGPREVIEWquery types; use the stableQueryType.PREFIX,QueryType.SUFFIX, andQueryType.SUBSTRINGinstead. libmongocrypt 1.21.0 (MONGOCRYPT-938) makes the preview query types a runtime error.Test Plan
QueryType.Checklist
Checklist for Author
Checklist for Reviewer