Skip to content

Fix affected-test orchestrator-only completion - #56538

Merged
Evangelink merged 1 commit into
dotnet:mainfrom
Evangelink:dev/amauryleve/affected-test-handshake-classification
Oct 8, 2026
Merged

Evangelink merged 1 commit into
dotnet:mainfrom
Evangelink:dev/amauryleve/affected-test-handshake-classification

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Successful affected-test collection and zero-selection runs can finish after an accepted MTP orchestrator handshake without starting a TestHost. The SDK currently reports those legitimate completions as handshake failures and changes the parent exit code from 0 to 1. This extends the legacy collection fix in #56450 to the actual orchestrator lifecycle.

Changes

  • Allow exit-0 RefreshMappingsOrchestrator completion only in collection mode, and RunAffectedTestsOrchestrator completion only in affected-run mode.
  • Preserve explicit handshake rejection and partial-participant state across later accepted handshakes. Unknown/missing/mismatched capabilities and controller/orchestrator mixtures do not gain the exemption.
  • Keep ordinary TestHost completion, legacy no-handshake collection, nonzero exits, cancellation, and aggregate failure handling unchanged.
  • Add focused regressions and document the completion boundary in CLI contributor guidance.

Validation

The full repository build passed with 0 warnings/errors. All 366 SDK tests passed: 113 handler/transport/launch/policy tests, 242 parser/reporter/cancellation tests, and 11 real SDK command cases covering retries, zero tests, mixed modules, timeout, and crashes.

Real composed-product validation used the built 12.0.100-dev redist, locally packed TestFx/MTP 2.5.0-ci, MSTest.Sdk 4.5.0-ci, and affected-tests/code-coverage extensions 18.12.0-preview.26501.1. A metadata-only Platform package overlay (2.5.0-preview.99999.1) satisfied preview dependency ordering; the restored and deployed Platform DLLs matched the original packed binary byte-for-byte. This is local aligned-binary validation, not a claim about a publicly shipped package combination.

  • Real collection produced two maps containing 21 and 1 tests; the parent exited 0.
  • Zero-selection ran no tests and exited 0. A mapped source edit selected exactly 17 of 22 tests, verified against expected markers and merged TRX results.
  • All 21 contract scenarios passed, including storage fallback, valid separate-connection handshake ordering, mixed-module failure, and capability mismatches. Failed tests remained exit 2, timeout remained exactly exit 3, and rejected/partial handshakes remained exit 1.
Exact SDK validation commands and retained diagnostics
.\build.cmd /bl:artifacts\log\handshake-sdk-build.binlog

.\.dotnet\dotnet.exe scripts\RunTests.cs -- --project test\dotnet.Tests\dotnet.Tests.csproj --filter 'FullyQualifiedName~TestApplicationHandlerTests|FullyQualifiedName~TestApplicationProtocolVersionTests|FullyQualifiedName~TestApplicationLaunchTests|FullyQualifiedName~TestApplicationActionQueueTests|FullyQualifiedName~TestRunPolicyTests|FullyQualifiedName~TestCommandParserTests'

.\.dotnet\dotnet.exe scripts\RunTests.cs -- --project test\dotnet.Tests\dotnet.Tests.csproj --filter 'FullyQualifiedName~TestCommandDefinitionTests|FullyQualifiedName~TerminalTestReporterTests|FullyQualifiedName~TestProgressStateTests|FullyQualifiedName~CtrlCCancellationManagerTests'

