Conversation
…and add comprehensive tests Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
davidfowl
reviewed
Jul 15, 2025
Copilot
AI
changed the title
[WIP] TryMatchAgainstResources returns false if multiple resources match and adds realistic tests
Fix TryMatchAgainstResources to return false for multiple resource matches
Jul 15, 2025
Member
|
TryResolvePeerNameCore and TryResolvePeer are duplicated, remove TryResolvePeerNameCore |
…chCount Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
…rCore instead Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Contributor
Author
Removed |
JamesNK
reviewed
Jul 15, 2025
JamesNK
reviewed
Jul 15, 2025
JamesNK
approved these changes
Jul 15, 2025
Member
JamesNK
left a comment
There was a problem hiding this comment.
One comment on comparing resources
…ce matching Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Member
|
/backport to release/9.4 |
Contributor
|
Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16287515871 |
1 task
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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.