Address apphost stdout review feedback#15298
Address apphost stdout review feedback#15298sebastienros wants to merge 1 commit intorelease/13.2from
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15298Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15298" |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
54df8cc to
c67113e
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves aspire run observability by streaming AppHost stdout/stderr to the CLI console in real time (both .NET and guest runtimes), while also hardening related test automation and replacing stringly-typed stream identifiers with a typed enum.
Changes:
- Add live output forwarding to console logs for .NET AppHost and guest AppHost processes during non-detached
aspire run. - Introduce
OutputLineStream(StdOut/StdErr) and propagate it throughOutputCollectorandIInteractionService.DisplayLines. - Add/adjust unit + end-to-end tests and update terminal automation to handle newer/older CLI template selection flows.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Shared/Hex1bAutomatorTestHelpers.cs | Makes template selection automation resilient to new/old “Empty AppHost” prompts and language prompt flow differences. |
| tests/Aspire.Cli.Tests/Utils/OutputCollectorTests.cs | Updates tests to use OutputLineStream and adds coverage for the new live output callback. |
| tests/Aspire.Cli.Tests/TestServices/TestInteractionService.cs | Updates test interaction service to match the new DisplayLines signature using OutputLineStream. |
| tests/Aspire.Cli.Tests/TestServices/TestExtensionInteractionService.cs | Updates extension test interaction service to match the new DisplayLines signature. |
| tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs | Updates test stub interaction service for DisplayLines signature change. |
| tests/Aspire.Cli.Tests/Projects/ProcessGuestLauncherTests.cs | Adds a unit test verifying ProcessGuestLauncher forwards stdout via live callback. |
| tests/Aspire.Cli.Tests/Projects/GuestRuntimeTests.cs | Updates assertions to use typed stderr stream values. |
| tests/Aspire.Cli.Tests/Projects/ExtensionGuestLauncherTests.cs | Updates test stub interaction service for DisplayLines signature change. |
| tests/Aspire.Cli.Tests/Interaction/ConsoleInteractionServiceTests.cs | Updates tests to pass typed stdout/stderr tuples. |
| tests/Aspire.Cli.Tests/Commands/UpdateCommandTests.cs | Updates wrapper interaction service to forward typed DisplayLines. |
| tests/Aspire.Cli.Tests/Commands/RunCommandTests.cs | Adds test asserting .NET AppHost stdout is forwarded into console logs during run. |
| tests/Aspire.Cli.Tests/Commands/PublishCommandPromptingIntegrationTests.cs | Updates test stub interaction service for DisplayLines signature change. |
| tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs | Updates test stub interaction service for DisplayLines signature change. |
| tests/Aspire.Cli.EndToEnd.Tests/AppHostConsoleLogTests.cs | Adds E2E coverage ensuring AppHost console output is visible during interactive aspire run (C# and TypeScript). |
| src/Aspire.Cli/Utils/OutputCollector.cs | Adds OutputLineStream, replaces string stream markers with typed enum, and introduces optional live output callback. |
| src/Aspire.Cli/Projects/ProcessGuestLauncher.cs | Adds live output callback plumbing and waits for redirected streams to drain after process exit. |
| src/Aspire.Cli/Projects/GuestRuntime.cs | Allows passing a live output callback into the default launcher for interactive run flows. |
| src/Aspire.Cli/Projects/GuestAppHostProject.cs | Streams guest AppHost output live to console logs and avoids replaying buffered output when live streaming is enabled. |
| src/Aspire.Cli/Projects/DotNetAppHostProject.cs | Streams .NET AppHost output live to console logs via OutputCollector callback. |
| src/Aspire.Cli/Interaction/IInteractionService.cs | Updates DisplayLines signature to use OutputLineStream and clarifies console log type semantics. |
| src/Aspire.Cli/Interaction/ExtensionInteractionService.cs | Updates DisplayLines to translate OutputLineStream back to "stdout"/"stderr" for backchannel payloads. |
| src/Aspire.Cli/Interaction/ConsoleLogTypes.cs | Introduces constants for CLI-emitted console log semantic types. |
| src/Aspire.Cli/Interaction/ConsoleInteractionService.cs | Switches console log styling from string literals to ConsoleLogTypes constants and updates DisplayLines for OutputLineStream. |
| await process.WaitForExitAsync(cancellationToken); | ||
| // Wait for the redirected streams to finish draining so no trailing lines are lost. | ||
| await Task.WhenAll(stdoutCompleted.Task, stderrCompleted.Task).WaitAsync(cancellationToken); |
There was a problem hiding this comment.
Yeah, might be worth having a timeout just in case something goes wrong.
| await process.WaitForExitAsync(cancellationToken); | ||
| // Wait for the redirected streams to finish draining so no trailing lines are lost. | ||
| await Task.WhenAll(stdoutCompleted.Task, stderrCompleted.Task).WaitAsync(cancellationToken); |
There was a problem hiding this comment.
Yeah, might be worth having a timeout just in case something goes wrong.
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #23171817240 |
|
apphost stdout is being reverted for a different fix. Improvements in this PR have been added to #15307 |
|
Thanks @JamesNK |
Description
Follow up on review feedback for the apphost stdout logging change.
This keeps the original behavior change intact while tightening the implementation details James called out during review:
OutputLineStreamenumConsoleLogTypesconstants for CLI-defined console log message typesProcessstream completion semanticsThis is a low-risk cleanup on top of the existing apphost stdout work for
aspire runin non-detached runs. There are no additional dependencies.Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: