Vendor dotnet test shared source instead of consuming the Internal.DotnetTest package - #55130
Merged
Merged
Conversation
…tnetTest package The source-only Microsoft.Testing.Platform.Internal.DotnetTest package (#54959) breaks source-build / the VMR (dotnet/dotnet#7529). Revert to hand-copying the shared "dotnet test" <-> Microsoft.Testing.Platform source (named-pipe wire contract + terminal reporter) and add a vendored-files drift-tracking mechanism ported from microsoft/testfx so we get notified when the upstream files change. - Revert PR #54959: restore the vendored Terminal reporter + ObjectFieldIds.cs + the wire constants in CliConstants.cs and their namespaces; drop the package reference, CPM version, darc wiring and NoWarn;CS0436. - Add eng/vendored-files.json (manifest of the testfx-sourced files), eng/vendored-files.md (docs), .github/scripts/check_vendored_files.py (drift detector) and .github/workflows/check-vendored-files.yml (weekly + PR checks). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Evangelink
marked this pull request as ready for review
July 3, 2026 09:46
Evangelink
enabled auto-merge
July 3, 2026 09:46
Contributor
There was a problem hiding this comment.
Pull request overview
This PR switches dotnet/sdk back to vendoring the shared dotnet test ↔ Microsoft.Testing.Platform source (wire contract + terminal reporter) instead of consuming the source-only Microsoft.Testing.Platform.Internal.DotnetTest package, and adds an automated vendored-source drift tracker (manifest + validator + scheduled workflow) to detect upstream changes in microsoft/testfx.
Changes:
- Revert
Microsoft.Testing.Platform.Internal.DotnetTestpackage consumption and restore vendored wire contract + terminal reporter sources. - Add
eng/vendored-files.json+ docs + a GitHub Action + Python script to detect upstream drift and open/update tracking issues. - Add/adjust unit tests and localized strings related to terminal reporting and protocol/handshake behaviors.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet.Tests/CommandTests/Test/CapturingConsole.cs | Adds a simple IConsole implementation for unit tests of terminal output. |
| test/dotnet.Tests/CommandTests/Test/DiscoveredTestMessagesSerializerTests.cs | Updates serializer tests to use vendored wire field id constants instead of inlined values. |
| test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs | Updates assertions to match restored reporter exit-code messaging. |
| test/dotnet.Tests/CommandTests/Test/TerminalTestReporterTests.cs | Adds unit coverage for terminal reporter summary/output edge cases. |
| test/dotnet.Tests/CommandTests/Test/TestApplicationHandlerTests.cs | Adds unit coverage for handshake routing/execution-mode validation paths. |
| test/dotnet.Tests/CommandTests/Test/TestApplicationProtocolVersionTests.cs | Switches to vendored protocol constant (HandshakeMessagePropertyNames) instead of an inlined byte. |
| test/dotnet.Tests/CommandTests/Test/TestNodeResultsStateTests.cs | Adds coverage for stale “in-progress” suppression behavior. |
| test/dotnet.Tests/CommandTests/Test/TestProgressStateTests.cs | Adds coverage for retry/attempt accounting across instance ids. |
| src/Cli/dotnet/dotnet.csproj | Removes the source-only package reference and CS0436 suppression used by the prior approach. |
| src/Cli/dotnet/Commands/CliCommandStrings.resx | Adds new localized resources for discovery/run non-success exit code messages. |
| src/Cli/dotnet/Commands/Test/CliConstants.cs | Restores/inlines protocol constants needed for the named-pipe contract. |
| src/Cli/dotnet/Commands/Test/MTP/MicrosoftTestingPlatformTestCommand.cs | Re-points terminal/reporting usage back to vendored implementations. |
| src/Cli/dotnet/Commands/Test/MTP/TestApplication.cs | Removes references to package namespaces; uses vendored terminal namespace. |
| src/Cli/dotnet/Commands/Test/MTP/TestApplicationActionQueue.cs | Same namespace re-pointing for action queue. |
| src/Cli/dotnet/Commands/Test/MTP/TestApplicationHandler.cs | Reverts to vendored terminal exception type and reporter wiring. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/ObjectFieldIds.cs | Restores the vendored on-wire field/serializer ids contract. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/CommandLineOptionMessagesSerializer.cs | Removes package namespace dependency; uses vendored wire contract. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/DiscoveredTestMessagesSerializer.cs | Same as above (serializer uses vendored ids). |
| src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/FileArtifactMessagesSerializer.cs | Same as above. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/HandshakeMessageSerializer.cs | Same as above. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/TestInProgressMessagesSerializer.cs | Same as above. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/TestResultMessagesSerializer.cs | Same as above. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/TestSessionEventSerializer.cs | Same as above. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/Serializers/VoidResponseSerializer.cs | Same as above. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/AnsiCodes.cs | Restored vendored terminal helper. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/AnsiDetector.cs | Restored vendored terminal helper. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/AnsiTerminal.cs | Restored vendored terminal implementation. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/AnsiTerminalTestProgressFrame.cs | Restored vendored incremental ANSI progress renderer. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/ErrorMessage.cs | Restored reporter message type. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/ExceptionFlattener.cs | Restored exception flattening support type. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/FileUtilities.cs | Restored helper for path comparison/case-sensitivity. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/HumanReadableDurationFormatter.cs | Restored duration formatting logic used by progress UI. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/IColor.cs | Restored terminal abstraction type. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/IConsole.cs | Restored console abstraction used for testability. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/IProgressMessage.cs | Restored reporter message abstraction. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/IStopwatch.cs | Restored timing abstraction. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/ITerminal.cs | Restored terminal rendering abstraction. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/NativeMethods.cs | Restored platform probing/VT100 enabling logic. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/NonAnsiTerminal.cs | Restored non-ANSI terminal implementation. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/SimpleAnsiTerminal.cs | Restored simple ANSI terminal implementation. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/SimpleTerminalBase.cs | Restored base terminal implementation for non-cursor-moving modes. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/SystemConsole.cs | Restored System.Console wrapper implementation. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/SystemConsoleColor.cs | Restored system color wrapper. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/SystemStopwatch.cs | Restored Stopwatch wrapper implementation. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/TargetFrameworkParser.cs | Restored helper to shorten runtime framework descriptions. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalColor.cs | Restored ANSI color enum. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/TerminalTestReporterOptions.cs | Restored reporter options model (now vendored). |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/TestDetailState.cs | Restored per-test detail state model. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/TestNodeResultsState.cs | Restored tracking of running tests for active-test rendering. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/TestOutcome.cs | Restored outcome enum used by the reporter. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/TestProgressState.cs | Restored per-assembly progress aggregation with retry semantics. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/TestProgressStateAwareTerminal.cs | Restored periodic refresh + write batching wrapper. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/TestRunArtifact.cs | Restored artifact reporting model. |
| src/Cli/dotnet/Commands/Test/MTP/Terminal/WarningMessage.cs | Restored reporter message type. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf | Adds translations for new dotnet test exit-code strings. |
| src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf | Adds translations for new dotnet test exit-code strings. |
| .github/scripts/check_vendored_files.py | Adds vendored-source drift validation + issue-updating logic. |
| .github/workflows/check-vendored-files.yml | Adds scheduled + PR-safe workflow to validate/check vendored source drift. |
| eng/vendored-files.json | Adds the manifest pinning local vendored files to upstream microsoft/testfx blobs. |
| eng/vendored-files.md | Documents the vendored-files schema and reconciliation workflow. |
| eng/Version.Details.props | Updates testfx dependency versions to match the revert baseline. |
| eng/Version.Details.xml | Removes the internal source-only package dependency and re-pins testfx deps. |
| eng/Versions.props | Drops the MicrosoftTestingPlatformInternalDotnetTestVersion property. |
| Directory.Packages.props | Removes CPM entry for the internal source-only package. |
| .editorconfig | Removes the .packages/**.cs header-rule suppression (no longer needed). |
Copilot's findings
- Files reviewed: 77/77 changed files
- Comments generated: 5
… docs - AnsiTerminalTestProgressFrame: increment the frame index `i` per rendered line and enable the same-item duration-only optimization (drop the `&& false` and compare ProgressVersion), matching the correct microsoft/testfx source. Without `i++` every line compared against RenderedLines[0] and the trailing clear was always taken, breaking incremental rendering. - Rename the two TestProgressState tests + docs to say UnreachableException (what they actually assert) instead of InvalidOperationException. - Fix a stale xUnit reference in an MSTest test class comment. The two rendering bugs are SDK-only fork divergences; testfx upstream already has the correct logic, so no testfx port is needed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
nohwnd
reviewed
Jul 3, 2026
Member
|
Maybe just say "copied" everywhere you say "vendored", because then you don't have to explain it? |
Member
Author
It's matching the name used in the repo |
nohwnd
approved these changes
Jul 3, 2026
nohwnd
added a commit
to dotnet/dotnet
that referenced
this pull request
Aug 19, 2026
Microsoft.Testing.Platform.ServerMode.Client.Sources is a source-only package from microsoft/testfx, and testfx is not a VMR repo, so the package cannot be produced in a source-only build and the prebuilt detector fails the build on it. Since .NET 10 there is no per-repo baseline left to add an exclusion to, so the reference has to go instead. Condition the package reference and the MTP sources on DotNetBuildSourceOnly. Normal builds are not affected. Source-only builds lose running MTP applications under vstest, which is opt-in and off by default. Two spots needed more than an ItemGroup condition. MtpTestRuntimeProvider is registered in TestExtensionTypes, so that registration is now behind DOTNET_BUILD_FROM_SOURCE. The IProxyManagerFactory doc comment crefs MtpProxyManagerFactory, and with GenerateDocumentationFile and warnings as errors that turns into CS1574 once the type is compiled out, so it is a plain <c> tag now. This is temporary. The real fix is either shipping the package through dotnet/source-build-assets as a text-only package, or vendoring the source with drift tracking, the way dotnet/sdk#55130 (Vendor dotnet test shared source instead of consuming the Internal.DotnetTest package) did for the sibling package. The same change is in microsoft/vstest#16385 (Compile the MTP client out of source-only builds) so it survives the next codeflow: microsoft/vstest#16385 🤖
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
PR #54959 made
dotnet/sdkconsume the source-only NuGetMicrosoft.Testing.Platform.Internal.DotnetTestfor the shareddotnet test↔ Microsoft.Testing.Platform source. That breaks source-build / the VMR (dotnet/dotnet#7529): source-only packages don't flow cleanly through source-build, and the dev workflow (updating the checked-in source + the SDK dependency together) is awkward.Instead, this PR keeps the shared source vendored (hand-copied) and adds a drift-tracking mechanism — the same one
microsoft/testfxalready uses — so we get notified when the upstream testfx files change and a human decides whether to port.What
1. Revert the package consumption (#54959) — clean
git revert -m 1, no conflicts:Terminal/*reporter,IPC/ObjectFieldIds.cs, and the wire constants inCliConstants.cs(plus their namespaces).Microsoft.Testing.Platform.Internal.DotnetTestPackageReference, the CPM version, the darc wiring ineng/Version.Details.*/eng/Versions.props, theNoWarn;CS0436, and the.editorconfig[.packages/**.cs]addition.2. Add the vendored-files drift-tracking mechanism (ported from testfx):
eng/vendored-files.json— manifest of the 30 testfx-sourced files (38 upstream sources), pinned to testfxmain@4a09ad6.eng/vendored-files.md— docs: schema, drift model, reconciliation flow..github/scripts/check_vendored_files.py—validate(PR-safe, no network) +check(opens/updates tracking issues labelledarea-vendored-sync)..github/workflows/check-vendored-files.yml— weekly schedule + manual dispatch + PR validation.ObjectFieldIds.csto point at the manifest.The detector compares the upstream file's current blob SHA against the recorded baseline — it never inspects the local content — so the hard-forked reporter (testfx split it into partials; the SDK keeps a monolith) is tracked correctly: any upstream change opens an issue to reconcile.
Validation
python .github/scripts/check_vendored_files.py validate→ Manifest OK: 30 entries, 38 sources.check --dry-runagainstmicrosoft/testfx→ 0 drifted, 0 errors (all 38ok).build.cmd→ Build succeeded, 0 warnings, 0 errors.Companion change (testfx)
A companion PR in
microsoft/testfxstops producing theMicrosoft.Testing.Platform.Internal.DotnetTestpackage and updates theDotnetTestProtocolContract.props/TerminalReporterContract.propscomments to mark those files as vendored bydotnet/sdk(keeping the item lists + standalone contract tests). Will cross-link once it's up.Closes the source-build regression from #54959.