Skip to content

cosmos operation options abi - #5366

Merged
Tomas Varon (tvaron3) merged 15 commits into
Azure:mainfrom
tvaron3:tvaron3-cosmos-operation-options-abi
Oct 1, 2026
Merged

Tomas Varon (tvaron3) merged 15 commits into
Azure:mainfrom
tvaron3:tvaron3-cosmos-operation-options-abi

Conversation

@tvaron3

@tvaron3 Tomas Varon (tvaron3) commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Expose the remaining shared Cosmos operation options through the native C ABI so language bindings can use the Rust configuration hierarchy without duplicating retry, routing, or hedging policies.

  • Extend cosmos_operation_options_t with throughput bucket/priority, throttling retry count/wait, hedging enablement, and availability strategy/threshold. Support the complete uint32_t failover/session retry range and explicit-empty excluded regions.
  • Add runtime operation defaults, atomic replacement, and an admission-snapshot API. Preserve independently inherited nested fields, whole-group binary settings, and environment override precedence.
  • Keep the captured configuration and elapsed timeout budget through initialization and execution. Operation-triggered account refreshes retain the admitted throttle policy across primary, regional, and HTTP-version recovery paths; independent background refreshes use current defaults.
  • Honor operation-level endpoint-unavailability TTL without mutating sibling operations' cooldown settings.
  • Restore asynchronous cancellation with exactly one terminal completion and retained patch tracking identity. An already-ready result wins over cancellation.
  • Add internal #[option(skip)] support to CosmosOptions, compatible with conditional fields; update generated headers/API artifacts, documentation, and regression coverage. Also fix the upstream emulator tests' feature-gated ETAG import.

Merge upstream main through ebfe5bf while preserving runtime-shared container caches and native operation-option parity.

Expose ABI 0.2.0 runtime defaults, atomic updates, full-width counts, and admission snapshots. Keep recovery refreshes on the admitted policy and retain completion-safe cancellation.

Combine conditional macro fields with skipped internal state, adopt upstream API artifact paths, and make ETAG available to emulator tests without the distributed-transaction preview feature.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the Cosmos The azure_cosmos crate label Sep 28, 2026
@tvaron3 Tomas Varon (tvaron3) changed the title Tvaron3 cosmos operation options abi cosmos operation options abi Sep 28, 2026
Add PR references to the driver and macro release notes, and remove unnecessary blank lines from the changelog and generated Default template.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve upstream API cleanup and binary RawValue support while replacing direct ExcludedRegions tuple construction with public builders and FromIterator. This resolves the shared E0423 failure blocking PR and live-test setup.

Keep both upstream and PR-specific changelog entries. Preserve configuration snapshots and shared runtime container caches.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adopt upstream error type unification and use the public status_codes::substatus timeout constant in native snapshots and deadline assertions. Preserve the existing 408/20008 status and snapshot behavior.

Validate the combined upstream and PR source with the CI setup check, workspace Clippy, driver/native/macro tests, repository analysis and the C ABI suite.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrate upstream native fault injection, account hedging suppression, and fallible EPK conversions while preserving admitted configuration snapshots and shared runtime caches.

Resolve documentation conflicts, adapt the new refresh test callback, and complete the native fault-injection fixture's partition topology change feed with a terminal 304 response.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@tvaron3
Tomas Varon (tvaron3) marked this pull request as ready for review September 29, 2026 13:49
@tvaron3
Tomas Varon (tvaron3) requested a review from a team as a code owner September 29, 2026 13:49
Copilot AI balanced review requested due to automatic review settings September 29, 2026 13:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Public cancellation and option-encoding documentation is inconsistent, and one Rust call is not rustfmt-compliant.

Review effort: Balanced
Findings: 1 High severity · 2 Low severity

Open (3)
What changed in this PR

Expands Cosmos native operation configuration while preserving admission-time behavior across retries, routing, initialization, and cancellation.

Changes:

  • Adds #[option(skip)] for internal layered-option state.
  • Introduces the breaking native ABI 0.2.0 operation options and admission snapshot APIs.
  • Preserves operation policies through refreshes, routing, deadlines, and cancellation.
File Description
Cargo.lock Updates the native crate version.
sdk/​cosmos/​azure_data_cosmos_macros/​CHANGELOG.md Records option(skip).
sdk/​cosmos/​azure_data_cosmos_macros/​README.md Documents skipped fields.
sdk/​cosmos/​azure_data_cosmos_macros/​src/​builder.rs Omits setters for skipped fields.
sdk/​cosmos/​azure_data_cosmos_macros/​src/​lib.rs Documents and tests skipping.
sdk/​cosmos/​azure_data_cosmos_macros/​src/​parse.rs Parses and validates skip.
sdk/​cosmos/​azure_data_cosmos_macros/​src/​view.rs Omits skipped accessors.
sdk/​cosmos/​azure_data_cosmos_macros/​tests/​derive_cosmos_options.rs Tests conditional skipped state.
sdk/​cosmos/​azure_data_cosmos_driver/​CHANGELOG.md Records routing and refresh fixes.
sdk/​cosmos/​azure_data_cosmos_driver/​src/​driver/​cosmos_driver.rs Propagates pinned throttle policies.
sdk/​cosmos/​azure_data_cosmos_driver/​src/​driver/​pipeline/​operation_pipeline.rs Resolves TTL per operation.
sdk/​cosmos/​azure_data_cosmos_driver/​src/​driver/​routing/​location_state_store.rs Applies operation-aware refresh options.
sdk/​cosmos/​azure_data_cosmos_driver/​src/​in_memory_emulator/​operations.rs Corrects feature-gated ETAG import.
sdk/​cosmos/​azure_data_cosmos_driver/​src/​options/​operation_options.rs Adds snapshots and TTL environment parsing.
sdk/​cosmos/​azure_data_cosmos_driver_native/​CMakeLists.txt Bumps pkg-config ABI version.
sdk/​cosmos/​azure_data_cosmos_driver_native/​Cargo.toml Bumps crate version to 0.2.0.
sdk/​cosmos/​azure_data_cosmos_driver_native/​README.md Documents ABI 0.2 behavior.
sdk/​cosmos/​azure_data_cosmos_driver_native/​api.md Updates exported API artifacts.
sdk/​cosmos/​azure_data_cosmos_driver_native/​build.rs Names the snapshot C type.
sdk/​cosmos/​azure_data_cosmos_driver_native/​c_tests/​account_and_driver_options.c Exercises expanded options.
sdk/​cosmos/​azure_data_cosmos_driver_native/​c_tests/​counted_strings.c Updates ABI layout assertions.
sdk/​cosmos/​azure_data_cosmos_driver_native/​c_tests/​operation_construction.c Verifies ABI 0.2 defaults and layout.
sdk/​cosmos/​azure_data_cosmos_driver_native/​c_tests/​runtime_lifecycle.c Tests runtime option replacement.
sdk/​cosmos/​azure_data_cosmos_driver_native/​include/​azurecosmosdriver.h Exposes the revised C ABI.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​completion.rs Implements cancellation signaling.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​driver.rs Updates driver-cache documentation.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​lib.rs Exports snapshot APIs.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​op_request.rs Decodes expanded operation options.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​options_snapshot.rs Implements admission snapshots.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​options_snapshot/​submit_tests.rs Tests snapshot submission semantics.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​runtime.rs Updates runtime ownership documentation.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​runtime_builder.rs Accepts runtime operation defaults.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​submit.rs Applies snapshots and cancellation.
sdk/​cosmos/​azure_data_cosmos_driver_native/​src/​test_abi.rs Improves mock topology responses.

Comment thread sdk/cosmos/azure_data_cosmos_driver/src/driver/cosmos_driver.rs Outdated
Comment thread sdk/cosmos/azure_data_cosmos_driver_native/src/op_request.rs
Comment thread sdk/cosmos/azure_data_cosmos_driver_native/src/submit.rs Outdated
Restore reserved cancellation outcomes and await driver completion instead of dropping in-flight work that can lose diagnostics. Remove the cancellation API and test, and regenerate the native header and API listing.

Clarify tri-state and explicit-empty option encoding in op_request.rs and the README, and correct metadata-request argument indentation in cosmos_driver.rs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Integrate upstream feed cursors and the Cosmos beta release while retaining native ABI 0.2.0, shared runtime caches, and removed host cancellation.

Carry admission snapshots through cursor planning and page execution, reject snapshots from other runtimes, and cover expiry across cursor lifetime. Keep unreleased PR notes separate from released upstream entries.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@ananth7592 ananth7592 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Integrate upstream Cosmos beta.2 versions, API generation tooling, and escaped error-message decoding. Keep this PR's driver and macro changelog entries in the new 1.0.0-beta.2 Unreleased sections without altering released entries.

Preserve native ABI 0.2.0 and align local driver dependencies with the upstream beta.2 versions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Start maintained native release history at 0.2.0 and document the operation-options ABI additions and pre-1.0 compatibility boundary.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: dc991c8a-81db-439a-a4e2-03b45107a0c5
@kundadebdatta Debdatta Kunda (kundadebdatta) added the Cosmos Native Wrapper Relates to the Cosmos Native Wrapper (`azure_data_cosmos_native`) label Oct 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@tvaron3
Tomas Varon (tvaron3) merged commit 892600d into Azure:main Oct 1, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cosmos Native Wrapper Relates to the Cosmos Native Wrapper (`azure_data_cosmos_native`) Cosmos The azure_cosmos crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants