-
Notifications
You must be signed in to change notification settings - Fork 709
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
TryMatchAgainstResourcesmethod inResourceOutgoingPeerResolverwas returningtrueon 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
TryMatchAgainstResourcesto:trueonly if exactly one resource matchesfalseif zero or multiple resources match (ambiguous case)nullwhen returningfalsefor multiple matchesChanges
Core Logic Update
Comprehensive Test Coverage
Added unit tests covering realistic scenarios:
localhost:1433addresseslocalhost:6379addresseslocalhost,1433format127.0.0.1↔localhosttransformations 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.