Skip to content

fix: SDK compat for 3.59.0-preview.0 + fix latest-stable-windows CI failure#49

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-sdk-compatibility-issue
Draft

fix: SDK compat for 3.59.0-preview.0 + fix latest-stable-windows CI failure#49
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-sdk-compatibility-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 21, 2026

Two CI matrix failures: latest-stable-windows crashed due to a PowerShell-incompatible multi-line dotnet add command, and latest-preview (3.59.0-preview.0) failed to build because the preview SDK promoted three Container methods from internal/virtual to public abstract.

Description

CI workflow fix

  • Replaced dotnet add (bash \ continuation breaks in PowerShell) with shell: bash + sed rewriting CosmosSDKVersion directly
  • Moved CosmosSDKVersion from the emulator's .csproj to the root Directory.Build.props — one sed now drives the PackageReference, HybridRow hint path, and the new compile-time feature flag across all projects

New abstract method implementations

Three methods guarded by #if COSMOS_SDK_PREVIEW_METHODS (auto-defined when CosmosSDKVersion >= 3.59.0):

Method Implementation
GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes<T> New InMemoryAllVersionsChangeFeedProcessor<T> — delivers all versions + deletes as ChangeFeedItem<T> with correct Create/Replace/Delete op-type detection via backward scan of the change feed
GetPartitionKeyRangesAsync(FeedRange, CancellationToken) Returns synthetic range IDs ("0", "1", …) matching the container's FeedRangeCount, filtered by feed range overlap
SemanticRerankAsync Throws InMemoryCosmosException (HttpStatusCode.BadRequest) — AI ranking is not emulatable in-memory, and the exception type matches what the real service returns so catch (CosmosException) blocks work correctly

All three are also delegated in PartitionKeyCapturingContainer.

Bug fix: SemanticRerankAsync exception type

The original implementation threw NotSupportedException (a .NET BCL type), but user code and SDK internals expect CosmosException for any Cosmos service-level error. A catch (CosmosException) block would silently miss a NotSupportedException, causing it to surface as an unhandled exception. Fixed to throw InMemoryCosmosException (which extends CosmosException) with HttpStatusCode.BadRequest.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Tests added/updated (TDD: failing test first, then implementation)
  • All tests pass (dotnet test)
  • No new warnings introduced

Copilot AI changed the title [WIP] Fix SDK compatibility break for Microsoft.Azure.Cosmos v3.58.0 fix: SDK compat for 3.59.0-preview.0 + fix latest-stable-windows CI failure Apr 21, 2026
Copilot AI requested a review from lemonlion April 21, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK compat break: Microsoft.Azure.Cosmos 3.58.0 (latest-stable-windows)

2 participants