Skip to content

[release/17.0] Mark resource trait APIs experimental - #22206

Merged
Jose Perez Rodriguez (joperezr) merged 2 commits into
release/17.0from
sebros/resource-traits-experimental-17.0
Nov 13, 2026
Merged

Jose Perez Rodriguez (joperezr) merged 2 commits into
release/17.0from
sebros/resource-traits-experimental-17.0

Conversation

@sebastienros

Copy link
Copy Markdown
Contributor

Description

Addresses the API review feedback in #22185 (comment): resource traits are a new concept on stable Aspire.Hosting in 17.0, trait names are free-form strings, and the reserved names that get special handling (such as the tag trait) are still internal. This marks the trait APIs experimental so the shape can still change once well-known traits are designed.

New diagnostic: ASPIRERESOURCETRAITS001 (docs link https://aka.ms/aspire/diagnostics/ASPIRERESOURCETRAITS001).

Marked [Experimental]:

  • ResourceTraitBuilderExtensions.WithTrait
  • ResourceTraitBuilderExtensions.WithTags, including the internal withTags polyglot adapter
  • ResourceTraitBuilderExtensions.WithDisplayOrder (this replaced WithDashboardPosition in release/17.0)
  • TraitAnnotation
  • DisplayOrderAnnotation

The attribute is applied to each member, not to the extension class. [Experimental] on a type is only reported where the type name appears, and extension-method calls such as builder.WithTags(...) never name the containing class, so a class-level attribute would not warn C# callers.

Other changes:

  • The generated TypeScript and Go SDKs now mark withTrait, withTags and withDisplayOrder as experimental, so their snapshots were updated.
  • docs/list-of-diagnostics.md lists the new ID.
  • The internal snapshot code, Aspire.Hosting.Tests and the TestShop playground suppress the new diagnostic.

Making ResourceTypeDisplayNameAnnotation internal, the other API review comment, is handled separately in #22205.

Follow-up: add the aka.ms redirect and an aspire.dev diagnostics page for ASPIRERESOURCETRAITS001.

Validation

  • Aspire.Hosting.Tests: ResourceTraitBuilderTests, ResourceNotificationTests, DashboardServiceDataTerminalTests pass.
  • Aspire.Hosting.CodeGeneration.{TypeScript,Go,Java,Python,Rust}.Tests pass.
  • Aspire.Dashboard.Tests, Aspire.Cli.Tests and TestShop.AppHost build.

Resource traits (WithTrait, WithTags, WithDisplayOrder, TraitAnnotation,
DisplayOrderAnnotation) are new in 17.0 on stable Aspire.Hosting. Trait names
are free-form strings and the reserved names are still internal, so mark the
APIs [Experimental("ASPIRERESOURCETRAITS001")] until well-known traits are
designed.
@github-actions

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 -- 22206

Or

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

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 12, 2026 17:08
@github-actions github-actions Bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Nov 12, 2026
@github-actions

This comment has been minimized.

/// <summary>
/// Shared diagnostic ID for resource traits, tags, and display order.
/// </summary>
public const string DiagnosticId = "ASPIRERESOURCETRAITS001";

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.

honestly I'd rather put the strings directly in the Experimental attributes. The reasoning being it is really easy to query the APIs that use it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

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.

🟢 Approval recommended

No active review issues were identified for the changes marking resource trait and display-order APIs as experimental.

No open issues 🎉

What changed in this PR

Marks resource trait and display-order APIs in Aspire.Hosting as experimental for 17.0, addressing API review feedback from #22185 while preserving their runtime behavior.

Changes:

  • Applies ASPIRERESOURCETRAITS001 to trait extensions, the polyglot tags adapter, and annotation types.
  • Updates TypeScript and Go snapshots to include experimental documentation notices.
  • Documents the diagnostic and suppresses it for existing internal, test, and playground consumers.
File Description
tests/​Aspire.Hosting.Tests/​Aspire.Hosting.Tests.csproj Suppresses the diagnostic for hosting tests.
tests/​Aspire.Hosting.CodeGeneration.TypeScript.Tests/​Snapshots/​TwoPassScanningGeneratedAspire.verified.ts Adds experimental tags to generated API documentation.
tests/​Aspire.Hosting.CodeGeneration.Go.Tests/​Snapshots/​TwoPassScanningGeneratedAspire.verified.go Adds experimental notices to generated API documentation.
src/​Aspire.Hosting/​ResourceTraitBuilderExtensions.cs Marks extension methods and the polyglot adapter experimental.
src/​Aspire.Hosting/​ApplicationModel/​TraitAnnotation.cs Marks trait annotations experimental.
src/​Aspire.Hosting/​ApplicationModel/​ResourceTraitSnapshotProperties.cs Suppresses the diagnostic in snapshot publishing.
src/​Aspire.Hosting/​ApplicationModel/​ResourceTraitDiagnostics.cs Defines the shared diagnostic ID and documentation URL format.
src/​Aspire.Hosting/​ApplicationModel/​DisplayOrderAnnotation.cs Marks display-order annotations experimental.
playground/​TestShop/​TestShop.AppHost/​AppHost.cs Suppresses the diagnostic for existing sample usage.
docs/​list-of-diagnostics.md Documents the new diagnostic and affected APIs.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

52 / 101 PR test projects · 4 PR jobs, from 8 changed files.

Selected PR test projects (52 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Hosting.Analyzers.Tests, Aspire.Hosting.Azure.EntraId.Tests, Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Kusto.Tests, Aspire.Hosting.Azure.Provisioning.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Browsers.Tests, Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests, Aspire.Hosting.DevTunnels.Tests, Aspire.Hosting.Docker.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.DotnetTool.Tests, Aspire.Hosting.EntityFrameworkCore.Tests, Aspire.Hosting.Foundry.Tests, Aspire.Hosting.Garnet.Tests, Aspire.Hosting.Go.Tests, Aspire.Hosting.Java.Tests, Aspire.Hosting.JavaScript.Tests, Aspire.Hosting.Kafka.Tests, Aspire.Hosting.Keycloak.Tests, Aspire.Hosting.Kubernetes.Tests, Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests, Aspire.Hosting.MongoDB.Tests, Aspire.Hosting.MySql.Tests, Aspire.Hosting.Nats.Tests, Aspire.Hosting.OpenAI.Tests, Aspire.Hosting.Oracle.Tests, Aspire.Hosting.Orleans.Tests, Aspire.Hosting.PostgreSQL.Tests, Aspire.Hosting.Python.Tests, Aspire.Hosting.Qdrant.Tests, Aspire.Hosting.RabbitMQ.Tests, Aspire.Hosting.Radius.Tests, Aspire.Hosting.Redis.Tests, Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Rust.Tests, Aspire.Hosting.Seq.Tests, Aspire.Hosting.SqlServer.Tests, Aspire.Hosting.Testing.Tests, Aspire.Hosting.Tests, Aspire.Hosting.Valkey.Tests, Aspire.Hosting.Yarp.Tests, Aspire.Playground.Tests, Aspire.Templates.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

⚠️ 43 of the 52 selected test projects come from a single change — src/Aspire.Hosting/ApplicationModel/DisplayOrderAnnotation.cs.

🔧 src/Aspire.Hosting/ApplicationModel/DisplayOrderAnnotation.cs (changed source)
→ 43 via the project graph

show 43

Aspire.Hosting.Analyzers.Tests (2 hops), Aspire.Hosting.Azure.EntraId.Tests (2 hops), Aspire.Hosting.Azure.Kubernetes.Tests (2 hops), Aspire.Hosting.Azure.Kusto.Tests (2 hops), Aspire.Hosting.Azure.Provisioning.Tests (3 hops), Aspire.Hosting.Azure.Tests, Aspire.Hosting.Browsers.Tests (2 hops), Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.Containers.Tests (2 hops), Aspire.Hosting.DevTunnels.Tests (2 hops), Aspire.Hosting.Docker.Tests (2 hops), Aspire.Hosting.DotnetTool.Tests (2 hops), Aspire.Hosting.EntityFrameworkCore.Tests (2 hops), Aspire.Hosting.Foundry.Tests (2 hops), Aspire.Hosting.Garnet.Tests (2 hops), Aspire.Hosting.Go.Tests (2 hops), Aspire.Hosting.Java.Tests (2 hops), Aspire.Hosting.JavaScript.Tests (2 hops), Aspire.Hosting.Kafka.Tests (2 hops), Aspire.Hosting.Keycloak.Tests (2 hops), Aspire.Hosting.Kubernetes.Tests (2 hops), Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests (2 hops), Aspire.Hosting.MongoDB.Tests (2 hops), Aspire.Hosting.MySql.Tests (2 hops), Aspire.Hosting.Nats.Tests (2 hops), Aspire.Hosting.OpenAI.Tests (2 hops), Aspire.Hosting.Oracle.Tests (2 hops), Aspire.Hosting.Orleans.Tests (2 hops), Aspire.Hosting.PostgreSQL.Tests (2 hops), Aspire.Hosting.Python.Tests (2 hops), Aspire.Hosting.Qdrant.Tests (2 hops), Aspire.Hosting.RabbitMQ.Tests (2 hops), Aspire.Hosting.Redis.Tests (2 hops), Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Rust.Tests (2 hops), Aspire.Hosting.Seq.Tests (2 hops), Aspire.Hosting.SqlServer.Tests (2 hops), Aspire.Hosting.Testing.Tests (2 hops), Aspire.Hosting.Valkey.Tests (2 hops), Aspire.Hosting.Yarp.Tests (2 hops)

🧪 tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj (changed test)
→ 1 directly: Aspire.Hosting.Tests
→ 3 via the project graph: Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.Radius.Tests

📦 affected project Aspire.Hosting.Dotnet
→ 2 tests: Aspire.Cli.EndToEnd.Tests, Aspire.Templates.Tests

📦 affected project Aspire.Hosting
→ 1 test: Aspire.Cli.EndToEnd.Tests

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

🧪 tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Go.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.TypeScript.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Hosting.JavaScript
extension-e2e • src/Aspire.Hosting/ApplicationModel/DisplayOrderAnnotation.cs, src/Aspire.Hosting/ApplicationModel/ResourceTraitSnapshotProperties.cs, src/Aspire.Hosting/ApplicationModel/TraitAnnotation.cs, src/Aspire.Hosting/ResourceTraitBuilderExtensions.cs
• affected project Aspire.Hosting
polyglot • affected project Aspire.Hosting
• affected project Aspire.Hosting.Azure.Provisioning
typescript-api-compat affected project Aspire.Hosting

Selection computed for commit 83eeea9.

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.

🟢 Approval recommended

There are no active review issues for the change marking resource-trait APIs as experimental.

No open issues 🎉

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@joperezr
Jose Perez Rodriguez (joperezr) merged commit 4c46aa7 into release/17.0 Nov 13, 2026
1389 of 1407 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Nov 13, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Step 5 branch: excluded → base_branch_is_release, title_release_prefix (backport: base release/17.0, title prefixed [release/17.0]). Triggered signals: diagnostic_documentation_changed (docs/list-of-diagnostics.md), experimental_attribute_added (ASPIRERESOURCETRAITS001 on trait APIs). Docs belong with the original forward PR, so no docs PR was drafted.

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

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants