Disambiguate duplicate paths in aspire ps output#16199
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds path disambiguation to aspire ps output by shortening paths across the full set of AppHosts, ensuring display values are unique while keeping them as compact as possible.
Changes:
- Introduces
FileSystemHelper.ShortenPaths(...)to compute unique shortened display paths across a list. - Updates
PsCommandto use the new multi-path shortening logic instead of shortening each path independently. - Adds unit tests covering unique filenames, duplicates,
.csvs project files, and “root segment” behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/Utils/FileSystemHelperTests.cs | Adds coverage for ShortenPaths behaviors (unique/duplicate, csproj/cs, root handling). |
| src/Aspire.Cli/Utils/FileSystemHelper.cs | Implements ShortenPaths and moves path-shortening responsibilities into a reusable helper. |
| src/Aspire.Cli/Commands/PsCommand.cs | Switches aspire ps table rendering to use FileSystemHelper.ShortenPaths. |
ShortenPaths now compares all paths together and adds enough parent directory segments to make each display value unique. For example, c:\folder1\Project.csproj and c:\folder2\Project.csproj are shown as their full paths instead of both appearing as Project.csproj. Non-project files (single-file AppHosts like AppHost.cs) always include at least the parent folder for context (e.g. MyApp\AppHost.cs). When further disambiguation would reach a path root (drive letter or leading separator), the full original path is used instead of a ~\ prefix.
b252251 to
8c2dfd2
Compare
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16199Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16199" |
davidfowl
reviewed
Apr 15, 2026
Address code review feedback: the GroupBy for duplicate detection was using a hardcoded OrdinalIgnoreCase comparer instead of the platform-aware one, which could cause an infinite loop on case-sensitive filesystems (Linux/macOS) when paths differ only by case. Added a test that verifies paths differing only by case are treated as distinct on Linux.
Contributor
|
🎬 CLI E2E Test Recordings — 71 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #24484350643 |
Member
Author
|
Feedback applied |
davidfowl
approved these changes
Apr 16, 2026
This was referenced Apr 24, 2026
Closed
Closed
Closed
Closed
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Disambiguate duplicate paths in
aspire pstable output.Previously,
ShortenPathprocessed each path independently, so two AppHosts atc:\folder1\Project.csprojandc:\folder2\Project.csprojwould both display asProject.csproj. The newShortenPathsmethod compares all paths together and adds the minimum number of parent directory segments needed to make each display value unique.Key behaviors:
MyApp.AppHost.csproj)~\prefix until unique (e.g.~\folder1\Project.csproj).csfiles): always include at least the parent folder for context (e.g.MyApp\AppHost.cs)/, the full original path is used insteadThe method was moved from
PsCommandtoFileSystemHelperfor reusability and testability.Checklist