-
Notifications
You must be signed in to change notification settings - Fork 715
Filter to highest package version per channel in aspire add command #12553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: mitchdenny <[email protected]>
Co-authored-by: mitchdenny <[email protected]>
…vements Co-authored-by: mitchdenny <[email protected]>
|
/test-scenario deployment-docker |
|
🤖 AI Agent Task Created Scenario: deployment-docker An AI agent has been assigned to execute this scenario. 📝 Issue: https://github.com/dotnet/aspire-playground/issues/84 Please navigate to the issue for more details and to track progress. |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12553Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12553" |
1 similar comment
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12553Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12553" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds filtering logic to the Aspire CLI's add command to show only the highest version for each package when prompting users, along with comprehensive test coverage for this new behavior.
Key changes:
- Modified
AddCommandPrompterto filter packages to the highest version per package ID and per channel - Added test infrastructure (
PromptForSelectionCallback) to capture and inspect selection prompts in tests - Added three test cases validating the filtering behavior for different scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Aspire.Cli/Commands/AddCommand.cs | Implements filtering logic in PromptForIntegrationAsync and PromptForIntegrationVersionAsync to show only highest versions per package ID and channel |
| tests/Aspire.Cli.Tests/TestServices/TestConsoleInteractionService.cs | Adds PromptForSelectionCallback property to enable tests to inspect what choices are presented to users |
| tests/Aspire.Cli.Tests/Commands/AddCommandTests.cs | Adds three test cases and a fake NuGet cache implementation to verify version filtering behavior |
| private sealed class FakeNuGetPackageCache : Aspire.Cli.NuGet.INuGetPackageCache | ||
| { | ||
| public Task<IEnumerable<NuGetPackage>> GetTemplatePackagesAsync(DirectoryInfo workingDirectory, bool prerelease, FileInfo? nugetConfigFile, CancellationToken cancellationToken) | ||
| => Task.FromResult<IEnumerable<NuGetPackage>>([]); | ||
|
|
||
| public Task<IEnumerable<NuGetPackage>> GetIntegrationPackagesAsync(DirectoryInfo workingDirectory, bool prerelease, FileInfo? nugetConfigFile, CancellationToken cancellationToken) | ||
| => Task.FromResult<IEnumerable<NuGetPackage>>([]); | ||
|
|
||
| public Task<IEnumerable<NuGetPackage>> GetCliPackagesAsync(DirectoryInfo workingDirectory, bool prerelease, FileInfo? nugetConfigFile, CancellationToken cancellationToken) | ||
| => Task.FromResult<IEnumerable<NuGetPackage>>([]); | ||
|
|
||
| public Task<IEnumerable<NuGetPackage>> GetPackagesAsync(DirectoryInfo workingDirectory, string packageId, Func<string, bool>? filter, bool prerelease, FileInfo? nugetConfigFile, bool useCache, CancellationToken cancellationToken) | ||
| => Task.FromResult<IEnumerable<NuGetPackage>>([]); | ||
| } |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FakeNuGetPackageCache class lacks XML documentation. Add a <summary> tag explaining it's a test fake that returns empty package lists for all operations.
|
|
||
| /// <summary> | ||
| /// Callback for capturing selection prompts in tests. Uses non-generic IEnumerable and object | ||
| /// to work with the generic PromptForSelectionAsync<T> method regardless of T's type. |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed 'PromptForSelectionAsync<T>' to 'PromptForSelectionAsync' - XML documentation should use unescaped angle brackets for generic type parameters in summary tags.
| /// to work with the generic PromptForSelectionAsync<T> method regardless of T's type. | |
| /// to work with the generic PromptForSelectionAsync<T> method regardless of T's type. |
|
/backport to release/13.0 |
|
Started backporting to release/13.0: https://github.com/dotnet/aspire/actions/runs/18992294037 |
This PR addresses an issue in the
aspire addcommand where we show two versions of a package when a channel is chosen when only one should be shown. The underlying reason is that a channel is often comprised of multiple feeds (e.g. the daily feed references dotnet9 and nuget.org) and in the case of the Docker integration there is a pre-release package in both.This update effectively filters the list so we only show the highest version across package sources.
Before:
After: