Skip to content

[Cosmos][Spec] Adopt cross-SDK Hedging Detection API on DiagnosticsContext#4411

Draft
NaluTripician wants to merge 2 commits into
Azure:release/azure_data_cosmos-previewsfrom
NaluTripician:spec/hedging-detection-api
Draft

[Cosmos][Spec] Adopt cross-SDK Hedging Detection API on DiagnosticsContext#4411
NaluTripician wants to merge 2 commits into
Azure:release/azure_data_cosmos-previewsfrom
NaluTripician:spec/hedging-detection-api

Conversation

@NaluTripician
Copy link
Copy Markdown

Draft. This PR adopts the cross-SDK Hedging Detection API for the Rust SDK as a spec-only change. Refs #4410.

Targets release/azure_data_cosmos-previews (same as #4330). Doc-only — exactly one file changed.

What this PR does

Adds sdk/cosmos/azure_data_cosmos/docs/HEDGING_DETECTION_API_SPEC.md, which specifies three additive accessors on DiagnosticsContext (CosmosDiagnosticsContext re-export):

  • hedging_started() -> bool
  • requested_regions() -> Vec<&Region> (dispatch order, dups allowed)
  • responded_regions() -> Vec<&Region> (completion order, dups allowed)

plus the Retry → OperationRetry rename mechanics, the public re-export decision, and a reconciliation table against #4330's HEDGING_SPEC.md §10.

What this PR does NOT do

No production code. No tests. No CHANGELOG (drafted in the spec; landed by the future implementation PR).

Sequencing

  1. PR Cosmos: Adds Cross-Region Hedging Design Spec to Driver Crate #4330 merges first. Brings HEDGING_SPEC.md and the hedge_diagnostics: Option<HedgeDiagnostics> design contract onto release/azure_data_cosmos-previews.
  2. This spec PR merges.
  3. Future hedging implementation PR (populates HedgeDiagnostics, emits ExecutionContext::Hedging).
  4. Future Hedging Detection API implementation PR (adds the three accessors, performs the Retry → OperationRetry rename, lands the CHANGELOG entries drafted here).

Cross-references

Cross-SDK gate decisions reflected here

ID Decision Reflected in spec
Q4 Sibling spec file (not §10 amendment to #4330) File location
Q5 Wire-format break on ExecutionContext ACCEPTED. New variant serializes as "operation_retry"; #[serde(alias = "retry")] preserves back-deserialization; CHANGELOG entries on both crates explicit. No #[serde(rename = "retry")]. §4 + §9
Q6 Re-export Option B recommended (project to primitives; ExecutionContext stays driver-private) §5

Reviewers

cc @kundadebdatta @analogrelay @FabianMeiswinkel @simorenoh @NaluTripician

CODEOWNERS will auto-add @Azure/azure-cosmos-rust-sdk.

Refutations of cross-SDK design doc §10 (carried in spec §2 / §4.2)

  1. ExecutionContext::Hedging is not dispatched today (only Initial, Retry, TransportRetry, RegionFailover are emitted).
  2. ExecutionContext and RequestDiagnostics are not re-exported from azure_data_cosmos.
  3. The Retry → OperationRetry rename cannot be a #[deprecated] re-export — Rust has no enum-variant aliases. The correct mechanism is #[non_exhaustive] + new variant + #[deprecated] on the old variant + dispatch-site updates + #[serde(alias = "retry")] on the new variant.
  4. The cross-SDK accessors and Cosmos: Adds Cross-Region Hedging Design Spec to Driver Crate #4330's HedgeDiagnostics field coexist; reconciliation table in spec §6.

…ntext

Adds sdk/cosmos/azure_data_cosmos/docs/HEDGING_DETECTION_API_SPEC.md describing the cross-SDK Hedging Detection API for the Rust SDK. Spec-only PR — no production code changes. Sequenced after PR Azure#4330 and before any hedging implementation PR.

Refs Azure#4410

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cosmos The azure_cosmos crate high-availability

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants