Use display name without DCP suffix in resource command error messages#16148
Use display name without DCP suffix in resource command error messages#16148
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16148Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16148" |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates resource command error messages to use the resource’s display name for single-instance resources, while keeping full DCP resource IDs for replica scenarios to avoid ambiguity.
Changes:
- Added
IResource.GetResolvedDisplayResourceName(resourceId)to choose display name vs. full resource ID based on replica count. - Updated
ResourceCommandService.ExecuteCommandCoreAsyncto use the resolved display name in the “command not available” error message. - Renamed an existing helper method in
CommandsConfigurationExtensionsand added tests for single-instance vs replica message formatting.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/ResourceCommandServiceTests.cs | Adds tests asserting error message formatting for single-instance vs replica resources. |
| src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs | Introduces GetResolvedDisplayResourceName utility for display name vs instance ID selection. |
| src/Aspire.Hosting/ApplicationModel/ResourceCommandService.cs | Switches the “command not available” message to use the resolved display/instance name. |
| src/Aspire.Hosting/ApplicationModel/CommandsConfigurationExtensions.cs | Renames helper used in lifecycle command success messages to distinguish from the new extension method. |
src/Aspire.Hosting/ApplicationModel/CommandsConfigurationExtensions.cs
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting/ApplicationModel/CommandsConfigurationExtensions.cs
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting/ApplicationModel/CommandsConfigurationExtensions.cs
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting/ApplicationModel/CommandsConfigurationExtensions.cs
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting/ApplicationModel/CommandsConfigurationExtensions.cs
Outdated
Show resolved
Hide resolved
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
src/Aspire.Hosting/ApplicationModel/CommandsConfigurationExtensions.cs
Outdated
Show resolved
Hide resolved
Add GetResolvedDisplayResourceName extension method to return the resource display name for single-instance resources and the full DCP resource ID for resources with replicas. Use it in ResourceCommandService error messages and rename the existing helper in CommandsConfigurationExtensions to GetResolvedDcpResouceName.
…isplayResourceName
59e78c0 to
bee48dd
Compare
|
🎬 CLI E2E Test Recordings — 69 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #24443212932 |
|
No documentation PR is required for this change. This is a bug fix to error message formatting — replacing the internal DCP resource ID suffix (e.g.,
|
Description
Resource command error messages previously included the full DCP resource ID (e.g.,
cache-abcdwxyz) even for single-instance resources. This is confusing because users know the resource by its display name (cache).This PR:
GetResolvedDisplayResourceNameextension method onIResourcethat returns the display name for single-instance resources and the full DCP resource ID for resources with replicas.ResourceCommandService.ExecuteCommandCoreAsyncfor the "command not available" error message.CommandsConfigurationExtensionstoGetResolvedDcpResouceNameto distinguish it from the new method.Before:

After:

Checklist