Repository navigation
Harden Helix test result publishing - #17460
Conversation
Process and observe test results before creating the Azure DevOps test run so publication failures cannot hide failed tests. Retry transient run creation failures, stop publication for the affected job when creation is exhausted, and keep upload failures warning-only. Separate local result processing from Azure DevOps payload publication, while retaining the shared service for authenticated result transport, retries, rate limiting, and metrics. Co-authored-by: Copilot <[email protected]> Copilot-Session: 53128524-5f5d-453a-83c7-02d0302d83b0
There was a problem hiding this comment.
🟡 Changes recommended
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR hardens Helix job monitor test-result publishing by separating local result parsing/aggregation from Azure DevOps publication, ensuring failing tests are observed before any Azure DevOps write operations can fail and mask outcomes.
Changes:
- Introduces
ITestResultProcessor+IAzureDevOpsResultPublisherto split local TRX processing from Azure DevOps publishing. - Observes/records test outcomes prior to test-run creation and publication, and retries transient test-run creation failures.
- Refactors Azure DevOps result transport to include
testRunIdin the transport interface and centralize HTTP concerns inAzureDevOpsService.
File summaries
| File | Description |
|---|---|
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/JobMonitorRunnerTests.cs | Updates job monitor tests for the new observed-then-publish flow and renamed fake APIs. |
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/Fakes/FakeHelixService.cs | Adds download-test-results call counting for new behaviors asserted in tests. |
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/Fakes/FakeAzureDevOpsService.cs | Implements new processing/publishing interfaces used by the pipeline and updates counters/behavior. |
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/AzureDevOpsServiceTests.cs | Adjusts service tests for new transport surface and transient create retry behavior. |
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/AzureDevOpsResultPublisherTests.cs | Updates transport signatures and moves “all passed” computation coverage to the processor. |
| src/Microsoft.DotNet.Helix/JobMonitor/TestResultUploadPipeline.cs | Reorders pipeline to prepare/observe results before creating runs and publishing; adds creation-failure single-reporting. |
| src/Microsoft.DotNet.Helix/JobMonitor/TestResults/TestResultProcessor.cs | New local parsing/aggregation component that returns prepared results + computed pass/fail. |
| src/Microsoft.DotNet.Helix/JobMonitor/TestResults/PreparedTestResults.cs | Replaces the old upload summary with prepared aggregated results + pass/fail outcome. |
| src/Microsoft.DotNet.Helix/JobMonitor/TestResults/ITestResultProcessor.cs | New interface for local result preparation. |
| src/Microsoft.DotNet.Helix/JobMonitor/TestResults/IAzureDevOpsResultTransport.cs | Updates transport to carry testRunId for result/attachment publication. |
| src/Microsoft.DotNet.Helix/JobMonitor/TestResults/IAzureDevOpsResultPublisher.cs | New interface for publishing prepared results into an Azure DevOps run. |
| src/Microsoft.DotNet.Helix/JobMonitor/TestResults/AzureDevOpsResultPublisher.cs | Refactors publisher to consume prepared results and publish via the updated transport. |
| src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs | Implements the updated transport interface and enables transient retries for test run creation. |
| src/Microsoft.DotNet.Helix/JobMonitor/MonitorState.cs | Updates state observation API to track pass/fail as a boolean rather than upload summary. |
| src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs | Wires processor/publisher into the runner and production dependency creation. |
| src/Microsoft.DotNet.Helix/JobMonitor/Interfaces/IAzureDevOpsService.cs | Removes the old per-work-item upload method from the core service interface. |
| src/Microsoft.DotNet.Helix/JobMonitor/Design/Components/UploadPipeline.md | Updates design doc to reflect the new prepare/observe/publish responsibilities and retry semantics. |
Review details
Suppressed comments (1)
src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs:465
- This call mixes a named argument (retryTransientFailures: true) followed by positional arguments. C# requires all arguments after the first named argument to also be named, so this will not compile.
body.ToString(Formatting.None),
AzureDevOpsRequestKind.Attachment,
retryTransientFailures: true,
ResultRequestAttemptCount,
cancellationToken);
- Files reviewed: 17/17 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| => UploadTestResultsWithCountAsync( | ||
| results, | ||
| workItemName, | ||
| jobId, | ||
| testRunId: 0, |
There was a problem hiding this comment.
Fixed in a8bebfe. Removed the overload that hardcoded run 0; the tests now use the production PublishAsync path with an explicit test run ID and verify that ID reaches the transport.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Review details
Suppressed comments (1)
src/Microsoft.DotNet.Helix/JobMonitor/TestResults/AzureDevOpsResultPublisher.cs:89
UploadTestResultsWithCountAsyncdefaultstestRunIdto 0, butIAzureDevOpsResultTransportnow requires a real run id for both result publication and attachment upload. This overload can silently produce invalid requests (e.g., /runs/0/...) if it’s ever used with the production transport; consider removing it or requiring an explicittestRunIdparameter (and updating the unit tests accordingly).
public Task<long> UploadTestResultsWithCountAsync(
IEnumerable<AggregatedResult> results,
string workItemName,
string jobId,
CancellationToken cancellationToken = default)
=> UploadTestResultsWithCountAsync(
results,
workItemName,
jobId,
testRunId: 0,
cancellationToken);
- Files reviewed: 17/17 changed files
- Comments generated: 0 new
- Review effort level: Lite
Remove the test-only publishing overload that targeted run 0. Exercise the production PublishAsync path in publisher tests and verify the supplied run ID reaches the transport. Co-authored-by: Copilot <[email protected]> Copilot-Session: 53128524-5f5d-453a-83c7-02d0302d83b0
There was a problem hiding this comment.
🟡 Changes recommended
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/Microsoft.DotNet.Helix/JobMonitor/Design/Components/UploadPipeline.md:45
- This design doc says the result publisher uses “run-specific transports supplied by the service”, but the code now has
AzureDevOpsServiceimplementIAzureDevOpsResultTransportdirectly and the transport methods take an explicittestRunId. Updating this description will keep the design doc aligned with the current architecture.
`IAzureDevOpsService` owns authenticated Azure DevOps REST operations and the
test-run lifecycle. It does not read local result files. The result publisher
uses run-specific transports supplied by the service, keeping conversion and
batching separate from HTTP retry and authentication.
- Files reviewed: 17/17 changed files
- Comments generated: 1
- Review effort level: Lite
|
/backport to release/10.0 |
|
/backport to release/11.0 |
|
Started backporting to |
|
Started backporting to |
Summary
Testing
eng\common\dotnet.ps1 test .\src\Microsoft.DotNet.Helix\Sdk.Tests\Microsoft.DotNet.Helix.Sdk.Tests\Microsoft.DotNet.Helix.Sdk.Tests.csproj --no-restore --configuration Debug --verbosity minimal(301 passed)