Skip to content

Handle interaction service unimplemented and tests #10014

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

Merged
merged 2 commits into from
Jun 26, 2025

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Jun 24, 2025

Description

It's possible an app host doesn't implement the interaction service. We don't want the client to go into an infinite retry loop.

This change detects an unimplemented response from the server and stops the background task in the client watching for interactions.

Also, lots of tests.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copy link
Contributor

@Copilot Copilot AI left a 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 addresses an issue where the app host may not implement the interaction service, avoiding an infinite retry loop on the client side. Key changes include stopping background tasks when an unimplemented response is detected, refactoring the retry logic to use Task results, and adding new tests to verify this behavior.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/Aspire.Dashboard.Tests/Model/DashboardClientTests.cs Removed calls to SetInitialDataReceived and added a new test case with mock service client returning an Unimplemented status
src/Aspire.Dashboard/ServiceClient/DashboardClient.cs Made _client internal for test injection, introduced TaskCompletionSources for watch completion, and updated watch methods with a bool return value to break retry loops when interactions are unimplemented
Comments suppressed due to low confidence (1)

src/Aspire.Dashboard/ServiceClient/DashboardClient.cs:516

  • [nitpick] Add a clarifying comment near the try-catch block in IsUnimplemented to explain why catching InvalidOperationException is expected when the call is still in progress, ensuring future developers understand this design choice.
            var status = call.GetStatus();

@JamesNK JamesNK changed the title Handle interaction service unimplemented Handle interaction service unimplemented and tests Jun 25, 2025
@JamesNK JamesNK force-pushed the jamesnk/handle-unimplemented branch from f035904 to 35b765e Compare June 25, 2025 02:08
@JamesNK
Copy link
Member Author

JamesNK commented Jun 26, 2025

Please review. I have more changes around this area and I'm going to start getting conflicts with multiple PRs parallel.

@JamesNK JamesNK force-pushed the jamesnk/handle-unimplemented branch from 35b765e to a180e6b Compare June 26, 2025 02:34
Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JamesNK JamesNK merged commit 898465e into main Jun 26, 2025
252 checks passed
@JamesNK JamesNK deleted the jamesnk/handle-unimplemented branch June 26, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants