Refactor Azure Core from Driver Spec#3838
Refactor Azure Core from Driver Spec#3838tvaron3 wants to merge 9 commits intoAzure:release/azure_data_cosmos-previewsfrom
Conversation
Documents the 149 azure_core references across 4 categories (HTTP pipeline, errors, credentials, utilities) and proposes a 4-phase migration plan using direct ecosystem crates (http, hmac, sha2, time, bytes) plus driver-owned abstractions. Relates to Azure/azure-sdk-for-python#45463 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…om/Azure/azure-sdk-for-rust into tvaron3/coreDependency
Shifts approach from driver duplicating types to extracting azure_core_credentials and azure_core_hmac crates that both azure_core and the driver can share. The driver then depends on typespec_client_core directly for HTTP pipeline types. No breaking changes to azure_core consumers since it re-exports the new crates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replaces the 3-crate approach (typespec_client_core + azure_core_credentials + azure_core_hmac) with a single azure_core_shared crate that re-exports only the HTTP primitives the driver needs plus credentials and HMAC. Key change: instead of exposing all of typespec_client_core (including unused retry policies, pipeline builder, streaming, etc.), the new crate provides a controlled API surface with only the types the driver actually uses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sdk/cosmos/azure_data_cosmos_driver/doc/refactor-azure-core-dependency-spec.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Adds a design/spec document for decoupling azure_data_cosmos_driver from azure_core to reduce version coupling and better support the driver’s independent versioning and cross-language consumption.
Changes:
- Introduces a spec describing current
azure_coreusage in the driver (HTTP, errors, credentials, utilities). - Proposes a new
azure_core_sharedcrate as a lean dependency surface for the driver (plus a re-export strategy forazure_core). - Lays out a phased migration plan for introducing the crate and switching the driver.
sdk/cosmos/azure_data_cosmos_driver/doc/refactor-azure-core-dependency-spec.md
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure_data_cosmos_driver/doc/refactor-azure-core-dependency-spec.md
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure_data_cosmos_driver/doc/refactor-azure-core-dependency-spec.md
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure_data_cosmos_driver/doc/refactor-azure-core-dependency-spec.md
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure_data_cosmos_driver/doc/refactor-azure-core-dependency-spec.md
Show resolved
Hide resolved
- Re-export ClientMethodOptions (TokenRequestOptions public field) - Add Type Compatibility Guarantee section explaining re-export identity across crate boundaries - Document feature flag passthrough as known tradeoff - Clarify azure_identity compatibility path - Note base64 is internal-only in azure_core_shared - Add workspace Cargo.toml step to Phase 1 - Fix cspell: versionable → versioned Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Include sleep/async_runtime in azure_core_shared (driver is runtime-agnostic) - Correct inaccurate 'uses tokio directly' claims - Reshape TokenRequestOptions to use Context instead of ClientMethodOptions - Document ClientOptions leak (RetryOptions/LoggingOptions present but ignored) - Use portable perl command instead of macOS-specific sed - Update risk assessment for reshaped TokenRequestOptions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
|
||
| ## Problem Statement | ||
|
|
||
| The `azure_data_cosmos_driver` crate depends on `azure_core` for HTTP infrastructure, credentials, error types, and utilities. Per the multi-crate versioning strategy (AGENTS.md), the driver should be independently versioned from the SDK layer. The `azure_core` dependency creates version coupling — breaking changes in `azure_core` force driver major version bumps even when the driver's own API is stable. |
There was a problem hiding this comment.
At least from my perspective major version changes in azure_core requiring major updates in azure_data_cosmos_driver is not a big problem - it would happen rarely anyway.
And any SDK layering on to of azure_data_cosmos_native will likely use binaries anyway?
|
|
||
| Since the driver is consumed by `azure_data_cosmos_native` (C FFI for Java/.NET/Python SDKs), minimizing heavy Azure-specific dependencies reduces binary size and cross-language complexity. | ||
|
|
||
| The previous revision of this spec proposed having the driver depend on `typespec_client_core` directly, but `typespec_client_core` includes significant functionality the driver never uses (retry policies, pipeline builder, logging policies, streaming, sleep abstractions, tracing module, etc.). The driver only needs the HTTP primitive types and a handful of Azure-specific types (credentials + HMAC). |
There was a problem hiding this comment.
+1 on this - this is the main concern from my perspective
| │ # FixedRetryPolicy, RetryOptions, Pipeline struct, | ||
| │ # TransportPolicy, logging policy, PipelineOptions, | ||
| │ # LoggingOptions, ClientMethodOptions, | ||
| │ # sleep, async_runtime, stream/BytesStream, |
There was a problem hiding this comment.
I think async_runtime will actually be used (ifnot yet very soon)
|
This looks good to me, and is a good trigger for having a discussion about whether we actually need this abstraction. If this is just a "proxy" package that mostly just re-exports things from other layers, I'm not sure we actually need it. The driver will be a self-contained dynamic library that only includes the code it actually used from The spec is good, but it's definitely making me wonder if we need a hard boundary of a crate here or if we can just be disciplined about what we use from Let's chat about it at the next sync |
Documents the 149 azure_core references across 4 categories (HTTP pipeline, errors, credentials, utilities) and proposes a 4-phase migration plan using direct ecosystem crates (http, hmac, sha2, time, bytes) plus driver-owned abstractions.
Relates to #3845