Repository navigation
Rename the WithTags trait from Aspire_Dashboard_Tag to Aspire_Tag - #21881
Conversation
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.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21881Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21881" |
Tests selector55 / 101 PR test projects · 5 PR jobs, from 10 changed files. Selected PR test projects (55 / 101)
Selected PR jobs (5)
How these were chosen — grouped by what changed
🔧 show 41
🧪 🔧 🔧 📦 affected project 📦 affected project 📦 affected project 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 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
|
✅ No documentation update needed. Proven false positive. Triggered signal: |
Description
Renames the reserved trait used by
WithTagsfromAspire_Dashboard_TagtoAspire_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 jsonalready includes them: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.Aspire_prefix stays so the reserved name can't collide with user traits added throughWithTrait(a baretagwould pick up tag validation and dashboard tag behavior).Aspire_Dashboard_Position/WithDashboardPositionare unchanged: only the dashboard uses a position, so the name matches the scope.TraitAnnotationvalidation message now says "Tags must…" instead of "Dashboard tags must…".docs/specs/dashboard-persistence.mduses the new name, says that the tags appear inaspire 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).ResourceTraitDashboardTagskeeps its name. Renaming it would mean editing the resx and Designer files and regenerating the.xlffiles, 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.Testsbuilds. Its tests weren't run locally.Checklist