Skip to content

[release/11.0.1xx] Complete affected-test orchestration fixes - #56452

Merged
Evangelink merged 4 commits into
release/11.0.1xxfrom
dev/amauryleve/backport-affected-test-handshake
Nov 5, 2026
Merged

Evangelink merged 4 commits into
release/11.0.1xxfrom
dev/amauryleve/backport-affected-test-handshake

Conversation

@Evangelink

@Evangelink Evangelink commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Completes the affected-tests servicing changes for release/11.0.1xx by combining the existing #56450 backport with #56538. The release branch already contains the gated affected-test options from #55574; this PR fixes their process-completion boundary rather than adding another feature implementation.

  • Accept successful legacy --collect-test-map children that suppress all reporting handshakes.
  • Accept exit-0 RefreshMappingsOrchestrator completion only in collection mode, and exit-0 RunAffectedTestsOrchestrator completion only in affected-run mode, without requiring a TestHost that legitimately never starts.
  • Preserve rejected and partial-handshake state across later accepted handshakes. Missing, unknown or mismatched capabilities, controller/orchestrator mixtures, nonzero exits and cancellation do not gain the exemption.
  • Keep ordinary TestHost completion, aggregate failure handling, release-branch retry/reporting APIs and the existing feature gate unchanged.
  • Include the legacy regressions, all 43 additional orchestrator cases, and CLI contributor guidance.

Source fixes: 15a545cb978bb0be6cad2f5d121d4452fba35dbd (#56450) and 26a1ef981ff3039c74c9345adbfb95d4834a0099 (#56538). The two release-specific conflict resolutions omit main-only retry state and a main-only test-helper parameter; unrelated MTP changes were not pulled in.

Customer Impact

Successful map collection and valid empty affected selections can currently change from child exit 0 to parent exit 1 because the SDK treats their orchestrator-only lifecycle as a failed TestHost handshake. The original incident affected all 45 collection modules in TestFx build 1617452 and led to disabling the feature in microsoft/testfx#11651.

The original version of this servicing PR handled only the no-handshake collection path. It still rejected actual collection and zero-selection orchestrators. Both failures were reproduced against the release SDK before this update: two modules wrote valid maps and exited 0, but the SDK reported two handshake failures and returned 1. Ordinary execution succeeded.

Regression?

Yes. The orchestration introduced in #55574 assumes successful execution always reaches an ordinary TestHost. Collection and zero-selection orchestrators can legitimately complete without one. Main contains both corrections; this PR services the same boundary in .NET 11.

Testing

Windows x64 validation used the built 11.0.100-dev release redist, with the changed CLI rebuilt and deployed through the existing incremental fast path. Validated head: f793c749291cf40318c036f41bd2e828026adcdc, including release base e5668b160fc888433229053cd615fc5e300fd847.

298 focused SDK regressions passed, with no failures or skips: 169 lifecycle/transport/launch/reporting/policy tests and 129 parser/definition tests. This includes all 76 TestApplicationHandlerTests cases.

42 composed contract scenarios passed: ten real-extension scenarios and 32 supplemental live named-pipe peer scenarios. Fixture rebuilds are not counted as behavior scenarios.

Real extension scenario Parent exit Verified result
Ordinary execution 0 All 22 tests
Map collection 0 Two complete schema-2 maps containing 21 and 1 test UIDs
Unchanged-source affected run 0 No selected tests and no false handshake failures
Mapped source edit 0 Exactly 6 of 22 tests, matching the persisted source-to-UID sets
Intentional selected-test failure 2 One failed and five passed tests; failure is not masked
Early timeout 3 Cancellation is not accepted as a successful empty run
Active-TestHost timeout 3 Real Alpha TestHost started; no false handshake failure
Missing-map fallback 0 Both modules fall back to all 22 tests
Ordinary execution with feature disabled 0 All 22 tests
Affected option with feature disabled 1 Expected feature-gate diagnostic

The exact selected names were SharedCase, TestCase001, TestCase007, TestCase011, TestCase012 and TestCase013. The expected set was derived from collected map UIDs and ordinary TRX IDs before editing Core\Case001.cs, then compared exactly with affected-run TRX results. The fixture spans multiple collection batches, avoiding misleading assumptions about conservative batch-scoped associations.

The 32 live transport cases cover legacy no-handshake collection, rejection of no-handshake affected runs, matching and older no-execution-mode orchestrators, missing/unknown/mismatched capabilities, partial handshakes in both orders, protocol/property/mode rejections before and after accepted handshakes, nonzero exits and mixed-module aggregation. Valid completions return 0; invalid/partial/rejected completions remain 1; nonzero and mixed-module failures remain 13.

Aligned producer packages

Component Version Source commit
MSTest.Sdk, MSTest.TestFramework, MSTest.TestAdapter 4.5.2 933377f07ac4bded77e820b0beef7d27e805cd89
Microsoft.Testing.Platform and TRX extension 2.5.2 933377f07ac4bded77e820b0beef7d27e805cd89
Affected-tests and code-coverage extensions 18.12.1 b2131b75a68113223845cc69efb91918c980cb11

All ten producer runtime DLLs were verified against original nupkg ZIP entries and both deployed test modules. No producer-source substitutions, package version overlays or SDK dependency updates were used. The affected-tests extension is private and experimental; this is composed release-branch validation, not a claim of public availability or downstream enablement.

Reproduction commands and retained evidence

The release branch lacks the current diagnostic test runner. The canonical scripts/RunTests.cs was extracted from main commit 2f0da079350a63d165b990e0cbfb3ead6bd09a58 outside the checkout, with its standalone System.CommandLine directive pinned to the evaluated release version 3.0.0. Its execution and diagnostic behavior was otherwise unchanged. With $runner pointing to that retained file, the SDK test invocations were:

.\build.cmd /m:4 /bl:artifacts\log\affected-tests-baseline-build.binlog
.\.dotnet\dotnet.exe build src\Cli\dotnet\dotnet.csproj -c Debug --no-restore -v:minimal -bl:artifacts\log\affected-tests-fixed-cli-build.binlog

.\.dotnet\dotnet.exe $runner -- --project test\dotnet.Tests\dotnet.Tests.csproj --filter 'FullyQualifiedName~TestApplicationHandlerTests|FullyQualifiedName~TestApplicationLaunchTests|FullyQualifiedName~TestApplicationProtocolVersionTests|FullyQualifiedName~TestApplicationActionQueueTests|FullyQualifiedName~TestRunPolicyTests|FullyQualifiedName~TestCommandParserTests|FullyQualifiedName~TerminalTestReporterTests|FullyQualifiedName~IPCTests|FullyQualifiedName~CtrlCCancellationManagerTests' --test-binlogs

.\.dotnet\dotnet.exe $runner -- --project test\dotnet.Tests\dotnet.Tests.csproj --filter 'FullyQualifiedName~TestCommandDefinitionTests' --test-binlogs

On this release branch the parser file contains TestCommandDefinitionTests, which is why its 129 cases were run separately. The two retained TRX/build-binlog directories are:

  • artifacts\log\test-runs\dotnet.Tests\20261103-100025-215872
  • artifacts\log\test-runs\dotnet.Tests\20261103-100630-303524

The composed fixture pins the built SDK with rollForward: disable and an absolute SDK path. Representative commands, run from its clean Git-backed fixture, were:

$env:DOTNET_ADD_GLOBAL_TOOLS_TO_PATH = '0'
$env:DOTNET_CLI_ENABLE_AFFECTED_TESTS = '1'
$sdk = Join-Path $repo 'artifacts\bin\redist\Debug\dotnet\dotnet.exe'

& $sdk test --solution AffectedTests.slnx -c Debug --no-build --no-restore --no-artifact-post-processing --collect-test-map -- --report-trx
& $sdk test --solution AffectedTests.slnx -c Debug --no-build --no-restore --no-artifact-post-processing --affected-tests -- --report-trx

The retained driver additionally records each exact results-directory/binlog argument, per-scenario environment, expected exit, actual exit and TRX-name assertions. The child-mode environment marker was never injected manually.

The local affected-tests-release-validation.zip evidence bundle contains reproducible source fixtures, the driver, both SDK TRX reports, per-scenario stdout/stderr and result records, complete maps, the exact selection contract, package provenance, binary hashes and a file manifest. No packages, product binaries, credentials or binlogs are included; binlog locations are recorded for local inspection.

Evidence archive SHA-256: BBAFB45939F8452AFFA9AA86AC4B4D2112CE13F16AA5AB788826577C3C9DD165.

Final built/deployed SDK dotnet.dll SHA-256: 2615723DEC0173F0D00B486D96F6AE312FC0547862518DC2B1105A06D542083F.

Original-package/restored/deployed MTP DLL SHA-256: 3B924A66FE318D1EC1D48F4E253C42ECC355FD412114B628D803DEF002F6D6A3.

The full baseline build succeeded with pre-existing NuGet audit warnings. The changed CLI built with zero warnings/errors; focused test builds retained the existing MessagePack 3.1.8 audit warning. Audit configuration was not weakened.

Risk and rollout

Low and bounded to the existing experimental affected-test modes. The source change is limited to handshake/completion classification, regression coverage and area guidance; there are no parser, localization, dependency, transport-version or concurrency-policy changes.

The SDK owns child activation, lifecycle classification and final aggregate exit codes. Mapping storage, repository analysis and test filtering remain owned by the separately shipped extension. This PR does not change conservative selection/fallback behavior.

No downstream enablement, feature-gate removal or SDK-denylist change is included. A release build containing this fix must flow downstream and be validated with its aligned package pins before those rollout gates are removed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 16:54
@Evangelink
Evangelink requested a review from a team as a code owner September 30, 2026 16:54
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

Copilot review overview

🟢 Approval recommended

The narrowly scoped backport preserves existing failure paths and includes direct regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Backports the .NET 11 affected-test collection handshake fix, allowing successful collection applications to exit without the ordinary reporting handshake.

Changes:

  • Accepts exit code 0 without a handshake during test-map collection.
  • Preserves failures for nonzero exits and partial handshakes.
  • Adds focused regression tests.
File Description
src/​Cli/​dotnet/​Commands/​Test/​MTP/​TestApplicationHandler.cs Refines collection-mode exit classification.
test/​dotnet.Tests/​CommandTests/​Test/​TestApplicationHandlerTests.cs Covers successful, failed, and partial-handshake collection exits.

Evangelink and others added 3 commits November 3, 2026 10:40
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Backport #56538 (26a1ef9) on top of the existing #56450 servicing fix. Preserve release retry/reporting APIs while recognizing successful mapping and zero-selection orchestrators and retaining rejected/partial-handshake failures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink changed the title [release/11.0.1xx] Fix affected-test collection handshake classification [release/11.0.1xx] Complete affected-test orchestration fixes Nov 3, 2026
@Evangelink
Evangelink enabled auto-merge (squash) November 3, 2026 21:12
@Evangelink
Evangelink merged commit 782b84a into release/11.0.1xx Nov 5, 2026
24 of 25 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/backport-affected-test-handshake branch November 5, 2026 09:11

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — f793c749 Deployed Nov 5, 2026 by Evangelink via pat_pool #12154
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.

3 participants