-
Notifications
You must be signed in to change notification settings - Fork 695
Fix TryMatchAgainstResources to return false for multiple resource matches #10411
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
Fix TryMatchAgainstResources to return false for multiple resource matches #10411
Conversation
…and add comprehensive tests Co-authored-by: davidfowl <[email protected]>
TryResolvePeerNameCore and TryResolvePeer are duplicated, remove TryResolvePeerNameCore |
…chCount Co-authored-by: davidfowl <[email protected]>
…rCore instead Co-authored-by: davidfowl <[email protected]>
Removed |
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.
One comment on comparing resources
…ce matching Co-authored-by: JamesNK <[email protected]>
/backport to release/9.4 |
Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16287515871 |
Problem
The
TryMatchAgainstResources
method inResourceOutgoingPeerResolver
was returningtrue
on the first resource match, even when multiple resources had matching addresses. This could lead to ambiguous peer resolution where the method would return different results depending on the order of resources in the collection.Solution
Updated
TryMatchAgainstResources
to:true
only if exactly one resource matchesfalse
if zero or multiple resources match (ambiguous case)null
when returningfalse
for multiple matchesChanges
Core Logic Update
Comprehensive Test Coverage
Added unit tests covering realistic scenarios:
localhost:1433
addresseslocalhost:6379
addresseslocalhost,1433
format127.0.0.1
↔localhost
transformations workTest Results
Files Changed
src/Aspire.Dashboard/Model/ResourceOutgoingPeerResolver.cs
- Updated core matching logictests/Aspire.Dashboard.Tests/ResourceOutgoingPeerResolverTests.cs
- Added comprehensive test scenariosThis fix ensures deterministic peer resolution behavior and prevents ambiguous matches from returning inconsistent results.
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.