.\.dotnet\dotnet.exe scripts\RunTests.cs -- --project test\dotnet.Tests\dotnet.Tests.csproj --filter 'FullyQualifiedName~RunTestProjectWithTests_ShouldReturnExitCodeSuccess|FullyQualifiedName~RunTestProjectWithWithRetryFeature_ShouldSucceed|FullyQualifiedName~RunTestProjectWithNoTests_ShouldReturnExitCodeZeroTests|FullyQualifiedName~RunMultipleTestProjectsWhereOneRanZeroTests_ShouldReturnExitCodeSuccess|FullyQualifiedName~RunMTPProjectWithGlobalTimeoutReturnsTestSessionAborted|FullyQualifiedName~RunMTPProjectThatCrashesWithExitCodeZero_ShouldFail|FullyQualifiedName~RunMTPProjectThatCrashesWithExitCodeNonZero_ShouldFail_WithSameExitCode'

Each focused run retained build.binlog and test-results.trx under artifacts\log\test-runs\dotnet.Tests\: 20261007-110115-66408, 20261007-110242-63548, and 20261007-110435-109496.

The composed harness pinned 12.0.100-dev with rollForward: disable and an absolute SDK path to artifacts\bin\redist\Debug\dotnet. Its representative commands were:

$env:DOTNET_CLI_ENABLE_AFFECTED_TESTS = '1'
# Run from the isolated, pinned git-backed harness using the built redist muxer.
& $sdk test --solution AffectedTests.slnx -c Release --no-build -bl:TestResults\collect.binlog -p:TestingPlatformCaptureOutput=false -p:TestingPlatformCommandLineArguments= -p:TestRunnerAdditionalArguments= --collect-test-map
& $sdk test --solution AffectedTests.slnx -c Release --no-build -bl:TestResults\affected.binlog -p:TestingPlatformCaptureOutput=false -p:TestingPlatformCommandLineArguments= -p:TestRunnerAdditionalArguments= --affected-tests

Retained composed evidence includes collection logs/binlogs, corrected-expanded-valid\results.json, selected-work-result.json, per-scenario logs/binlogs, and the 17-test merged TRX. No child-mode environment variable was set manually.

Final built/deployed SDK dotnet.dll SHA-256: 94B0127AB02185EBF009B160088C358EEAB6B04276F8E4769AD3C510F22C8152.
Packed/restored/deployed MTP DLL SHA-256: 3BA5436F991129E14728D6D90909167C12E53F0D7F788E206C9F4E898DFA40C4.

Servicing

release/11.0.1xx has affected-test options but lacks #56450's legacy no-handshake collection exemption. Servicing needs both that behavior and this orchestrator correction, with release-branch composed validation before downstream enablement. This PR does not enable downstream affected-test usage.

Accept successful mapping collection and zero-selection affected runs from the matching orchestrator without a TestHost. Preserve rejected and partial handshake failures regardless of handshake ordering.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cdb13387-9818-4df3-8c58-3e6880c17f12
@Evangelink
Evangelink requested review from a team, lbussell and mthalman as code owners October 7, 2026 11:57
Copilot AI balanced review requested due to automatic review settings October 7, 2026 11:57
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 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 change is narrowly scoped, focused regressions cover its completion boundaries, and no blocking issues were identified.

Review effort: Balanced
Findings: None

What changed in this PR

Extends #56450’s collection fix so legitimate affected-test orchestrator-only completions no longer become handshake failures.

Changes:

  • Accepts successful orchestrator-only completion when the capability matches the active mode.
  • Preserves rejection and partial-handshake state.
  • Adds regression tests and documents completion boundaries.
File Description
test/​dotnet.Tests/​CommandTests/​Test/​TestApplicationHandlerTests.cs Tests completion exemptions, failure boundaries, and aggregate failures.
src/​Cli/​dotnet/​Commands/​Test/​MTP/​TestApplicationHandler.cs Recognizes matching orchestrators while preserving failure detection.
src/​Cli/​AGENTS.md Documents orchestrator-only completion rules.

@Evangelink
Evangelink enabled auto-merge (squash) October 8, 2026 07:48
@Evangelink
Evangelink merged commit 26a1ef9 into dotnet:main Oct 8, 2026
26 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 9, 2026
Evangelink added a commit that referenced this pull request Nov 3, 2026
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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants