Fix circular import in the Azure KMS driver #2416
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 319 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.345
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2416"
general
weight: 0.35
pylaterreur
What
----
Importing
confluent_kafka.schema_registry.rules.encryption.azurekms.azure_clientbeforeazure_driverraisesImportError: cannot import name 'AzureKmsClient' from partially initialized module ... (most likely due to a circular import)on every Python version:azure_clientimports theazure_drivermodule for its key version helpers, andazure_driverimports theAzureKmsClientclass fromazure_client. For example,pytest tests/schema_registry/test_azure_client.pyfails at collection when run on its own.azure_drivernow imports theazure_clientmodule rather than the class, asazure_clientalready does forazure_driver, so the cycle resolves whichever module is imported first.The new
tests/test_imports.pyimports every submodule in a fresh interpreter, skipping modules whose optional dependencies are not installed.This is the part of #2401 that does not depend on Python 3.8.
Checklist
------------------
-
azure_clientcan be imported beforeazure_driver. No API change.-
tests/test_imports.py, which fails on master when therulesdependencies (tink, Azure SDK) are installed.References
----------
Replaces #2401: its Python 3.8 fix is moot once #2406 drops 3.8.
Test & Review
------------
requirements/requirements-tests-install.txt: on master,pytest tests/schema_registry/test_azure_client.pyerrors at collection, and the new test fails with theImportError; with this change, both files pass (7 tests).pytest tests --ignore=tests/integration: 2544 passed, 16 skipped. The full run does not show the bug on master, becausetests/schema_registry/_async/test_avro_serdes_rules.pyis collected beforetest_azure_client.pyand importsazure_driverfirst.tools/style-format.shon the changed files,flake8,mypy src/confluent_kafkaandtools/unasync.py --checkpass.Open questions / Follow-ups
--------------------------
confluent_kafka.aio(TypeError: 'type' object is not subscriptable, the bug #2401 fixed). No CI job runs the unit tests on 3.8, and #2406 drops 3.8.🤖 Generated with Claude Code
https://claude.ai/code/session_01GwUvhmzgfkiZ6vo4uGyesN