Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 310
Add client-declared IsStateful capability to MTP#9789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
211e0fdf66b623cabea2987611b4File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,28 @@ | ||
| #nullable enable | ||
| const Microsoft.Testing.Platform.ServerMode.JsonRpcStrings.IsStateful = "isStateful" -> string! | ||
| Microsoft.Testing.Platform.ServerMode.ClientCapabilities.ClientCapabilities(bool DebuggerProvider, bool IsStateful) -> void | ||
| Microsoft.Testing.Platform.ServerMode.ClientCapabilities.Deconstruct(out bool DebuggerProvider, out bool IsStateful) -> void | ||
| Microsoft.Testing.Platform.ServerMode.ClientCapabilities.IsStateful.get -> bool | ||
| Microsoft.Testing.Platform.ServerMode.ClientCapabilities.IsStateful.init -> void | ||
| Microsoft.Testing.Platform.Services.ClientCapabilitiesService | ||
| Microsoft.Testing.Platform.Services.ClientCapabilitiesService.<Clone>$() -> Microsoft.Testing.Platform.Services.ClientCapabilitiesService! | ||
| Microsoft.Testing.Platform.Services.ClientCapabilitiesService.ClientCapabilitiesService(bool IsStateful) -> void | ||
| Microsoft.Testing.Platform.Services.ClientCapabilitiesService.Deconstruct(out bool IsStateful) -> void | ||
| Microsoft.Testing.Platform.Services.ClientCapabilitiesService.Equals(Microsoft.Testing.Platform.Services.ClientCapabilitiesService? other) -> bool | ||
| Microsoft.Testing.Platform.Services.ClientCapabilitiesService.IsStateful.get -> bool | ||
| Microsoft.Testing.Platform.Services.ClientCapabilitiesService.IsStateful.init -> void | ||
| Microsoft.Testing.Platform.Services.ClientInfoService.Capabilities.get -> Microsoft.Testing.Platform.Services.IClientCapabilities! | ||
| Microsoft.Testing.Platform.Services.ClientInfoService.Capabilities.init -> void | ||
| Microsoft.Testing.Platform.Services.ClientInfoService.ClientInfoService(string! Id, string! Version, Microsoft.Testing.Platform.Services.IClientCapabilities! Capabilities) -> void | ||
| Microsoft.Testing.Platform.Services.ClientInfoService.Deconstruct(out string! Id, out string! Version, out Microsoft.Testing.Platform.Services.IClientCapabilities! Capabilities) -> void | ||
| override Microsoft.Testing.Platform.Services.ClientCapabilitiesService.Equals(object? obj) -> bool | ||
| override Microsoft.Testing.Platform.Services.ClientCapabilitiesService.GetHashCode() -> int | ||
| override Microsoft.Testing.Platform.Services.ClientCapabilitiesService.ToString() -> string! | ||
| static Microsoft.Testing.Platform.Services.ClientCapabilitiesService.operator !=(Microsoft.Testing.Platform.Services.ClientCapabilitiesService? left, Microsoft.Testing.Platform.Services.ClientCapabilitiesService? right) -> bool | ||
| static Microsoft.Testing.Platform.Services.ClientCapabilitiesService.operator ==(Microsoft.Testing.Platform.Services.ClientCapabilitiesService? left, Microsoft.Testing.Platform.Services.ClientCapabilitiesService? right) -> bool | ||
| *REMOVED*Microsoft.Testing.Platform.ServerMode.ClientCapabilities.ClientCapabilities(bool DebuggerProvider) -> void | ||
| *REMOVED*Microsoft.Testing.Platform.ServerMode.ClientCapabilities.Deconstruct(out bool DebuggerProvider) -> void | ||
| *REMOVED*Microsoft.Testing.Platform.Services.ClientInfoService.ClientInfoService(string! Id, string! Version) -> void | ||
| *REMOVED*Microsoft.Testing.Platform.Services.ClientInfoService.Deconstruct(out string! Id, out string! Version) -> void | ||
| static Microsoft.Testing.Platform.IPC.Serializers.BaseSerializer.ReadFields(System.IO.Stream! stream, System.Func<ushort, int, bool>! tryReadField) -> void | ||
| static Microsoft.Testing.Platform.IPC.Serializers.BaseSerializer.WriteListPayload<T>(System.IO.Stream! stream, ushort fieldId, T[]? list, System.Action<System.IO.Stream!, T>! writeItem) -> void | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| #nullable enable | ||
| [TPEXP]Microsoft.Testing.Platform.Services.IClientCapabilities | ||
| [TPEXP]Microsoft.Testing.Platform.Services.IClientCapabilities.IsStateful.get -> bool | ||
| [TPEXP]Microsoft.Testing.Platform.Services.IClientInfo.Capabilities.get -> Microsoft.Testing.Platform.Services.IClientCapabilities! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -128,8 +128,13 @@ private static void RegisterDefaultDeserializers(Dictionary<Type, JsonDeserializ | ||
| { | ||
| jsonElement.TryGetProperty(JsonRpcStrings.Testing, out JsonElement testing); | ||
| bool isStateful = testing.ValueKind == JsonValueKind.Object | ||
| && testing.TryGetProperty(JsonRpcStrings.IsStateful, out JsonElement statefulElement) | ||
| && statefulElement.ValueKind == JsonValueKind.True; | ||
Evangelink marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| return new ClientCapabilities( | ||
| DebuggerProvider: json.Bind<bool>(testing, JsonRpcStrings.DebuggerProvider)); | ||
| DebuggerProvider: json.Bind<bool>(testing, JsonRpcStrings.DebuggerProvider), | ||
| IsStateful: isStateful); | ||
Evangelink marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }); | ||
| deserializers[typeof(InitializeResponseArgs)] = new JsonElementDeserializer<InitializeResponseArgs>( | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -90,7 +90,7 @@ internal sealed record InvalidRequestParamsArgs(int ErrorCode, string ErrorMessa | ||
| internal sealed record ClientInfo(string Name, string Version); | ||
| internal sealed record ClientCapabilities(bool DebuggerProvider); | ||
| internal sealed record ClientCapabilities(bool DebuggerProvider, bool IsStateful); | ||
Evangelink marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| internal sealed record ServerInfo(string Name, string Version); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
| namespace Microsoft.Testing.Platform.Services; | ||
| internal sealed record ClientCapabilitiesService(bool IsStateful) : IClientCapabilities; | ||
Evangelink marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. Evangelink marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3,4 +3,4 @@ | ||
| namespace Microsoft.Testing.Platform.Services; | ||
| internal sealed record ClientInfoService(string Id, string Version) : IClientInfo; | ||
| internal sealed record ClientInfoService(string Id, string Version, IClientCapabilities Capabilities) : IClientInfo; | ||
Evangelink marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
| namespace Microsoft.Testing.Platform.Services; | ||
| /// <summary> | ||
| /// Represents the capabilities declared by the client that is driving the test host. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Capabilities are opt-in: unless a client explicitly declares a capability, the platform assumes the | ||
| /// most conservative (default) behavior. This lets a test framework tailor its behavior to how the client | ||
| /// intends to consume the results without having to guess based on the environment or transport. | ||
| /// </remarks> | ||
| [Experimental("TPEXP", UrlFormat = "https://aka.ms/testingplatform/diagnostics#{0}")] | ||
| public interface IClientCapabilities | ||
| { | ||
| /// <summary> | ||
| /// Gets a value indicating whether the client is stateful. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// A stateful client persists an addressable set of test nodes for the whole session and keeps each node in | ||
| /// its last-known state until it is explicitly updated (for example, an IDE test explorer). A stateless client | ||
| /// consumes updates as a stream and does not retain node state after the run (for example, <c>dotnet test</c>). | ||
| /// The default is <see langword="false"/> (stateless); a client opts into stateful behavior. | ||
| /// </remarks> | ||
| bool IsStateful { get; } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -18,4 +18,9 @@ public interface IClientInfo | ||
| /// Gets the client version. | ||
| /// </summary> | ||
| string Version { get; } | ||
| /// <summary> | ||
| /// Gets the capabilities declared by the client. | ||
| /// </summary> | ||
| IClientCapabilities Capabilities { get; } | ||
Evangelink marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -11,4 +11,7 @@ public sealed record ClientCapabilities( | ||
| public sealed record ClientTestingCapabilities( | ||
| [property: JsonProperty("debuggerProvider")] | ||
| bool DebuggerProvider); | ||
| bool DebuggerProvider, | ||
| [property: JsonProperty("isStateful")] | ||
| bool IsStateful = false); | ||
Evangelink marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.