Repository navigation
Restore legacy Helix test result attachment behavior - #17304
Conversation
Co-authored-by: Copilot <[email protected]> Copilot-Session: 0d06c6da-2805-4deb-909c-7504e58388ac
Co-authored-by: Copilot <[email protected]> Copilot-Session: 0d06c6da-2805-4deb-909c-7504e58388ac
There was a problem hiding this comment.
Pull request overview
Restores legacy per-test output attachment behavior for Helix result publishing while keeping the Helix Job Monitor behavior configurable and compatible with older pinned tools.
Changes:
- Introduces
TestResultAttachmentMode(Failed,All,None) and defaults behavior toFailed. - Applies attachment-mode filtering consistently when parsing xUnit, JUnit, and TRX result files, and threads the setting through the Job Monitor and AzDO publisher parameters.
- Updates the
helix-job-monitor.ymltemplate to conditionally pass the new CLI option only when explicitly set.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/LocalTestResultsReaderTests.cs | Adds coverage validating attachment behavior across formats/outcomes and the empty-output case. |
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/AzureDevOpsResultPublisherTests.cs | Verifies new default attachment mode behavior for publisher parameters and job monitor options. |
| src/Microsoft.DotNet.Helix/JobMonitor/Services/AzureDevOpsService.cs | Forwards the attachment mode into AzDO reporting parameters used by the publisher. |
| src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorOptions.cs | Adds --test-result-attachment-mode option and default config in the Job Monitor. |
| src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/Model/TestResultAttachmentMode.cs | Introduces the new attachment mode enum. |
| src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/Model/AzureDevOpsReportingParameters.cs | Extends reporting parameters to carry attachment mode to the publisher. |
| src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/LocalTestResultsReader.cs | Implements per-test attachment filtering based on mode for xUnit/JUnit/TRX parsing. |
| src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/AzureDevOpsResultPublisher.cs | Instantiates the reader with the configured attachment mode. |
| eng/common/core-templates/job/helix-job-monitor.yml | Adds template parameter and conditional forwarding of --test-result-attachment-mode. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/LocalTestResultsReader.cs:212
AddAttachmentIfEnabledsilently falls back tofalsefor any unexpectedTestResultAttachmentModevalue. Throwing anArgumentOutOfRangeExceptionmakes invalid/unsupported values fail fast (useful if the enum is extended or an invalid value is deserialized/cast).
bool includeAttachment = _attachmentMode switch
{
TestResultAttachmentMode.All => true,
TestResultAttachmentMode.Failed => string.Equals(normalizedOutcome, "Fail", StringComparison.Ordinal),
TestResultAttachmentMode.None => false,
_ => false,
};
Co-authored-by: Přemek Vysoký <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/LocalTestResultsReader.cs:212
AddAttachmentIfEnabledsilently treats any unknownTestResultAttachmentModevalue asfalse(_ => false). If a new enum value is added later (or an invalid value is deserialized/cast), this will quietly suppress attachments and make the behavior hard to diagnose. Prefer throwingArgumentOutOfRangeExceptionin the default arm so unexpected values fail fast.
bool includeAttachment = _attachmentMode switch
{
TestResultAttachmentMode.All => true,
TestResultAttachmentMode.Failed => string.Equals(normalizedOutcome, "Fail", StringComparison.Ordinal),
TestResultAttachmentMode.None => false,
_ => false,
};
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
eng/common/core-templates/job/helix-job-monitor.yml:247
- The template always forwards
--test-result-attachment-modebecause the parameter defaults toFailed(non-empty). That breaks compatibility with older pinned job monitor tools that don’t recognize the new option, contradicting the intent to forward it conditionally.
if [ -n "$testResultAttachmentMode" ]; then
toolArgs+=( --test-result-attachment-mode "$testResultAttachmentMode" )
fi
src/Microsoft.DotNet.Helix/AzureDevOpsTestPublisher/Model/AzureDevOpsReportingParameters.cs:12
- Adding a new positional parameter to a public record changes its generated constructor signature and is binary-breaking for callers compiled against the previous version. Consider adding an overload matching the prior constructor signature and chaining to the new one.
public sealed record AzureDevOpsReportingParameters(
Uri CollectionUri,
string TeamProject,
string TestRunId,
string? AccessToken = null,
bool UseFullyQualifiedTestName = false,
TestResultAttachmentMode TestResultAttachmentMode = TestResultAttachmentMode.Failed);
| public sealed class LocalTestResultsReader( | ||
| ILogger logger, | ||
| TestResultAttachmentMode attachmentMode = TestResultAttachmentMode.Failed) | ||
| { | ||
| private readonly ILogger _logger = logger; | ||
| private readonly TestResultAttachmentMode _attachmentMode = attachmentMode; |
Part of #17280.
Restores the legacy per-test attachment behavior while keeping the monitor behavior configurable:
Failed,All, andNoneattachment modesFailed, matching the pre-monitor reportersValidation: full Helix SDK test suite and 54 targeted attachment tests passed.
@premun