Skip to content

Use supported Cosmos emulator API in consumers - #19837

Merged
Mitch Denny (mitchdenny) merged 2 commits into
mainfrom
mitchdenny-cosmos-emulator-fix
Sep 1, 2026
Merged

Mitch Denny (mitchdenny) merged 2 commits into
mainfrom
mitchdenny-cosmos-emulator-fix

Conversation

@mitchdenny

Copy link
Copy Markdown
Member

Description

Main CI and deployment end-to-end builds are blocked because warnings are treated as errors and two consumers still call the obsolete RunAsPreviewEmulator API.

This replaces those calls with the supported RunAsEmulator API in the Azure Cosmos hosting test and the Cosmos end-to-end playground AppHost. The intentional obsolete-API compatibility test remains unchanged.

Validation:

  • MSBUILDTERMINALLOGGER=false dotnet build playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/CosmosEndToEnd.AppHost.csproj --no-restore
  • MSBUILDTERMINALLOGGER=false dotnet test --project tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj --no-launch-profile -- --filter-method "*.RunAsPreviewEmulatorAppliesOtlpExporterAnnotation" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Copilot AI balanced review requested due to automatic review settings September 1, 2026 09:01
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19837

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19837"

@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Sep 1, 2026
@github-actions

This comment has been minimized.

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

Review tier: Balanced
Findings: 1 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity tests/​Aspire.Hosting.Azure.Tests/​AzureCosmosDBExtensionsTests.cs — This test now exercises RunAsEmulator, but its name still identifies the obsolete…
What changed in this PR

Replaces obsolete Cosmos emulator API usage in active consumers.

Changes:

  • Uses RunAsEmulator in the Azure hosting test and Cosmos playground.
  • Preserves the explicit obsolete-API compatibility test.
File Description
tests/​Aspire.Hosting.Azure.Tests/​AzureCosmosDBExtensionsTests.cs Updates emulator test usage.
playground/​CosmosEndToEnd/​CosmosEndToEnd.AppHost/​AppHost.cs Updates the playground AppHost API call.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Tests selector

3 / 99 PR test projects · 0 PR jobs · 0 advisory-only targets, from 2 changed files.

Selected PR test projects (3 / 99)

Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Tests, Aspire.Playground.Tests

Selected PR jobs (0)

none

Advisory workflow impact (0)

none


How these were chosen — grouped by what changed

🧪 tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBExtensionsTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Azure.Tests
→ 1 via the project graph: Aspire.Hosting.Azure.Kubernetes.Tests

📄 playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/AppHost.cs (changed)
→ 1 directly: Aspire.Playground.Tests

Job reasons

none


Selection computed for commit 84a5961.

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

Review tier: Balanced
Findings: None

Issues resolved since last review (1)
Severity Finding
Low severity tests/​Aspire.Hosting.Azure.Tests/​AzureCosmosDBExtensionsTests.cs — This test now exercises RunAsEmulator, but its name still identifies the obsolete… View resolved comment

@mitchdenny
Mitch Denny (mitchdenny) merged commit 4a8b541 into main Sep 1, 2026
46 checks passed
@mitchdenny
Mitch Denny (mitchdenny) deleted the mitchdenny-cosmos-emulator-fix branch September 1, 2026 15:03
@github-actions github-actions Bot added this to the 13.6 milestone Sep 1, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Step 5 branch: docs_required -> already documented by name

Triggered signals (2): pr_body_has_cli_flag_mention, pr_body_has_deprecation_marker.

Evidence review:

  1. pr_body_has_deprecation_marker - PR body evidence: "consumers still call the obsolete RunAsPreviewEmulator API". This does not introduce a new deprecation; RunAsPreviewEmulator is already documented by name in src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-host.mdx (line 297): "To use it, call RunAsPreviewEmulator (or runAsPreviewEmulator)." The replacement API, RunAsEmulator, is likewise already documented extensively in the same file (lines 120-283), e.g. line 120: "Chain RunAsEmulator (or runAsEmulator) on the resource builder". No new identifier is introduced.

  2. pr_body_has_cli_flag_mention - evidence matched build/test command text (dotnet build ... --no-restore, dotnet test --project ...) from the PR's validation steps, not an actual new CLI flag or option added by the change. This is a false-positive match on unrelated build tooling syntax; there is no corresponding Aspire CLI surface to document.

Actual code change (verified via PR diff): only 2 files changed - playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/AppHost.cs (1 line) and tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBExtensionsTests.cs (2 lines) - both simply swap RunAsPreviewEmulator() calls for RunAsEmulator() calls to unblock CI (warnings-as-errors on obsolete API usage). No public API, behavior, or documented surface changed; both method names were already documented prior to this PR.

Conclusion: no documentation update is needed on microsoft/aspire.dev.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants