Skip to content

Rename the WithTags trait from Aspire_Dashboard_Tag to Aspire_Tag - #21881

Merged
Sébastien Ros (sebastienros) merged 1 commit into
mainfrom
sebros/aspire-cli-tags-json-d5723d
Nov 6, 2026
Merged

Sébastien Ros (sebastienros) merged 1 commit into
mainfrom
sebros/aspire-cli-tags-json-d5723d

Conversation

@sebastienros

Copy link
Copy Markdown
Contributor

Description

Renames the reserved trait used by WithTags from Aspire_Dashboard_Tag to Aspire_Tag.

AppHost tags aren't dashboard-only. The CLI backchannel adds traits to resource snapshots the same way the dashboard does, so aspire describe --format json already includes them:

"properties": {
  "resource.trait.Aspire_Tag": ["frontend", "critical"]
}

With the old name, tools reading that output had to know a dashboard-scoped name for something that isn't dashboard-specific, and the method name (WithTags) and the trait name didn't match in scope.

What changed

  • KnownResourceTraits.DashboardTag = "Aspire_Dashboard_Tag" → KnownResourceTraits.Tag = "Aspire_Tag", with a comment explaining the naming.
  • The Aspire_ prefix stays so the reserved name can't collide with user traits added through WithTrait (a bare tag would pick up tag validation and dashboard tag behavior).
  • Aspire_Dashboard_Position / WithDashboardPosition are unchanged: only the dashboard uses a position, so the name matches the scope.
  • The TraitAnnotation validation message now says "Tags must…" instead of "Dashboard tags must…".
  • docs/specs/dashboard-persistence.md uses the new name, says that the tags appear in aspire describe, and no longer says that user-added tags live in the settings database (they're in browser local storage since Store dashboard tags, resource order and metric pins in browser local storage #21840).
  • The resource string key ResourceTraitDashboardTags keeps its name. Renaming it would mean editing the resx and Designer files and regenerating the .xlf files, and users never see the key.

Reviewer notes

Validation

  • Aspire.Hosting.Tests (ResourceTraitBuilderTests, DashboardServiceDataTerminalTests): 16 passed.
  • Aspire.Dashboard.Tests (ResourceTagStoreTests): 20 passed.
  • Aspire.Dashboard.Components.Tests (ResourcesLayoutTests, ResourceDetailsTests): 168 passed.
  • Aspire.Dashboard.Playwright.Tests builds. Its tests weren't run locally.

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
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No

Tags set with WithTags are not dashboard-only: they also reach `aspire describe --format json`
as the resource.trait.<name> property. Drop the Dashboard scope from the reserved trait name
while keeping the Aspire_ prefix so it cannot collide with user traits added with WithTrait.
Aspire_Dashboard_Position keeps its name since only the dashboard uses it.
@github-actions

github-actions Bot commented Nov 6, 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 -- 21881

Or

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

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Tests selector

55 / 101 PR test projects · 5 PR jobs, from 10 changed files.

Selected PR test projects (55 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Dashboard.Components.Tests, Aspire.Dashboard.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 (5)

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


How these were chosen — grouped by what changed

⚠️ 41 of the 55 selected test projects come from a single change — src/Aspire.Hosting/ApplicationModel/TraitAnnotation.cs.

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

show 41

Aspire.Hosting.Analyzers.Tests (2 hops), Aspire.Hosting.Azure.EntraId.Tests (2 hops), Aspire.Hosting.Azure.Kusto.Tests (2 hops), Aspire.Hosting.Azure.Provisioning.Tests (3 hops), Aspire.Hosting.Browsers.Tests (2 hops), 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 (2 hops), Aspire.Hosting.DevTunnels.Tests (2 hops), Aspire.Hosting.Docker.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.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.Valkey.Tests (2 hops), Aspire.Hosting.Yarp.Tests (2 hops), Aspire.Playground.Tests

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

🔧 src/Aspire.Dashboard/Model/ResourceViewModel.cs (changed source)
→ 3 via the project graph: Aspire.Hosting.DotnetTool.Tests (2 hops), Aspire.Hosting.JavaScript.Tests, Aspire.Hosting.Testing.Tests

🔧 src/Shared/Model/KnownProperties.cs (changed source)
→ 3 via the project graph: Aspire.Cli.Tests, Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Tests

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

📦 affected project Aspire.Dashboard
→ 1 test: Aspire.Templates.Tests

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

🧪 tests/Aspire.Dashboard.Components.Tests/Controls/ResourceDetailsTests.cs (changed test)
→ 1 directly: Aspire.Dashboard.Components.Tests

🧪 tests/Aspire.Dashboard.Components.Tests/Layout/ResourcesLayoutTests.cs (changed test)
→ 1 directly: Aspire.Dashboard.Components.Tests

🧪 tests/Aspire.Dashboard.Tests/Model/ResourceTagStoreTests.cs (changed test)
→ 1 directly: Aspire.Dashboard.Tests

🧪 tests/Aspire.Hosting.Tests/ResourceTraitBuilderTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Dashboard/Model/ResourceViewModel.cs, src/Aspire.Hosting/ApplicationModel/TraitAnnotation.cs, src/Aspire.Hosting/ResourceTraitBuilderExtensions.cs
• affected project Aspire.Dashboard
native-dashboard-validation affected project Aspire.Dashboard
polyglot • affected project Aspire.Hosting
• affected project Aspire.Hosting.Azure.Provisioning.KeyVault
typescript-api-compat affected project Aspire.Hosting

Selection computed for commit fca0ae1.

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 are reported for the reserved tag-trait rename.

No open issues 🎉

What changed in this PR

Renames the reserved WithTags trait from Aspire_Dashboard_Tag to Aspire_Tag, reflecting its use across dashboard and CLI tooling rather than only the dashboard.

Changes:

  • Updates the shared constant, hosting tag creation and validation, and dashboard consumers.
  • Updates existing hosting and dashboard tests to use the new trait name.
  • Clarifies CLI tag output and browser-local tag storage in the persistence specification.
File Description
tests/​Aspire.Hosting.Tests/​ResourceTraitBuilderTests.cs Updates tag validation and snapshot expectations.
tests/​Aspire.Hosting.Tests/​Dashboard/​DashboardServiceDataTerminalTests.cs Updates the serialized tag property expectation.
tests/​Aspire.Dashboard.Tests/​Model/​ResourceTagStoreTests.cs Uses the renamed trait in tag-merging coverage.
tests/​Aspire.Dashboard.Playwright.Tests/​Integration/​Playwright/​ResourcePaneResponsiveTests.cs Updates browser-test resource fixtures.
tests/​Aspire.Dashboard.Components.Tests/​Layout/​ResourcesLayoutTests.cs Updates tag-grouping and relationship fixtures.
tests/​Aspire.Dashboard.Components.Tests/​Controls/​ResourceDetailsTests.cs Updates the tag display fixture.
src/​Shared/​Model/​KnownProperties.cs Renames the reserved trait and explains its scope.
src/​Aspire.Hosting/​ResourceTraitBuilderExtensions.cs Makes WithTags emit the renamed trait.
src/​Aspire.Hosting/​ApplicationModel/​TraitAnnotation.cs Applies tag validation to the new name and generalizes its message.
src/​Aspire.Dashboard/​Model/​ResourceViewModel.cs Reads and localizes the renamed trait.
docs/​specs/​dashboard-persistence.md Documents the new name, CLI output, and browser-local storage.

Review effort: Balanced

@sebastienros
Sébastien Ros (sebastienros) merged commit 09f1aba into main Nov 6, 2026
369 of 370 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.1 milestone Nov 6, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Proven false positive. Triggered signal: pr_body_has_cli_flag_mention (evidence: PR body mentions aspire describe --format json, an existing flag, only as context). The PR renames the unreleased internal constant KnownResourceTraits.DashboardTag to Tag (Aspire_Dashboard_Tag to Aspire_Tag). It adds no new CLI flags or public API. A search of src/frontend/src/content/docs/ found no mention of Aspire_Dashboard_Tag or resource.trait, and the trait was never shipped in a release, so there is nothing to update.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants