Conversation
There was a problem hiding this comment.
Pull request overview
This PR exposes the test host orchestrator functionality as a public experimental API to enable third-party extensions to implement custom orchestration strategies (e.g., distributing tests across processes/machines or implementing custom retry logic).
Changes:
- Made
ITestHostOrchestratorandITestHostOrchestratorManagerpublic interfaces with experimental attribute - Created
IInternalTestHostOrchestratorManagerto retain internal-only members while exposing core functionality publicly - Added
TestHostOrchestratorproperty toITestApplicationBuilderas an experimental public API - Simplified RetryExtensions to use the new public API instead of casting to internal types
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ITestHostOrchestrator.cs | Made interface public and added XML documentation and experimental attribute |
| ITestHostOrchestratorManager.cs | Split into public interface with experimental attribute and internal interface for advanced functionality |
| TestHostOrchestratorManager.cs | Updated to implement the internal interface |
| ITestHostBuilder.cs | Updated to use internal interface type |
| TestHostBuilder.cs | Updated to use internal interface type |
| ITestApplicationBuilder.cs | Added public experimental property for TestHostOrchestrator |
| TestApplicationBuilder.cs | Implemented public experimental property for TestHostOrchestrator |
| PublicAPI.Unshipped.txt | Added public API entries for new orchestrator interfaces and property |
| RetryExtensions.cs | Simplified to use public API instead of internal casting |
src/Platform/Microsoft.Testing.Platform/TestHostOrcherstrator/ITestHostOrchestratorManager.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/TestHostOrcherstrator/ITestHostOrchestratorManager.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/TestHostOrcherstrator/ITestHostOrchestratorManager.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/Hosts/TestHostBuilder.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txt
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Extensions.Retry/Resources/xlf/ExtensionResources.pl.xlf
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Extensions.Retry/Resources/xlf/ExtensionResources.zh-Hans.xlf
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/TestHostOrcherstrator/ITestHostControllersExtension.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Platform/TestHostOrcherstrator/OrchestratorBackCompat.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
src/Platform/Microsoft.Testing.Platform/TestHostOrchestrator/ITestHostExecutionOrchestrator.cs
Show resolved
Hide resolved
| // These types provide binary backward compatibility for extensions compiled | ||
| // against older platform versions where the orchestrator manager type lived in the | ||
| // Microsoft.Testing.Platform.Extensions.TestHostOrchestrator namespace. | ||
| namespace Microsoft.Testing.Platform.Extensions.TestHostOrchestrator; | ||
|
|
||
| internal interface ITestHostOrchestratorManager | ||
| { | ||
| void AddTestHostOrchestrator(Func<IServiceProvider, ITestHostExecutionOrchestrator> factory); | ||
| } |
There was a problem hiding this comment.
OrchestratorBackCompat claims to provide binary backward compatibility, but the back-compat ITestHostOrchestratorManager no longer matches the previously existing contract (it now accepts ITestHostExecutionOrchestrator and omits members like AddTestHostOrchestratorApplicationLifetime / BuildAsync). This will break load-time compatibility for older extension assemblies compiled against the old internal orchestrator APIs (e.g., older Retry versions) and can cause TypeLoadException/MissingMethodException. Consider reintroducing shims for the old ITestHostOrchestrator/manager shapes (old signatures + members) that forward to the new public APIs, and have the new manager implement/adapt them explicitly.
There was a problem hiding this comment.
Fixed. Added the missing ITestHostOrchestrator back-compat shim type (extends ITestHostExecutionOrchestrator) and updated the back-compat ITestHostOrchestratorManager to match the old contract:
AddTestHostOrchestratornow acceptsFunc<IServiceProvider, ITestHostOrchestrator>(old type name)- Added
AddTestHostOrchestratorApplicationLifetimemember - The concrete
TestHostOrchestratorManagerexplicitly implements both old signatures, forwarding to the new public APIs
BuildAsync is not included in the back-compat interface since it took ServiceProvider (platform-internal) and was only called by internal platform code (which has been updated).
| Microsoft.Testing.Platform.Extensions.TestHostControllers.ITestHostProcessLifetimeHandler.OnTestHostProcessStartedAsync(Microsoft.Testing.Platform.Extensions.TestHostControllers.ITestHostProcessInformation! testHostProcessInformation, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! | ||
| [TPEXP]Microsoft.Testing.Platform.Extensions.TestHostOrchestrator.ITestHostExecutionOrchestrator | ||
| [TPEXP]Microsoft.Testing.Platform.Extensions.TestHostOrchestrator.ITestHostExecutionOrchestrator.OrchestrateTestHostExecutionAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<int>! | ||
| Microsoft.Testing.Platform.Builder.ITestApplicationBuilder.TestHostOrchestrator.get -> Microsoft.Testing.Platform.TestHostOrchestrator.ITestHostOrchestratorManager! |
There was a problem hiding this comment.
ITestApplicationBuilder.TestHostOrchestrator is marked [Experimental("TPEXP", ...)], but its entry in PublicAPI.Unshipped.txt is missing the [TPEXP] prefix. This can cause API compatibility validation to treat it as a non-experimental shipped API; prefix it consistently with the other experimental entries.
| Microsoft.Testing.Platform.Builder.ITestApplicationBuilder.TestHostOrchestrator.get -> Microsoft.Testing.Platform.TestHostOrchestrator.ITestHostOrchestratorManager! | |
| [TPEXP]Microsoft.Testing.Platform.Builder.ITestApplicationBuilder.TestHostOrchestrator.get -> Microsoft.Testing.Platform.TestHostOrchestrator.ITestHostOrchestratorManager! |
There was a problem hiding this comment.
Checked existing conventions in PublicAPI.Shipped.txt — the other [Experimental] properties on ITestApplicationBuilder (Configuration.get, Logging.get) are not prefixed with [TPEXP] in the API files. Only the experimental types/methods themselves carry the prefix. Keeping the entry without [TPEXP] to stay consistent (the build also fails RS0016/RS0017 validation with the prefix added).
Fix #5554