Skip to content

Improve MTP server-mode client mutation coverage - #11613

Merged
Amaury Levé (Evangelink) merged 5 commits into
microsoft:mainfrom
Evangelink:dev/amauryleve/mtp-mutation-tests
Sep 29, 2026
Merged

Amaury Levé (Evangelink) merged 5 commits into
microsoft:mainfrom
Evangelink:dev/amauryleve/mtp-mutation-tests

Conversation

@Evangelink

Copy link
Copy Markdown
Member

The curated MTP server-mode client mutation suite had 270 surviving mutants, leaving key lifecycle, transport, protocol, and serialization behavior weakly specified.

This change adds focused MSTest coverage for those paths and applies small behavior-preserving cleanups where Stryker produced equivalent mutants. It covers process startup and teardown, cancellation and timeout races, JSON-RPC message handling, numeric ID parsing, test-node serialization, property bags, exception formatting, and in-process host lifecycle behavior.

The implementation preserves cross-target behavior for both the System.Text.Json and Jsonite paths. Equivalent platform-specific and synchronously completed-task mutations are explicitly documented and excluded rather than weakening production semantics.

Validation:

  • Strict net8.0 and net462 build with warnings as errors: 0 warnings, 0 errors
  • net8.0: 281 passed, 8 skipped
  • net462: 199 passed, 2 skipped
  • Stryker baseline: 270 survivors
  • Full combined Stryker run: 892 killed, 1 survivor, 27 timeouts
  • Final focused rerun covering the last survivor and reviewed production changes: 76 killed, 0 survivors, 1 timeout

The local Windows Stryker 5.0 MTP runner could not discover the executable test project, so mutation verification used a temporary VSTest transport compiling the same test sources against the same mutated project. That temporary harness was not committed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 28, 2026 20:15
@github-actions github-actions Bot added the state/needs-review Awaiting review from the team. label Sep 28, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Sep 28, 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

@github-actions

This comment has been minimized.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 29, 2026 06:59
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Sep 29, 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.

Copilot review overview

🟡 Changes recommended

Three new tests leave fake reads unresolved, forcing repeated five-second shutdown timeouts.

Review effort: Balanced
Findings: 1 Low severity

Open (1)

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Sep 29, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Sep 29, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 29, 2026 07:16
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Sep 29, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Sep 29, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Sep 29, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Sep 29, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. labels Sep 29, 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.

Copilot review overview

🔵 Needs a closer look

The conditional test-class attribute silently prevents the new cross-target transport tests from running on net462.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Remove net462 guard from MSTest class attribute

test/​UnitTests/​Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests/​ProtocolMutationTests.cs:22

[TestClass] is compiled out for net462, so MSTest does not discover the unguarded TcpWrite_EmitsRequiredHeadersAndBody and TcpDispose_DisposesBothStreamsAndTcpClient methods below. This silently removes the Jsonite/.NET Framework transport coverage from the reported net462 run. Keep the class attribute unconditional; the individual NETCOREAPP test block can remain guarded.

@github-actions

Copy link
Copy Markdown
Contributor

Preliminary test-triage analysis — Azure Pipelines build 1615816

Triggering leg: Build Windows Debug → job "Windows Debug", task "Test (unit tests only)" failed (exit code 2). Other legs are still running and may change this conclusion.

Failing test: StartAsyncTimeoutKillsProcessAndReleasesListener [net462]

  • Assertion: Assert.Contains("did not connect back within", exception.Message) failed.
  • Actual message: The Microsoft.Testing.Platform application '...\mtp-apphost-<guid>\NeverConnects.cmd' exited with code 0 before connecting back.
  • So the test expected the timeout path, but the NeverConnects.cmd child exited (code 0) before the timeout elapsed and the "exited before connecting back" path was taken. This looks like a deterministic mismatch on the net462/Windows path, or a race between the child exiting and the timeout. It doesn't look like an environmental failure.

Confidence: medium. Only one failing test was seen. No crash or hang diagnostics were found (the CrashDumps directory was empty). History is incomplete because this is early analysis (early-analysis), so I can't say whether it has failed before.

Next step: check whether this PR changes the apphost/StartAsync connect-back or timeout logic, or the NeverConnects.cmd helper. If it does, the test needs to keep the child alive until the timeout, or the product needs to check the timeout before the exit. Compare against the other legs when the build completes. A final resolution comment will follow.

🤖 Automated content by GitHub Copilot. Generated by the Pipeline Test Triage workflow. · copilot · auto · 25.4 AIC · ⌖ 5.56 AIC · ⊞ 9.6K

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 29, 2026 08:05
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/approved Proposal approved; ready for implementation. labels Sep 29, 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.

Copilot review overview

🔵 Needs a closer look

The shared-array-pool identity tests can race under the project’s method-level parallel execution.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Medium severity Disable parallelization for shared ArrayPool buffer tests

test/​UnitTests/​Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests/​ProtocolMutationTests.cs:23

This class must be non-parallel: the assembly uses method-level parallelization, while the two rented-buffer tests assert that the very next ArrayPool<byte>.Shared.Rent returns the buffer just released. Those tests use the same pool bucket and can steal each other's returned buffer, causing nondeterministic AreSame failures. Mark the class [DoNotParallelize] (as the other shared-state mutation test classes are).

@Evangelink
Amaury Levé (Evangelink) merged commit 85b9f41 into microsoft:main Sep 29, 2026
27 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/mtp-mutation-tests branch September 29, 2026 09:22
@github-actions github-actions Bot removed the state/approved Proposal approved; ready for implementation. label Sep 29, 2026
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