Skip to content

.NET: Cover Aspire DevUI tracing and response capture - #10519

Merged
Vincent Biret (baywet) merged 5 commits into
mainfrom
test/coverage-aspire.hosting.agentframework.devui
Dec 3, 2026
Merged

Vincent Biret (baywet) merged 5 commits into
mainfrom
test/coverage-aspire.hosting.agentframework.devui

Conversation

@baywet

Copy link
Copy Markdown
Member

Motivation & Context

Improve regression coverage for Aspire.Hosting.AgentFramework.DevUI without changing production code.

Description & Review Guide

  • What are the major changes? Add tests to AspireDashboardTracingTests.cs, DevUIAggregatorHostedServiceTests.cs.
  • What is the impact of these changes? The change is test-only. Local .NET Release tests and formatting passed. 151 passed; lines 90.65% to 94.78%, branches 78.26% to 87.58%. Coverage figures are from the locally selected tests, not the aggregate CI report.
  • What do you want reviewers to focus on? Check that the tests assert observable behavior for the Aspire DevUI tracing and response capture scenarios.

Related Issue

Part of the maintainer-authorized .NET coverage effort. Issue linkage is pending human review of this draft.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: Copilot prepared and locally verified the tests and drafted the description. Human review and attestation are pending.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 3, 2026 07:57
@github-actions github-actions Bot added the .NET Usage: [Issues, PRs], Target: .Net label Dec 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The tracing tests can pass despite regressions in oversized-line handling, first-ID selection within a chunk, or sending dashboard requests without an API key.

3 open issues
What changed in this PR

This test-only PR expands regression coverage for the .NET Agent Framework’s Aspire DevUI integration without changing production code.

Changes:

  • Add streaming tests for first-response-ID capture, streams without an ID, and recovery after an oversized event.
  • Verify trace conversion, empty dashboard responses, and the transition from 202 Accepted to 200 OK once a trace is indexed.
  • Check health and tracing metadata without a dashboard, and verify routing for discovered entities with multi-segment prefixes.
File Description
dotnet/​tests/​Aspire.Hosting.AgentFramework.DevUI.UnitTests/​DevUIAggregatorHostedServiceTests.cs Tests dashboard-free startup and entity routing with compound prefixes.
dotnet/​tests/​Aspire.Hosting.AgentFramework.DevUI.UnitTests/​AspireDashboardTracingTests.cs Tests streaming response ID capture, trace conversion, and dashboard polling.

Review effort: Balanced

@github-code-quality

github-code-quality Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: C#

C# / code-coverage/dotnet

main 929ff70 test/coverage-aspire... 406e53e +/-
90% 90% 0%
View coverage of the 10 most impacted files.
File main 929ff70 test/coverage-aspire... 406e53e +/-
/home/runner/wo...SessionStore.cs 100% 38% -62%
/home/runner/wo...ostedService.cs 82% 87% +5%
/home/runner/wo...seExtensions.cs 94% 100% +6%
/home/runner/wo...nseIdCapture.cs 94% 100% +6%
/home/runner/wo...entConverter.cs 83% 90% +7%
/home/runner/wo...dTraceClient.cs 92% 100% +8%
/home/runner/wo...dboxExecutor.cs 80% 89% +9%
/home/runner/wo...seExtensions.cs 59% 98% +39%
/home/runner/wo...artConverter.cs 33% 97% +64%
/home/runner/wo...sonUtilities.cs 0% 100% +100%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated December 03, 2026 13:36 UTC

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The tests don’t verify that the first response event wins, capture resumes on the next event after an oversized one, Dashboard retries use the original trace ID, or all tracing capabilities are disabled without a Dashboard.

No open issues 🎉

4 previously missed issues

In code that hasn't changed since last review

Medium severity Separate each SSE payload with a blank line

dotnet/​tests/​Aspire.Hosting.AgentFramework.DevUI.UnitTests/​AspireDashboardTracingTests.cs:248

Without a blank line after each data: payload, the response IDs are not sent as separate server-sent events. Add a blank line after every payload, including the initial non-response payload, so the test verifies that the first response event wins.

Medium severity End the oversized SSE event before the recovery payload

dotnet/​tests/​Aspire.Hosting.AgentFramework.DevUI.UnitTests/​AspireDashboardTracingTests.cs:278

With only one newline between the two data: lines, the recovery payload is still part of the oversized server-sent event. Add a blank line after each payload so the test verifies that capture resumes on the next event.

Medium severity Verify both Dashboard polls use the propagated trace ID

dotnet/​tests/​Aspire.Hosting.AgentFramework.DevUI.UnitTests/​AspireDashboardTracingTests.cs:700

The Dashboard stub returns a pending response and then a span for any trace ID, so these assertions would still pass if either poll queried the wrong trace. Check both Dashboard lookups against the trace ID propagated to the agent to verify that the retry retrieves the original trace.

Medium severity Assert all tracing-related capabilities are disabled

dotnet/​tests/​Aspire.Hosting.AgentFramework.DevUI.UnitTests/​DevUIAggregatorHostedServiceTests.cs:544

This only checks trace retrieval. DevUI reads instrumentation separately (falling back to tracing), so the test would still pass if /meta incorrectly advertised instrumentation as enabled without a Dashboard. Assert that all three tracing-related capabilities are false.

3 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baywet

Copy link
Copy Markdown
Member Author

Addressed the four follow-ups in the Copilot review summary in dc682cf:

  • Each SSE payload ends with a blank line. The first-ID test still sends the first two response events in one append, and the oversized case still splits the discarded event across appends.
  • The indexing retry test verifies that exactly two Dashboard lookups both use the trace ID propagated to the agent.
  • The no-Dashboard test verifies that instrumentation, tracing, and trace_retrieval are all disabled.

All 155 Aspire DevUI unit tests passed on .NET 11 Release. Scoped formatting passed with two pre-existing informational diagnostics excluded.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The test splits the input after the overflow byte, so leftover bytes can mask a regression where the parser fails to discard the rest of the line.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Split the test fragment at the buffer overflow byte

dotnet/​tests/​Aspire.Hosting.AgentFramework.DevUI.UnitTests/​AspireDashboardTracingTests.cs:278

End the first fragment on the byte that triggers overflow. At 80 KiB, a parser that clears its buffer at 64 KiB but forgets to discard the rest of the line would buffer the remaining x bytes. Those bytes hide the data: prefix in resp_in_tail, so the test still passes. With the split at the overflow byte, that regression would capture resp_in_tail instead of resp_completed.

Review effort: Balanced

@baywet

Copy link
Copy Markdown
Member Author

Copilot address the review feedback about splitting the test

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baywet
Vincent Biret (baywet) requested a balanced review from Copilot December 3, 2026 13:23
@baywet

Copy link
Copy Markdown
Member Author

Addressed the overflow-fragment finding in 406e53e70. The first append now ends at byte 65,537, including the SSE prefix. The next append starts directly with each oversized tail, so leftover filler can no longer hide the event-looking tail. Both cases still verify capture resumes at the next real event. All 155 Aspire DevUI unit tests and scoped formatting passed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human review is needed because the tests could pass without verifying the reported health status or the full entity-detail route.

No open issues 🎉

Review effort: Balanced

@baywet
Vincent Biret (baywet) added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit b189ade Dec 3, 2026
37 checks passed
@baywet
Vincent Biret (baywet) deleted the test/coverage-aspire.hosting.agentframework.devui branch December 3, 2026 15:01

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants