From 2ff829a6e01a212e4c1772c0199f3f4a1139dc6c Mon Sep 17 00:00:00 2001 From: Jon Sequeira Date: Fri, 15 Sep 2023 10:42:20 -0700 Subject: [PATCH 1/9] allow explicit parenting, refactor away a bunch of command id usage --- ...nteractive_api_is_not_changed.approved.txt | 2 +- ...ctive.ExtensionLab.Tests.v3.ncrunchproject | 3 + .../MagicCommandTests.lsmagic.cs | 24 ++- .../KernelExtensions.cs | 1 + ...et.Interactive.Kql.Tests.v3.ncrunchproject | 8 +- .../KernelCommandNestingTests.cs | 188 ++++++++++-------- .../VariableSharingTests.SetMagicCommand.cs | 4 +- .../Commands/KernelCommand.cs | 91 ++++++--- .../CompositeKernel.cs | 2 +- .../Connection/KernelCommandEnvelope.cs | 19 +- .../Connection/ProxyKernel.cs | 5 - src/Microsoft.DotNet.Interactive/Kernel.cs | 23 +-- .../KernelCommandResult.cs | 12 +- .../KernelExtensions.cs | 7 +- .../KernelInvocationContext.cs | 54 +++-- .../KernelScheduler.cs | 4 + .../Parsing/SubmissionParser.cs | 2 +- .../Pocket/Format.CustomizeLogString.cs | 2 +- 18 files changed, 284 insertions(+), 167 deletions(-) diff --git a/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt b/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt index db6a1273e4..909f9c07c4 100644 --- a/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt +++ b/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt @@ -179,7 +179,7 @@ Microsoft.DotNet.Interactive public System.Threading.Tasks.Task EndInvoke(System.IAsyncResult result) public System.Threading.Tasks.Task Invoke(Microsoft.DotNet.Interactive.Commands.KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation next) public class KernelCommandResult - .ctor(Microsoft.DotNet.Interactive.Commands.KernelCommand command, System.Collections.Generic.IEnumerable events = null) + .ctor(Microsoft.DotNet.Interactive.Commands.KernelCommand command) public Microsoft.DotNet.Interactive.Commands.KernelCommand Command { get;} public System.Collections.Generic.IReadOnlyList Events { get;} public class KernelCommandScheduler : KernelScheduler, IKernelScheduler, System.IDisposable diff --git a/src/Microsoft.DotNet.Interactive.ExtensionLab.Tests/Microsoft.DotNet.Interactive.ExtensionLab.Tests.v3.ncrunchproject b/src/Microsoft.DotNet.Interactive.ExtensionLab.Tests/Microsoft.DotNet.Interactive.ExtensionLab.Tests.v3.ncrunchproject index b4521700e6..830b69c48e 100644 --- a/src/Microsoft.DotNet.Interactive.ExtensionLab.Tests/Microsoft.DotNet.Interactive.ExtensionLab.Tests.v3.ncrunchproject +++ b/src/Microsoft.DotNet.Interactive.ExtensionLab.Tests/Microsoft.DotNet.Interactive.ExtensionLab.Tests.v3.ncrunchproject @@ -11,6 +11,9 @@ Microsoft.DotNet.Interactive.ExtensionLab.Tests.SQLiteConnectionTests.It_can_connect_and_query_data + + Microsoft.DotNet.Interactive.ExtensionLab.Tests.InspectTests + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Interactive.Jupyter.Tests/MagicCommandTests.lsmagic.cs b/src/Microsoft.DotNet.Interactive.Jupyter.Tests/MagicCommandTests.lsmagic.cs index e2b7575459..68208004bb 100644 --- a/src/Microsoft.DotNet.Interactive.Jupyter.Tests/MagicCommandTests.lsmagic.cs +++ b/src/Microsoft.DotNet.Interactive.Jupyter.Tests/MagicCommandTests.lsmagic.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; using System.CommandLine; using System.Linq; using System.Threading.Tasks; @@ -11,20 +12,37 @@ using Microsoft.DotNet.Interactive.Formatting; using Microsoft.DotNet.Interactive.FSharp; using Microsoft.DotNet.Interactive.Tests.Utility; +using Microsoft.VisualStudio.TestPlatform.Utilities; +using Pocket; +using Pocket.For.Xunit; using Xunit; +using Xunit.Abstractions; namespace Microsoft.DotNet.Interactive.Jupyter.Tests; public partial class MagicCommandTests { - public class LSMmagic + [LogToPocketLogger(FileNameEnvironmentVariable = "POCKETLOGGER_LOG_PATH")] + public class LSMmagic : IDisposable { + private readonly CompositeDisposable _disposables = new(); + + public LSMmagic(ITestOutputHelper output) + { + _disposables.Add(output.SubscribeToPocketLogger()); + } + + public void Dispose() + { + _disposables.Dispose(); + } + [Fact] public async Task lsmagic_lists_registered_magic_commands() { using var kernel = new CompositeKernel() - .UseDefaultMagicCommands() - .LogEventsToPocketLogger(); + .UseDefaultMagicCommands() + .LogEventsToPocketLogger(); kernel.AddDirective(new Command("#!one")); kernel.AddDirective(new Command("#!two")); diff --git a/src/Microsoft.DotNet.Interactive.Jupyter/KernelExtensions.cs b/src/Microsoft.DotNet.Interactive.Jupyter/KernelExtensions.cs index 6962ebdce0..5c4defeecb 100644 --- a/src/Microsoft.DotNet.Interactive.Jupyter/KernelExtensions.cs +++ b/src/Microsoft.DotNet.Interactive.Jupyter/KernelExtensions.cs @@ -224,6 +224,7 @@ private static Command lsmagic(Kernel kernel) foreach (var subkernel in subkernels) { var command = new SubmitCode(((SubmitCode)context.Command).Code); + command.SetParent(context.Command); await subkernel.SendAsync(command); } diff --git a/src/Microsoft.DotNet.Interactive.Kql.Tests/Microsoft.DotNet.Interactive.Kql.Tests.v3.ncrunchproject b/src/Microsoft.DotNet.Interactive.Kql.Tests/Microsoft.DotNet.Interactive.Kql.Tests.v3.ncrunchproject index 95a483b433..c62195cf77 100644 --- a/src/Microsoft.DotNet.Interactive.Kql.Tests/Microsoft.DotNet.Interactive.Kql.Tests.v3.ncrunchproject +++ b/src/Microsoft.DotNet.Interactive.Kql.Tests/Microsoft.DotNet.Interactive.Kql.Tests.v3.ncrunchproject @@ -1,3 +1,9 @@  - + + + + Microsoft.DotNet.Interactive.Kql.Tests.KqlConnectionTests.query_produces_expected_formatted_values + + + \ No newline at end of file diff --git a/src/Microsoft.DotNet.Interactive.Tests/KernelCommandNestingTests.cs b/src/Microsoft.DotNet.Interactive.Tests/KernelCommandNestingTests.cs index fec0d8a726..96bf6f7424 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/KernelCommandNestingTests.cs +++ b/src/Microsoft.DotNet.Interactive.Tests/KernelCommandNestingTests.cs @@ -20,95 +20,122 @@ public KernelCommandNestingTests(ITestOutputHelper output) : base(output) { } - [Fact] - public async Task Commands_sent_within_the_code_of_another_command_do_not_publish_CommandSucceeded_to_the_outer_result() + public class KernelEvents { - using var kernel = new CompositeKernel + [Fact] + public async Task Commands_sent_within_the_code_of_another_command_publish_error_events_on_CompositeKernel_for_failures() { - new CSharpKernel ( "cs1" ), - new CSharpKernel ( "cs2" ) - }; - var kernelEvents = kernel.KernelEvents.ToSubscribedList(); - var command = new SubmitCode(@$" + using var kernel = new CompositeKernel + { + new CSharpKernel("cs1"), + new CSharpKernel("cs2") + }; + var kernelEvents = kernel.KernelEvents.ToSubscribedList(); + var command = new SubmitCode($@" #!cs1 using {typeof(Kernel).Namespace}; using {typeof(KernelCommand).Namespace}; -await Kernel.Root.SendAsync(new SubmitCode(""1+1"", ""cs2"")); +await Kernel.Root.SendAsync(new SubmitCode(""error"", ""cs2"")); "); - await kernel.SendAsync(command); - using var _ = new AssertionScope(); - kernelEvents.Should() - .ContainSingle(e => e.Command == command); + await kernel.SendAsync(command); - kernelEvents.Should() - .NotContain(e => - e is CommandSucceeded && - e.Command.TargetKernelName == "cs2"); + kernelEvents.Should() + .ContainSingle() + .Which + .Message + .Should() + .Be("(1,1): error CS0103: The name 'error' does not exist in the current context"); + } } - [Fact] - public async Task Commands_sent_within_the_code_of_another_command_do_not_publish_CommandFailed_to_the_outer_result() + public class KernelCommandResultEvents { - using var kernel = new CompositeKernel + [Fact] + public async Task Commands_sent_within_the_code_of_another_command_do_not_publish_CommandSucceeded_to_the_outer_result() { - new CSharpKernel ( "cs1" ), - new CSharpKernel ( "cs2" ) - }; - var kernelEvents = kernel.KernelEvents.ToSubscribedList(); - var command = new SubmitCode($@" + using var kernel = new CompositeKernel + { + new CSharpKernel("cs1"), + new CSharpKernel("cs2") + }; + var command = new SubmitCode(@$" #!cs1 using {typeof(Kernel).Namespace}; using {typeof(KernelCommand).Namespace}; -await Kernel.Root.SendAsync(new SubmitCode(""error"", ""cs2"")); +await Kernel.Root.SendAsync(new SubmitCode(""1+1"", ""cs2"")); "); - await kernel.SendAsync(command); + var result = await kernel.SendAsync(command); - kernelEvents.Should() - .ContainSingle(e => e.Command == command); + using var _ = new AssertionScope(); - kernelEvents - .Should() - .NotContain(e => e is CommandFailed); - } + result.Events.Should().ContainSingle(e => e.Command == command); - [Fact] - public async Task Commands_sent_within_the_code_of_another_command_publish_error_events_on_CompositeKernel_for_failures() - { - using var kernel = new CompositeKernel - { - new CSharpKernel ( "cs1" ), - new CSharpKernel ( "cs2" ) - }; + result.Events.Should() + .NotContain(e => + e is CommandSucceeded && + e.Command.TargetKernelName == "cs2"); + } - var command = new SubmitCode($@" + [Fact] + public async Task Commands_sent_within_the_code_of_another_command_do_not_publish_CommandFailed_to_the_outer_result() + { + using var kernel = new CompositeKernel + { + new CSharpKernel("cs1"), + new CSharpKernel("cs2") + }; + var command = new SubmitCode($@" #!cs1 using {typeof(Kernel).Namespace}; using {typeof(KernelCommand).Namespace}; await Kernel.Root.SendAsync(new SubmitCode(""error"", ""cs2"")); "); - var result = await kernel.SendAsync(command); - - result.Events.Should() - .ContainSingle() - .Which - .Message - .Should() - .Be("(1,1): error CS0103: The name 'error' does not exist in the current context"); - } + var result = await kernel.SendAsync(command); - [Fact] - public async Task Commands_sent_within_the_code_of_another_command_publish_CommandSucceeded_to_the_inner_result() - { - using var kernel = new CompositeKernel - { - new CSharpKernel(), - new FSharpKernel() - }; - kernel.DefaultKernelName = "csharp"; + result.Events.Should() + .ContainSingle(e => e.Command == command); - var result = await kernel.SubmitCodeAsync( - @" + result.Events + .Should() + .NotContain(e => e is CommandFailed); + } + + [Fact(Skip = "Need to remove command id first")] // FIX: (Commands_sent_within_the_code_of_another_command_do_not_publish_events_to_the_outer_result) + public async Task Commands_sent_within_the_code_of_another_command_do_not_publish_events_to_the_outer_result() + { + using var kernel = new CompositeKernel + { + new CSharpKernel("cs1"), + new CSharpKernel("cs2") + }; + + var command = new SubmitCode($""" + using {typeof(Kernel).Namespace}; + using {typeof(KernelCommand).Namespace}; + var result = await Kernel.Root.SendAsync(new SubmitCode("123.Display();\n456", "cs2")); + """, "cs1"); + + var result = await kernel.SendAsync(command); + + using var _ = new AssertionScope(); + result.Events.Should().NotContainErrors(); + result.Events.Should().NotContain(e => e is DisplayedValueProduced); + result.Events.Should().NotContain(e => e is ReturnValueProduced); + } + + [Fact] + public async Task Commands_sent_within_the_code_of_another_command_publish_CommandSucceeded_to_the_inner_result() + { + using var kernel = new CompositeKernel + { + new CSharpKernel(), + new FSharpKernel() + }; + kernel.DefaultKernelName = "csharp"; + + var result = await kernel.SubmitCodeAsync( + @" using System.Reactive.Linq; using Microsoft.DotNet.Interactive; using Microsoft.DotNet.Interactive.Commands; @@ -118,24 +145,24 @@ public async Task Commands_sent_within_the_code_of_another_command_publish_Comma result.Events.Last() "); - result.Events.Should().NotContainErrors(); + result.Events.Should().NotContainErrors(); - result.Events - .Should() - .ContainSingle(e => e.Value is CommandSucceeded); - } + result.Events + .Should() + .ContainSingle(e => e.Value is CommandSucceeded); + } - [Fact] - public async Task Commands_sent_within_the_code_of_another_command_publish_CommandFailed_to_the_inner_result() - { - using var kernel = new CompositeKernel + [Fact] + public async Task Commands_sent_within_the_code_of_another_command_publish_CommandFailed_to_the_inner_result() { - new CSharpKernel ( "cs1" ), - new CSharpKernel ( "cs2" ) - }; - - var result = await kernel.SendAsync(new SubmitCode( - @" + using var kernel = new CompositeKernel + { + new CSharpKernel("cs1"), + new CSharpKernel("cs2") + }; + + var result = await kernel.SendAsync(new SubmitCode( + @" using System.Reactive.Linq; using Microsoft.DotNet.Interactive; using Microsoft.DotNet.Interactive.Commands; @@ -145,8 +172,9 @@ public async Task Commands_sent_within_the_code_of_another_command_publish_Comma result.Events.Last() ", "cs1")); - result.Events - .Should() - .ContainSingle(e => e.Value is CommandFailed); + result.Events + .Should() + .ContainSingle(e => e.Value is CommandFailed); + } } } \ No newline at end of file diff --git a/src/Microsoft.DotNet.Interactive.Tests/VariableSharingTests.SetMagicCommand.cs b/src/Microsoft.DotNet.Interactive.Tests/VariableSharingTests.SetMagicCommand.cs index 3fc65729ff..84b46ef2d7 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/VariableSharingTests.SetMagicCommand.cs +++ b/src/Microsoft.DotNet.Interactive.Tests/VariableSharingTests.SetMagicCommand.cs @@ -499,11 +499,11 @@ public async Task ProxyKernels_sharing_values_receives_them_as_deserialized_valu { using var localCompositeKernel = new CompositeKernel { - (new CSharpKernel()).UseValueSharing() + new CSharpKernel().UseValueSharing() }; using var remoteCompositeKernel = new CompositeKernel { - (new FSharpKernel()).UseValueSharing() + new FSharpKernel().UseValueSharing() }; ConnectHost.ConnectInProcessHost( diff --git a/src/Microsoft.DotNet.Interactive/Commands/KernelCommand.cs b/src/Microsoft.DotNet.Interactive/Commands/KernelCommand.cs index 4f4269d619..aaefe71c96 100644 --- a/src/Microsoft.DotNet.Interactive/Commands/KernelCommand.cs +++ b/src/Microsoft.DotNet.Interactive/Commands/KernelCommand.cs @@ -24,23 +24,32 @@ protected KernelCommand( RoutingSlip = new CommandRoutingSlip(); } - [JsonIgnore] - public KernelCommandInvocation Handler { get; set; } + [JsonIgnore] public KernelCommandInvocation Handler { get; set; } [JsonIgnore] - public KernelCommand Parent + public KernelCommand Parent => _parent; + + public void SetParent(KernelCommand parent) { - get => _parent; - internal set + if (parent is null) { - if (_parent is null) - { - _parent = value; - } - else if (_parent != value) + throw new ArgumentNullException(nameof(parent)); + } + + if (_parent is null) + { + if (_token is not null) { - throw new InvalidOperationException("Parent cannot be changed."); + _token = null; } + + _parent = parent; + + GetOrCreateToken(); + } + else if (_parent != parent) + { + throw new InvalidOperationException("Parent cannot be changed."); } } @@ -87,11 +96,11 @@ public string GetOrCreateToken() return _token; } - _token = CreateToken(); + _token = CreateRootToken(); return _token; - static string CreateToken() + static string CreateRootToken() { #if DEBUG var token = Interlocked.Increment(ref _nextRootToken); @@ -129,17 +138,56 @@ public virtual Task InvokeAsync(KernelInvocationContext context) public void SetId(string id) { - _id = id; + if (_id is not null) + { + } + else + { + // FIX: (SetId) remove this method + _id = id; + } } internal string GetOrCreateId() { + if (_token is not null) + { + // FIX: (GetOrCreateId) + if (_id is null) + { + _id = _token; + return _token; + } + else if (_id == _token) + { + return _token; + } + } + if (_id is not null) { return _id; } - SetId(Guid.NewGuid().ToString("N")); + if (_token is not null) + { + SetId(_token); + } + else if (Parent is not null) + { + SetId(GetOrCreateToken()); + } + else + { + SetId(GetOrCreateToken()); + } + + if (_id == _token) + { + } + else + { + } return _id; } @@ -151,17 +199,14 @@ public bool Equals(KernelCommand other) return true; } - if (other is null) + if (_token is not null && other?._token is not null) { - return false; - } + var tokensAreEqual = _token == other._token; - return GetOrCreateId() == other.GetOrCreateId(); - } + return tokensAreEqual; + } - public override int GetHashCode() - { - return GetOrCreateId().GetHashCode(); + return false; } internal bool IsSelfOrDescendantOf(KernelCommand other) diff --git a/src/Microsoft.DotNet.Interactive/CompositeKernel.cs b/src/Microsoft.DotNet.Interactive/CompositeKernel.cs index d3ce8be938..c291c56f00 100644 --- a/src/Microsoft.DotNet.Interactive/CompositeKernel.cs +++ b/src/Microsoft.DotNet.Interactive/CompositeKernel.cs @@ -195,7 +195,7 @@ private protected override async Task HandleRequestKernelInfoAsync( if (childKernel.SupportsCommand(command)) { var childCommand = new RequestKernelInfo(childKernel.Name); - childCommand.Parent = command; + childCommand.SetParent(command); childCommand.RoutingSlip.ContinueWith(command.RoutingSlip); await childKernel.HandleAsync(childCommand, context); } diff --git a/src/Microsoft.DotNet.Interactive/Connection/KernelCommandEnvelope.cs b/src/Microsoft.DotNet.Interactive/Connection/KernelCommandEnvelope.cs index 58ac9f8e7a..d5a72d9a29 100644 --- a/src/Microsoft.DotNet.Interactive/Connection/KernelCommandEnvelope.cs +++ b/src/Microsoft.DotNet.Interactive/Connection/KernelCommandEnvelope.cs @@ -144,12 +144,6 @@ public static IKernelCommandEnvelope Deserialize(JsonElement json) commandTypeJson = commandTypeProperty.GetString(); } - // restore the command id - if (json.TryGetProperty(nameof(SerializationModel.id), out var commandIdProperty)) - { - commandId = commandIdProperty.GetString(); - } - if (string.IsNullOrWhiteSpace(commandTypeJson)) { return null; @@ -167,9 +161,10 @@ public static IKernelCommandEnvelope Deserialize(JsonElement json) var command = (KernelCommand)JsonSerializer.Deserialize(commandJson, commandType, Serializer.JsonSerializerOptions); - if (commandId is not null) + // restore the command id + if (json.TryGetProperty(nameof(SerializationModel.id), out var commandIdProperty)) { - command.SetId(commandId); + commandId = commandIdProperty.GetString(); } // restore the command token @@ -182,6 +177,14 @@ public static IKernelCommandEnvelope Deserialize(JsonElement json) { command.SetToken(commandToken); } + else + { + } + + if (commandId is not null) + { + command.SetId(commandId); + } if (json.TryGetProperty(nameof(SerializationModel.routingSlip), out var routingSlipProperty)) { diff --git a/src/Microsoft.DotNet.Interactive/Connection/ProxyKernel.cs b/src/Microsoft.DotNet.Interactive/Connection/ProxyKernel.cs index 2c4c5a486b..7a7e9dff48 100644 --- a/src/Microsoft.DotNet.Interactive/Connection/ProxyKernel.cs +++ b/src/Microsoft.DotNet.Interactive/Connection/ProxyKernel.cs @@ -17,7 +17,6 @@ public sealed class ProxyKernel : Kernel private readonly IKernelCommandAndEventSender _sender; private readonly IKernelCommandAndEventReceiver _receiver; private ExecutionContext _executionContext; - private string _suppressCompletionsForCommandId; private readonly Dictionary completionSource, KernelInvocationContext invocationContext)> _inflight = new(); @@ -213,10 +212,6 @@ private void DelegatePublication(KernelEvent kernelEvent) _inflight.Remove(rootToken); pending.completionSource.TrySetResult(cs); break; - case CommandFailed _ when kernelEvent.Command.GetOrCreateId() == _suppressCompletionsForCommandId: - case CommandSucceeded _ when kernelEvent.Command.GetOrCreateId() == _suppressCompletionsForCommandId: - _suppressCompletionsForCommandId = null; - break; case KernelInfoProduced kip when kip.KernelInfo.Uri == KernelInfo.RemoteUri: { UpdateKernelInfoFromEvent(kip); diff --git a/src/Microsoft.DotNet.Interactive/Kernel.cs b/src/Microsoft.DotNet.Interactive/Kernel.cs index 6110f1f13b..9d485d75ac 100644 --- a/src/Microsoft.DotNet.Interactive/Kernel.cs +++ b/src/Microsoft.DotNet.Interactive/Kernel.cs @@ -136,8 +136,6 @@ public void DeferCommand(KernelCommand command) throw new ArgumentNullException(nameof(command)); } - command.SetToken($"deferredCommand::{Guid.NewGuid():N}"); - _deferredCommands.Enqueue(command); } @@ -193,9 +191,9 @@ handlingKernel.KernelInfo.Uri is { } && command.TargetKernelName ??= handlingKernel.Name; if (command.Parent is null && - !command.Equals(originalCommand)) + !ReferenceEquals(command, originalCommand)) { - command.Parent = originalCommand; + command.SetParent(originalCommand); } if (handlingKernel is ProxyKernel && @@ -337,22 +335,21 @@ public async Task SendAsync( using var disposable = new SerialDisposable(); - KernelInvocationContext context = null; command.ShouldPublishCompletionEvent ??= true; - context = KernelInvocationContext.GetOrCreateAmbientContext(command, GetKernelHost()?.ContextsByRootToken); + var context = KernelInvocationContext.GetOrCreateAmbientContext(command, GetKernelHost()?.ContextsByRootToken); + + // only subscribe for the root command + var currentCommandOwnsContext = ReferenceEquals(context.Command, command); if (command.Parent is null) { - if (!ReferenceEquals(command, context.Command)) + if (Scheduler.CurrentValue is { } currentlyExecutingCommand) { - command.Parent = context.Command; + command.SetParent(currentlyExecutingCommand); } } - // only subscribe for the root command - var currentCommandOwnsContext = context.Command.Equals(command); - if (currentCommandOwnsContext) { disposable.Disposable = context.KernelEvents.Subscribe(PublishEvent); @@ -526,7 +523,7 @@ public UndeferScheduledCommands( return Task.CompletedTask; }, targetKernelName: targetKernelName) { - Parent = parent; + SetParent(parent); } public override string ToString() => $"Undefer commands ahead of {Parent}"; @@ -603,7 +600,7 @@ private IReadOnlyList GetDeferredCommands(KernelCommand command, var currentInvocationContext = KernelInvocationContext.Current; kernelCommand.TargetKernelName = Name; kernelCommand.SchedulingScope = SchedulingScope; - kernelCommand.Parent = currentInvocationContext?.Command; + kernelCommand.SetParent(currentInvocationContext.Command); if (TrySplitCommand(kernelCommand, currentInvocationContext, out var commands)) { diff --git a/src/Microsoft.DotNet.Interactive/KernelCommandResult.cs b/src/Microsoft.DotNet.Interactive/KernelCommandResult.cs index e5b700432b..93b2bda179 100644 --- a/src/Microsoft.DotNet.Interactive/KernelCommandResult.cs +++ b/src/Microsoft.DotNet.Interactive/KernelCommandResult.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; @@ -11,17 +11,11 @@ namespace Microsoft.DotNet.Interactive; [TypeFormatterSource(typeof(MessageDiagnosticsFormatterSource))] public class KernelCommandResult { - private readonly List _events; + private readonly List _events = new(); - public KernelCommandResult(KernelCommand command, IEnumerable events = null) + public KernelCommandResult(KernelCommand command) { Command = command; - - _events = new(); - if (events is not null) - { - _events.AddRange(events); - } } public KernelCommand Command { get; } diff --git a/src/Microsoft.DotNet.Interactive/KernelExtensions.cs b/src/Microsoft.DotNet.Interactive/KernelExtensions.cs index 0a0bc264dc..ca3dba8937 100644 --- a/src/Microsoft.DotNet.Interactive/KernelExtensions.cs +++ b/src/Microsoft.DotNet.Interactive/KernelExtensions.cs @@ -361,7 +361,12 @@ ValueOptionResult ParseValueOption(ArgumentResult argResult) requestValue = new RequestValue(sourceValueName, JsonFormatter.MimeType, sourceKernelName); isByref = false; } - + + if (KernelInvocationContext.Current is {} context) + { + requestValue.SetParent(context.Command); + } + var result = destinationKernel.RootKernel.SendAsync(requestValue).GetAwaiter().GetResult(); if (result.Events.LastOrDefault() is CommandFailed failed) diff --git a/src/Microsoft.DotNet.Interactive/KernelInvocationContext.cs b/src/Microsoft.DotNet.Interactive/KernelInvocationContext.cs index a3ccaa7eb0..f7d7007785 100644 --- a/src/Microsoft.DotNet.Interactive/KernelInvocationContext.cs +++ b/src/Microsoft.DotNet.Interactive/KernelInvocationContext.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.ComponentModel; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Threading; @@ -25,7 +26,7 @@ public class KernelInvocationContext : IDisposable private readonly ReplaySubject _events = new(); - private readonly ConcurrentDictionary> _childCommands = new(); + private readonly ConcurrentDictionary> _childCommands = new(KernelCommandTokenComparer.Instance); private readonly CompositeDisposable _disposables = new(); @@ -157,17 +158,12 @@ private void SucceedOrFail( TryCancel(); IsFailed = true; - } else { if (message is not null) { - if (command.Parent is null) - { - Publish(new ErrorProduced(message, command), publishOnAmbientContextOnly: true); - } - else if (command.IsSelfOrDescendantOf(Command)) + if (command.IsSelfOrDescendantOf(Command)) { Publish(new ErrorProduced(message, command), publishOnAmbientContextOnly: true); } @@ -316,18 +312,11 @@ public static KernelInvocationContext GetOrCreateAmbientContext(KernelCommand co { _current.Value = new KernelInvocationContext(command); } - else + else if (!ReferenceEquals(_current.Value.Command, command)) { - if (!_current.Value.Command.Equals(command)) - { - var currentContext = _current.Value; + var currentContext = _current.Value; - AddChildCommandToContext(command, currentContext); - } - else - { - // FIX: (Establish) when does this happen? - } + AddChildCommandToContext(command, currentContext); } return _current.Value; @@ -402,4 +391,33 @@ public Task ScheduleAsync(Func func) => // FIX: (ScheduleAsync) inline this HandlingKernel.SendAsync(new AnonymousKernelCommand((_, invocationContext) => func(invocationContext))); -} \ No newline at end of file + + internal class KernelCommandTokenComparer : IEqualityComparer + { + private KernelCommandTokenComparer() + { + } + + public static readonly KernelCommandTokenComparer Instance = new(); + + public bool Equals(KernelCommand x, KernelCommand y) + { + if (ReferenceEquals(x, y)) + { + return true; + } + + if (x is not null && y is not null) + { + return x.GetOrCreateToken() == y.GetOrCreateToken(); + } + + return false; + } + + public int GetHashCode(KernelCommand obj) + { + return obj.GetOrCreateToken().GetHashCode(); + } + } +} diff --git a/src/Microsoft.DotNet.Interactive/KernelScheduler.cs b/src/Microsoft.DotNet.Interactive/KernelScheduler.cs index 79738ea9c8..5311521b94 100644 --- a/src/Microsoft.DotNet.Interactive/KernelScheduler.cs +++ b/src/Microsoft.DotNet.Interactive/KernelScheduler.cs @@ -48,6 +48,10 @@ public void CancelCurrentOperation() } } + internal T CurrentValue => _currentlyRunningOperation is { } currentOperation + ? currentOperation.Value + : default; + public Task RunAsync( T value, KernelSchedulerDelegate onExecuteAsync, diff --git a/src/Microsoft.DotNet.Interactive/Parsing/SubmissionParser.cs b/src/Microsoft.DotNet.Interactive/Parsing/SubmissionParser.cs index 5d7d397503..4f91708c05 100644 --- a/src/Microsoft.DotNet.Interactive/Parsing/SubmissionParser.cs +++ b/src/Microsoft.DotNet.Interactive/Parsing/SubmissionParser.cs @@ -259,7 +259,7 @@ private IReadOnlyList SplitSubmission( foreach (var command in commands) { - command.Parent = originalCommand; + command.SetParent(originalCommand); } return commands; diff --git a/src/dotnet-interactive/Pocket/Format.CustomizeLogString.cs b/src/dotnet-interactive/Pocket/Format.CustomizeLogString.cs index 7bc00f2e31..930c574f4d 100644 --- a/src/dotnet-interactive/Pocket/Format.CustomizeLogString.cs +++ b/src/dotnet-interactive/Pocket/Format.CustomizeLogString.cs @@ -291,7 +291,7 @@ private static void AppendLogString(this TextWriter writer, KernelEvent @event) writer.AppendProperties( (nameof(@event.Command), @event.Command.GetType().Name), - ("CommandToken", @event.Command.GetOrCreateToken())); + ("Token", @event.Command.GetOrCreateToken())); } private static void AppendProperties(this TextWriter writer, params (string Name, string? Value)[] properties) From eb1d77683944c10081bda1703e8685c70e17477b Mon Sep 17 00:00:00 2001 From: Jon Sequeira Date: Fri, 15 Sep 2023 10:57:54 -0700 Subject: [PATCH 2/9] remove command id from .NET code --- ...nteractive_api_is_not_changed.approved.txt | 5 +- ...t_been_broken.approved.CompileProject.json | 1 - ...not_been_broken.approved.OpenDocument.json | 1 - ..._not_been_broken.approved.OpenProject.json | 1 - ...been_broken.approved.AssemblyProduced.json | 1 - ...t_been_broken.approved.DocumentOpened.json | 1 - ...ot_been_broken.approved.ProjectOpened.json | 1 - .../SerializationTests.cs | 2 - ...t_has_not_been_broken.approved.Cancel.json | 1 - ...roken.approved.ChangeWorkingDirectory.json | 1 - ...not_been_broken.approved.DisplayError.json | 1 - ...not_been_broken.approved.DisplayValue.json | 1 - ...act_has_not_been_broken.approved.Quit.json | 1 - ...en_broken.approved.RequestCompletions.json | 1 - ...en_broken.approved.RequestDiagnostics.json | 1 - ...been_broken.approved.RequestHoverText.json | 1 - ...not_been_broken.approved.RequestInput.json | 1 - ...een_broken.approved.RequestKernelInfo.json | 1 - ..._broken.approved.RequestSignatureHelp.json | 1 - ...not_been_broken.approved.RequestValue.json | 1 - ...een_broken.approved.RequestValueInfos.json | 1 - ...been_broken.approved.SendEditableCode.json | 1 - ...as_not_been_broken.approved.SendValue.json | 1 - ...s_not_been_broken.approved.SubmitCode.json | 1 - ..._broken.approved.UpdateDisplayedValue.json | 1 - ...roken.approved.CodeSubmissionReceived.json | 1 - ...ot_been_broken.approved.CommandFailed.json | 1 - ...been_broken.approved.CommandSucceeded.json | 1 - ...proved.CompleteCodeSubmissionReceived.json | 1 - ...n_broken.approved.CompletionsProduced.json | 1 - ...n_broken.approved.DiagnosticsProduced.json | 1 - ...roken.approved.DisplayedValueProduced.json | 1 - ...broken.approved.DisplayedValueUpdated.json | 1 - ...ot_been_broken.approved.ErrorProduced.json | 1 - ...een_broken.approved.HoverTextProduced.json | 1 - ...oved.IncompleteCodeSubmissionReceived.json | 1 - ...ot_been_broken.approved.InputProduced.json | 1 - ...broken.approved.KernelExtensionLoaded.json | 1 - ...en_broken.approved.KernelInfoProduced.json | 1 - ...not_been_broken.approved.PackageAdded.json | 1 - ...n_broken.approved.ReturnValueProduced.json | 1 - ...broken.approved.SignatureHelpProduced.json | 1 - ...n.approved.StandardErrorValueProduced.json | 1 - ....approved.StandardOutputValueProduced.json | 1 - ...en_broken.approved.ValueInfosProduced.json | 1 - ...ot_been_broken.approved.ValueProduced.json | 1 - ...oken.approved.WorkingDirectoryChanged.json | 1 - .../Connection/SerializationTests.cs | 2 - .../Commands/KernelCommand.cs | 59 +------------------ .../Connection/IKernelCommandEnvelope.cs | 3 - .../Connection/KernelCommandEnvelope.cs | 22 +------ .../Connection/KernelEventEnvelope.cs | 1 - .../Connection/ProxyKernel.cs | 1 - 53 files changed, 3 insertions(+), 137 deletions(-) diff --git a/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt b/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt index 909f9c07c4..165899bed5 100644 --- a/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt +++ b/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt @@ -394,10 +394,9 @@ Microsoft.DotNet.Interactive.Commands public Microsoft.DotNet.Interactive.CommandRoutingSlip RoutingSlip { get;} public System.String TargetKernelName { get;} public System.Boolean Equals(KernelCommand other) - public System.Int32 GetHashCode() public System.String GetOrCreateToken() public System.Threading.Tasks.Task InvokeAsync(Microsoft.DotNet.Interactive.KernelInvocationContext context) - public System.Void SetId(System.String id) + public System.Void SetParent(KernelCommand parent) public System.Void SetToken(System.String token) public abstract class LanguageServiceCommand : KernelCommand, System.IEquatable public System.String Code { get;} @@ -478,7 +477,6 @@ Microsoft.DotNet.Interactive.Connection public System.Threading.Tasks.Task SendAsync(Microsoft.DotNet.Interactive.Events.KernelEvent kernelEvent, System.Threading.CancellationToken cancellationToken) public abstract class IKernelCommandEnvelope public Microsoft.DotNet.Interactive.Commands.KernelCommand Command { get;} - public System.String CommandId { get;} public System.String CommandType { get;} public System.String Token { get;} public abstract class IKernelEventEnvelope @@ -512,7 +510,6 @@ Microsoft.DotNet.Interactive.Connection public static System.Void RegisterDefaults() public static System.String Serialize(Microsoft.DotNet.Interactive.Commands.KernelCommand command) public static System.String Serialize(IKernelCommandEnvelope envelope) - public System.String CommandId { get;} public System.String CommandType { get;} public System.String Token { get;} public class KernelCommandEnvelope : KernelCommandEnvelope, IKernelCommandEnvelope diff --git a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.CompileProject.json b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.CompileProject.json index 13884facf5..fc3e7b94ca 100644 --- a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.CompileProject.json +++ b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.CompileProject.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "CompileProject", "command": { "targetKernelName": null, diff --git a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.OpenDocument.json b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.OpenDocument.json index 6a8b7a9086..0718274ab1 100644 --- a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.OpenDocument.json +++ b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.OpenDocument.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "OpenDocument", "command": { "relativeFilePath": "./path", diff --git a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.OpenProject.json b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.OpenProject.json index d05130f07d..36a3753931 100644 --- a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.OpenProject.json +++ b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Command_contract_has_not_been_broken.approved.OpenProject.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "OpenProject", "command": { "project": { diff --git a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.AssemblyProduced.json b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.AssemblyProduced.json index 16cef0e05a..48488c765b 100644 --- a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.AssemblyProduced.json +++ b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.AssemblyProduced.json @@ -7,7 +7,6 @@ "eventType": "AssemblyProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "CompileProject", "command": { "targetKernelName": null, diff --git a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.DocumentOpened.json b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.DocumentOpened.json index c1d9027125..c338223234 100644 --- a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.DocumentOpened.json +++ b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.DocumentOpened.json @@ -7,7 +7,6 @@ "eventType": "DocumentOpened", "command": { "token": "the-token", - "id": "command-id", "commandType": "OpenDocument", "command": { "relativeFilePath": "./path", diff --git a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.ProjectOpened.json b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.ProjectOpened.json index 039015de38..c115ed1564 100644 --- a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.ProjectOpened.json +++ b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.Event_contract_has_not_been_broken.approved.ProjectOpened.json @@ -15,7 +15,6 @@ "eventType": "ProjectOpened", "command": { "token": "the-token", - "id": "command-id", "commandType": "OpenProject", "command": { "project": { diff --git a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.cs b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.cs index 69bdf6c373..31e3e04d83 100644 --- a/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.cs +++ b/src/Microsoft.DotNet.Interactive.CSharpProject.Tests/SerializationTests.cs @@ -97,7 +97,6 @@ public void Command_contract_has_not_been_broken(KernelCommand command) .UsingExtension($"{command.GetType().Name}.json") .SetInteractive(Debugger.IsAttached); - command.SetId("command-id"); command.SetToken("the-token"); var json = KernelCommandEnvelope.Serialize(command); @@ -113,7 +112,6 @@ public void Event_contract_has_not_been_broken(KernelEvent @event) .UsingExtension($"{@event.GetType().Name}.json") .SetInteractive(Debugger.IsAttached); - @event.Command?.SetId("command-id"); @event.Command?.SetToken("the-token"); var json = KernelEventEnvelope.Serialize(@event); diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.Cancel.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.Cancel.json index c2d57111d6..ba6647b830 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.Cancel.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.Cancel.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "Cancel", "command": { "targetKernelName": "csharp", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.ChangeWorkingDirectory.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.ChangeWorkingDirectory.json index 17d06154d7..667f03ec66 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.ChangeWorkingDirectory.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.ChangeWorkingDirectory.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "ChangeWorkingDirectory", "command": { "workingDirectory": "/path/to/somewhere", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.DisplayError.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.DisplayError.json index adbea50120..ef198bca47 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.DisplayError.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.DisplayError.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "DisplayError", "command": { "message": "oops!", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.DisplayValue.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.DisplayValue.json index 24772bab49..a92663cc1a 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.DisplayValue.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.DisplayValue.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "DisplayValue", "command": { "formattedValue": { diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.Quit.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.Quit.json index 3208914666..e4dff149fe 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.Quit.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.Quit.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "Quit", "command": { "targetKernelName": null, diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestCompletions.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestCompletions.json index 8df34dc3d4..0badaf7c55 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestCompletions.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestCompletions.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "RequestCompletions", "command": { "code": "Cons", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestDiagnostics.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestDiagnostics.json index 6fec51aebe..22884e46fc 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestDiagnostics.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestDiagnostics.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "RequestDiagnostics", "command": { "code": "the-code", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestHoverText.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestHoverText.json index dbdf48da7f..0c001cb3d8 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestHoverText.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestHoverText.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "RequestHoverText", "command": { "code": "document-contents", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestInput.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestInput.json index f5c9c65706..50b1212e7c 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestInput.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestInput.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "RequestInput", "command": { "prompt": "provide answer", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestKernelInfo.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestKernelInfo.json index b388636f03..112196338d 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestKernelInfo.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestKernelInfo.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "RequestKernelInfo", "command": { "targetKernelName": null, diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestSignatureHelp.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestSignatureHelp.json index f2bca8dbdb..9ff0a79954 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestSignatureHelp.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestSignatureHelp.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "RequestSignatureHelp", "command": { "code": "sig-help-contents", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestValue.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestValue.json index fbcb3f0178..9d1e6113e5 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestValue.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestValue.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "RequestValue", "command": { "name": "a", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestValueInfos.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestValueInfos.json index 683ead40ba..db21a89252 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestValueInfos.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.RequestValueInfos.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "RequestValueInfos", "command": { "mimeType": "text/plain+summary", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SendEditableCode.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SendEditableCode.json index a700e6e5d6..c2ba91b3cf 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SendEditableCode.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SendEditableCode.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "SendEditableCode", "command": { "kernelName": "someKernelName", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SendValue.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SendValue.json index 0fb1e1eca6..118d3957fc 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SendValue.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SendValue.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "SendValue", "command": { "formattedValue": { diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SubmitCode.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SubmitCode.json index 980a92f806..7ff208b5d8 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SubmitCode.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SubmitCode.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "123", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.UpdateDisplayedValue.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.UpdateDisplayedValue.json index 8894453935..3d06eacdff 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.UpdateDisplayedValue.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.UpdateDisplayedValue.json @@ -1,6 +1,5 @@ { "token": "the-token", - "id": "command-id", "commandType": "UpdateDisplayedValue", "command": { "formattedValue": { diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CodeSubmissionReceived.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CodeSubmissionReceived.json index 275c6b4157..5450a5069b 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CodeSubmissionReceived.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CodeSubmissionReceived.json @@ -5,7 +5,6 @@ "eventType": "CodeSubmissionReceived", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "123", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandFailed.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandFailed.json index 66a9453d7e..d46893ccac 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandFailed.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandFailed.json @@ -6,7 +6,6 @@ "eventType": "CommandFailed", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "123", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandSucceeded.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandSucceeded.json index 10707653e0..de58413aa7 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandSucceeded.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandSucceeded.json @@ -5,7 +5,6 @@ "eventType": "CommandSucceeded", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "123", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompleteCodeSubmissionReceived.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompleteCodeSubmissionReceived.json index aeac699d27..1ea4838c31 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompleteCodeSubmissionReceived.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompleteCodeSubmissionReceived.json @@ -5,7 +5,6 @@ "eventType": "CompleteCodeSubmissionReceived", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "123", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompletionsProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompletionsProduced.json index e340eed4a7..2fc96eebd4 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompletionsProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompletionsProduced.json @@ -16,7 +16,6 @@ "eventType": "CompletionsProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "RequestCompletions", "command": { "code": "Console.Wri", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DiagnosticsProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DiagnosticsProduced.json index 00ab6ca44e..6a43d6113e 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DiagnosticsProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DiagnosticsProduced.json @@ -22,7 +22,6 @@ "eventType": "DiagnosticsProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "123", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueProduced.json index 6a744a56a4..34c1125afc 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueProduced.json @@ -12,7 +12,6 @@ "eventType": "DisplayedValueProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "b(\"hi!\")", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueUpdated.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueUpdated.json index 51292cbce3..1589efd86c 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueUpdated.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueUpdated.json @@ -12,7 +12,6 @@ "eventType": "DisplayedValueUpdated", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "b(\"hi!\")", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ErrorProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ErrorProduced.json index bad1977fba..441a2f3e3c 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ErrorProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ErrorProduced.json @@ -7,7 +7,6 @@ "eventType": "ErrorProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "123", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.HoverTextProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.HoverTextProduced.json index 339d46b4de..5cc82eeae3 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.HoverTextProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.HoverTextProduced.json @@ -21,7 +21,6 @@ "eventType": "HoverTextProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "RequestHoverText", "command": { "code": "document-contents", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.IncompleteCodeSubmissionReceived.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.IncompleteCodeSubmissionReceived.json index f768639ec7..19fe97ab53 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.IncompleteCodeSubmissionReceived.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.IncompleteCodeSubmissionReceived.json @@ -3,7 +3,6 @@ "eventType": "IncompleteCodeSubmissionReceived", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "123", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.InputProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.InputProduced.json index b2b557402c..621d1aad29 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.InputProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.InputProduced.json @@ -5,7 +5,6 @@ "eventType": "InputProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "RequestInput", "command": { "prompt": "What is the path to the log file?", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelExtensionLoaded.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelExtensionLoaded.json index 0df0e8154a..fe1d7d6589 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelExtensionLoaded.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelExtensionLoaded.json @@ -3,7 +3,6 @@ "eventType": "KernelExtensionLoaded", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "#r \"nuget:package\" ", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelInfoProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelInfoProduced.json index 0ffd81b7d0..b36b435d80 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelInfoProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelInfoProduced.json @@ -23,7 +23,6 @@ "eventType": "KernelInfoProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "RequestKernelInfo", "command": { "targetKernelName": null, diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.PackageAdded.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.PackageAdded.json index ee0bd188f4..613069209b 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.PackageAdded.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.PackageAdded.json @@ -17,7 +17,6 @@ "eventType": "PackageAdded", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "#r \"nuget:ThePackage,1.2.3\"", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ReturnValueProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ReturnValueProduced.json index 7e34bd6a1d..f5cb58ad21 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ReturnValueProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ReturnValueProduced.json @@ -12,7 +12,6 @@ "eventType": "ReturnValueProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "b(\"hi!\")", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.SignatureHelpProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.SignatureHelpProduced.json index a2aa1a7c67..be527fd13d 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.SignatureHelpProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.SignatureHelpProduced.json @@ -34,7 +34,6 @@ "eventType": "SignatureHelpProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "RequestSignatureHelp", "command": { "code": "sig-help-contents", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardErrorValueProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardErrorValueProduced.json index 14459174fa..dde938502b 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardErrorValueProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardErrorValueProduced.json @@ -12,7 +12,6 @@ "eventType": "StandardErrorValueProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "123", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardOutputValueProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardOutputValueProduced.json index c789cfb7c0..69b3621add 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardOutputValueProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardOutputValueProduced.json @@ -12,7 +12,6 @@ "eventType": "StandardOutputValueProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "SubmitCode", "command": { "code": "Console.Write(123);", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ValueInfosProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ValueInfosProduced.json index b528c6b7b6..7fa12afdd6 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ValueInfosProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ValueInfosProduced.json @@ -42,7 +42,6 @@ "eventType": "ValueInfosProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "RequestValueInfos", "command": { "mimeType": "text/plain+summary", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ValueProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ValueProduced.json index 88d5e61699..3eaee18e16 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ValueProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ValueProduced.json @@ -10,7 +10,6 @@ "eventType": "ValueProduced", "command": { "token": "the-token", - "id": "command-id", "commandType": "RequestValue", "command": { "name": "a", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.WorkingDirectoryChanged.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.WorkingDirectoryChanged.json index b5c0facf74..1431c14b3c 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.WorkingDirectoryChanged.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.WorkingDirectoryChanged.json @@ -5,7 +5,6 @@ "eventType": "WorkingDirectoryChanged", "command": { "token": "the-token", - "id": "command-id", "commandType": "ChangeWorkingDirectory", "command": { "workingDirectory": "some/different/directory", diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.cs b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.cs index 111fedcaf5..a3a6746f15 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.cs +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.cs @@ -97,7 +97,6 @@ public void Command_contract_has_not_been_broken(KernelCommand command) .UsingExtension($"{command.GetType().Name}.json") .SetInteractive(Debugger.IsAttached); - command.SetId("command-id"); command.SetToken("the-token"); var json = KernelCommandEnvelope.Serialize(command); @@ -113,7 +112,6 @@ public void Event_contract_has_not_been_broken(KernelEvent @event) .UsingExtension($"{@event.GetType().Name}.json") .SetInteractive(Debugger.IsAttached); - @event.Command.SetId("command-id"); @event.Command.SetToken("the-token"); var json = KernelEventEnvelope.Serialize(@event); diff --git a/src/Microsoft.DotNet.Interactive/Commands/KernelCommand.cs b/src/Microsoft.DotNet.Interactive/Commands/KernelCommand.cs index aaefe71c96..46919068c9 100644 --- a/src/Microsoft.DotNet.Interactive/Commands/KernelCommand.cs +++ b/src/Microsoft.DotNet.Interactive/Commands/KernelCommand.cs @@ -14,7 +14,6 @@ public abstract class KernelCommand : IEquatable { private KernelCommand _parent; private string _token; - private string _id; protected KernelCommand( string targetKernelName = null) @@ -135,63 +134,7 @@ public virtual Task InvokeAsync(KernelInvocationContext context) return Handler(this, context); } - - public void SetId(string id) - { - if (_id is not null) - { - } - else - { - // FIX: (SetId) remove this method - _id = id; - } - } - - internal string GetOrCreateId() - { - if (_token is not null) - { - // FIX: (GetOrCreateId) - if (_id is null) - { - _id = _token; - return _token; - } - else if (_id == _token) - { - return _token; - } - } - - if (_id is not null) - { - return _id; - } - - if (_token is not null) - { - SetId(_token); - } - else if (Parent is not null) - { - SetId(GetOrCreateToken()); - } - else - { - SetId(GetOrCreateToken()); - } - - if (_id == _token) - { - } - else - { - } - - return _id; - } - + public bool Equals(KernelCommand other) { if (ReferenceEquals(this, other)) diff --git a/src/Microsoft.DotNet.Interactive/Connection/IKernelCommandEnvelope.cs b/src/Microsoft.DotNet.Interactive/Connection/IKernelCommandEnvelope.cs index 7d9bac33e1..5be698ba17 100644 --- a/src/Microsoft.DotNet.Interactive/Connection/IKernelCommandEnvelope.cs +++ b/src/Microsoft.DotNet.Interactive/Connection/IKernelCommandEnvelope.cs @@ -12,7 +12,4 @@ public interface IKernelCommandEnvelope string CommandType { get; } string Token { get; } - - // TODO: (CommandId) rename this - string CommandId { get; } } \ No newline at end of file diff --git a/src/Microsoft.DotNet.Interactive/Connection/KernelCommandEnvelope.cs b/src/Microsoft.DotNet.Interactive/Connection/KernelCommandEnvelope.cs index d5a72d9a29..eaa1c6dd45 100644 --- a/src/Microsoft.DotNet.Interactive/Connection/KernelCommandEnvelope.cs +++ b/src/Microsoft.DotNet.Interactive/Connection/KernelCommandEnvelope.cs @@ -37,8 +37,6 @@ protected KernelCommandEnvelope(KernelCommand command) public string Token => _command.GetOrCreateToken(); - public string CommandId => _command.GetOrCreateId(); - KernelCommand IKernelCommandEnvelope.Command => _command; public static void RegisterCommand() where T : KernelCommand @@ -137,7 +135,6 @@ public static IKernelCommandEnvelope Deserialize(JsonElement json) var commandTypeJson = string.Empty; string commandJson; var commandToken = string.Empty; - var commandId = string.Empty; if (json.TryGetProperty(nameof(SerializationModel.commandType), out var commandTypeProperty)) { @@ -161,12 +158,6 @@ public static IKernelCommandEnvelope Deserialize(JsonElement json) var command = (KernelCommand)JsonSerializer.Deserialize(commandJson, commandType, Serializer.JsonSerializerOptions); - // restore the command id - if (json.TryGetProperty(nameof(SerializationModel.id), out var commandIdProperty)) - { - commandId = commandIdProperty.GetString(); - } - // restore the command token if (json.TryGetProperty(nameof(SerializationModel.token), out var tokenProperty)) { @@ -177,15 +168,7 @@ public static IKernelCommandEnvelope Deserialize(JsonElement json) { command.SetToken(commandToken); } - else - { - } - - if (commandId is not null) - { - command.SetId(commandId); - } - + if (json.TryGetProperty(nameof(SerializationModel.routingSlip), out var routingSlipProperty)) { foreach (var routingSlipItem in routingSlipProperty.EnumerateArray()) @@ -225,7 +208,6 @@ private static SerializationModel CreateSerializationModel(IKernelCommandEnvelop command = envelope.Command, commandType = envelope.CommandType, token = envelope.Token, - id = envelope.CommandId, routingSlip = envelope.Command.RoutingSlip.ToUriArray() }; return serializationModel; @@ -235,8 +217,6 @@ internal class SerializationModel { public string token { get; set; } - public string id { get; set; } - public string commandType { get; set; } public object command { get; set; } diff --git a/src/Microsoft.DotNet.Interactive/Connection/KernelEventEnvelope.cs b/src/Microsoft.DotNet.Interactive/Connection/KernelEventEnvelope.cs index 950adfa2b7..77018f28b2 100644 --- a/src/Microsoft.DotNet.Interactive/Connection/KernelEventEnvelope.cs +++ b/src/Microsoft.DotNet.Interactive/Connection/KernelEventEnvelope.cs @@ -215,7 +215,6 @@ public static string Serialize(IKernelEventEnvelope eventEnvelope) command = commandEnvelope.Command, commandType = commandEnvelope.CommandType, token = eventEnvelope.Event.Command.GetOrCreateToken(), - id = commandEnvelope.CommandId, routingSlip = commandEnvelope.Command.RoutingSlip.ToUriArray() }; } diff --git a/src/Microsoft.DotNet.Interactive/Connection/ProxyKernel.cs b/src/Microsoft.DotNet.Interactive/Connection/ProxyKernel.cs index 7a7e9dff48..997235810e 100644 --- a/src/Microsoft.DotNet.Interactive/Connection/ProxyKernel.cs +++ b/src/Microsoft.DotNet.Interactive/Connection/ProxyKernel.cs @@ -83,7 +83,6 @@ private Task HandleByForwardingToRemoteAsync(KernelCommand command, KernelInvoca _executionContext = ExecutionContext.Capture(); var token = command.GetOrCreateToken(); - command.GetOrCreateId(); command.OriginUri ??= KernelInfo.Uri; From 2af4347b76dd7ced9a9faf299415a95b32406f0f Mon Sep 17 00:00:00 2001 From: Jon Sequeira Date: Fri, 15 Sep 2023 11:29:44 -0700 Subject: [PATCH 3/9] wip: remove id from TypeScript command --- .../src/dynamicGrammarSemanticTokenProvider.ts | 2 +- .../src/interactiveClient.ts | 15 ++++++--------- src/polyglot-notebooks/src/commandsAndEvents.ts | 15 ++------------- src/polyglot-notebooks/src/kernel.ts | 2 +- .../src/kernelInvocationContext.ts | 5 +---- src/polyglot-notebooks/src/proxyKernel.ts | 15 +++++++-------- src/polyglot-notebooks/src/webview/activation.ts | 2 +- 7 files changed, 19 insertions(+), 37 deletions(-) diff --git a/src/polyglot-notebooks-vscode-common/src/dynamicGrammarSemanticTokenProvider.ts b/src/polyglot-notebooks-vscode-common/src/dynamicGrammarSemanticTokenProvider.ts index 844899e25a..e30484c150 100644 --- a/src/polyglot-notebooks-vscode-common/src/dynamicGrammarSemanticTokenProvider.ts +++ b/src/polyglot-notebooks-vscode-common/src/dynamicGrammarSemanticTokenProvider.ts @@ -516,7 +516,7 @@ export class DynamicGrammarSemanticTokenProvider { }); const isEmpty = (text: string) => { - return text == null || text.match(/^\s*$/) !== null; + return text === null || text.match(/^\s*$/) !== null; }; // prepare grammar scope loader diff --git a/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts b/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts index 7cbace09be..50fb6ca658 100644 --- a/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts +++ b/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts @@ -157,10 +157,8 @@ export class InteractiveClient { targetKernelName: language } ); - if (configuration !== undefined && configuration.id !== undefined) { - command.setId(configuration.id); - } - const commandId = command.id; + + const commandToken = command.token; try { return this.submitCode(command, language, eventEnvelope => { if (this.deferredOutput.length > 0) { @@ -173,7 +171,7 @@ export class InteractiveClient { switch (eventEnvelope.eventType) { // if kernel languages were added, handle those events here case CommandSucceededType: - if (eventEnvelope.command?.id === commandId) { + if (eventEnvelope.command?.token === commandToken) { // only complete this promise if it's the root command resolve(!failureReported); } @@ -184,7 +182,7 @@ export class InteractiveClient { const errorOutput = this.config.createErrorOutput(err.message, this.getNextOutputId()); outputReporter(errorOutput); failureReported = true; - if (eventEnvelope.command?.id === commandId) { + if (eventEnvelope.command?.token === commandToken) { // only complete this promise if it's the root command reject(err); } @@ -404,20 +402,19 @@ export class InteractiveClient { return new Promise((resolve, reject) => { let failureReported = false; const token = command.getOrCreateToken(); - const id = command.id; const commandType = command.commandType; let disposable = this.subscribeToKernelTokenEvents(token, eventEnvelope => { switch (eventEnvelope.eventType) { case CommandFailedType: let err = eventEnvelope.event; failureReported = true; - if (eventEnvelope.command?.id === id) { + if (eventEnvelope.command?.token === token) { disposable.dispose(); reject(err); } break; case CommandSucceededType: - if (eventEnvelope.command?.id === id) { + if (eventEnvelope.command?.token === token) { disposable.dispose(); resolve(); } diff --git a/src/polyglot-notebooks/src/commandsAndEvents.ts b/src/polyglot-notebooks/src/commandsAndEvents.ts index 7867148b25..5fa0953faf 100644 --- a/src/polyglot-notebooks/src/commandsAndEvents.ts +++ b/src/polyglot-notebooks/src/commandsAndEvents.ts @@ -20,7 +20,6 @@ export interface KernelEventEnvelopeModel { export interface KernelCommandEnvelopeModel { token?: string; - id?: string; commandType: contracts.KernelCommandType; command: contracts.KernelCommand; routingSlip?: string[]; @@ -46,7 +45,6 @@ export class KernelCommandEnvelope { private _childCommandCounter: number = 0; private _routingSlip: CommandRoutingSlip = new CommandRoutingSlip(); - private _id: string; private _token?: string; private _parentCommand?: KernelCommandEnvelope; @@ -56,11 +54,10 @@ export class KernelCommandEnvelope { const guidBytes = uuid.parse(uuid.v4()); const data = new Uint8Array(guidBytes); - this._id = toBase64String(data); } - public get id(): string { - return this._id; + public get token(): string | undefined { + return this._token; } public get routingSlip(): CommandRoutingSlip { @@ -78,10 +75,6 @@ export class KernelCommandEnvelope { this._parentCommand = parentCommand; } - public setId(id: string) { - this._id = id; - } - public getOrCreateToken(): string { if (this._token) { return this._token; @@ -129,7 +122,6 @@ export class KernelCommandEnvelope { commandType: this.commandType, command: this.command, routingSlip: this._routingSlip.toArray(), - id: this._id, token: this.getOrCreateToken() }; @@ -139,9 +131,6 @@ export class KernelCommandEnvelope { public static fromJson(model: KernelCommandEnvelopeModel): KernelCommandEnvelope { const command = new KernelCommandEnvelope(model.commandType, model.command); command._routingSlip = CommandRoutingSlip.fromUris(model.routingSlip || []); - if (model.id) { - command._id = model.id; - } command._token = model.token; return command; } diff --git a/src/polyglot-notebooks/src/kernel.ts b/src/polyglot-notebooks/src/kernel.ts index ebab7ea5b4..015c2359ac 100644 --- a/src/polyglot-notebooks/src/kernel.ts +++ b/src/polyglot-notebooks/src/kernel.ts @@ -306,7 +306,7 @@ export async function submitCommandAndGetResult { const commandToken = commandInvocation.commandEnvelope.getOrCreateToken(); - const commandId = commandInvocation.commandEnvelope.id; const completionSource = new PromiseCompletionSource(); const command = commandInvocation.commandEnvelope; // fix : is this the right way? We are trying to avoid forwarding events we just did forward @@ -78,7 +77,7 @@ export class ProxyKernel extends Kernel { } else if (envelope.command!.getOrCreateToken() === commandToken) { - Logger.default.info(`proxy name=${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] processing event, envelopeid=${envelope.command!.id}, commandid=${commandId}`); + Logger.default.info(`proxy name=${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] processing event, envelopeToken=${envelope.command!.token}, commandToken=${commandToken}`); Logger.default.info(`proxy name=${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] processing event, ${JSON.stringify(envelope)}`); try { @@ -113,12 +112,12 @@ export class ProxyKernel extends Kernel { break; case commandsAndEvents.CommandFailedType: case commandsAndEvents.CommandSucceededType: - Logger.default.info(`proxy name=${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] finished, envelopeid=${envelope.command!.id}, commandid=${commandId}`); - if (envelope.command!.id === commandId) { - Logger.default.info(`proxy name=${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] resolving promise, envelopeid=${envelope.command!.id}, commandid=${commandId}`); + Logger.default.info(`proxy name=${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] finished, token=${envelope.command!.token}, commandToken=${commandToken}`); + if (envelope.command!.token === commandToken) { + Logger.default.info(`proxy name=${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] resolving promise, envelopeToken=${envelope.command!.token}, commandToken=${commandToken}`); completionSource.resolve(envelope); } else { - Logger.default.info(`proxy name=${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] not resolving promise, envelopeid=${envelope.command!.id}, commandid=${commandId}`); + Logger.default.info(`proxy name=${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] not resolving promise, envelopeToken=${envelope.command!.token}, commandToken=${commandToken}`); this.delegatePublication(envelope, commandInvocation.context); } break; @@ -147,12 +146,12 @@ export class ProxyKernel extends Kernel { } Logger.default.info(`proxy ${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] forwarding command ${commandInvocation.commandEnvelope.commandType} to ${commandInvocation.commandEnvelope.command.destinationUri}`); this._sender.send(commandInvocation.commandEnvelope); - Logger.default.info(`proxy ${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] about to await with token ${commandToken} and commandid ${commandId}`); + Logger.default.info(`proxy ${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] about to await with token ${commandToken}`); const enventEnvelope = await completionSource.promise; if (enventEnvelope.eventType === commandsAndEvents.CommandFailedType) { commandInvocation.context.fail((enventEnvelope.event).message); } - Logger.default.info(`proxy ${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] done awaiting with token ${commandToken}} and commandid ${commandId}`); + Logger.default.info(`proxy ${this.name}[local uri:${this.kernelInfo.uri}, remote uri:${this.kernelInfo.remoteUri}] done awaiting with token ${commandToken}}`); } catch (e) { commandInvocation.context.fail((e).message); diff --git a/src/polyglot-notebooks/src/webview/activation.ts b/src/polyglot-notebooks/src/webview/activation.ts index a1a5248b70..3c7622f1c6 100644 --- a/src/polyglot-notebooks/src/webview/activation.ts +++ b/src/polyglot-notebooks/src/webview/activation.ts @@ -40,7 +40,7 @@ function configure(global: any, context: KernelMessagingApi) { if (arg.envelope && arg.webViewId === webViewId) { const envelope = (arg.envelope); if (connection.isKernelEventEnvelopeModel(envelope)) { - Logger.default.info(`channel got ${envelope.eventType} with token ${envelope.command?.token} and id ${envelope.command?.id}`); + Logger.default.info(`channel got ${envelope.eventType} with token ${envelope.command?.token}`); const event = KernelEventEnvelope.fromJson(envelope); remoteToLocal.next(event); } else { From e673f0352ff7ff56c9573f8f173a9bcf6a6e8325 Mon Sep 17 00:00:00 2001 From: Diego Colombo Date: Mon, 18 Sep 2023 15:43:07 +0100 Subject: [PATCH 4/9] Fix tests for polyglot notebook ts project --- src/polyglot-notebooks/tests/testSupport.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/polyglot-notebooks/tests/testSupport.ts b/src/polyglot-notebooks/tests/testSupport.ts index d8227dc0a7..07d5098620 100644 --- a/src/polyglot-notebooks/tests/testSupport.ts +++ b/src/polyglot-notebooks/tests/testSupport.ts @@ -73,11 +73,9 @@ export function createInMemoryChannels(): { export function clearTokenAndId(envelope: connection.KernelCommandOrEventEnvelopeModel) { if (connection.isKernelEventEnvelopeModel(envelope)) { - delete envelope.command?.id; delete envelope.command?.token; } else if (connection.isKernelCommandEnvelopeModel(envelope)) { - delete envelope.id; delete envelope.token; } From 56ff63871e1883656c3739415dd79df27e61a60d Mon Sep 17 00:00:00 2001 From: Diego Colombo Date: Mon, 18 Sep 2023 19:00:59 +0100 Subject: [PATCH 5/9] align bahaviour to C# --- src/polyglot-notebooks/src/commandsAndEvents.ts | 13 +++++++++++-- src/polyglot-notebooks/src/compositeKernel.ts | 1 + src/polyglot-notebooks/src/kernel.ts | 4 ++-- src/polyglot-notebooks/src/proxyKernel.ts | 2 +- src/polyglot-notebooks/tests/proxykernel.test.ts | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/polyglot-notebooks/src/commandsAndEvents.ts b/src/polyglot-notebooks/src/commandsAndEvents.ts index 5fa0953faf..a3b03ad754 100644 --- a/src/polyglot-notebooks/src/commandsAndEvents.ts +++ b/src/polyglot-notebooks/src/commandsAndEvents.ts @@ -68,11 +68,20 @@ export class KernelCommandEnvelope { return this._parentCommand; } - public set parent(parentCommand: KernelCommandEnvelope | undefined) { + public setParent(parentCommand: KernelCommandEnvelope | undefined) { if (this._parentCommand && this._parentCommand !== parentCommand) { throw new Error("Parent cannot be changed."); } - this._parentCommand = parentCommand; + if (this._parentCommand === null || this._parentCommand === undefined) { + { + if (this._token) { + this._token = undefined; + } + this._parentCommand = parentCommand; + this.getOrCreateToken(); + } + } + } public getOrCreateToken(): string { diff --git a/src/polyglot-notebooks/src/compositeKernel.ts b/src/polyglot-notebooks/src/compositeKernel.ts index e5b900fa32..987c0e0356 100644 --- a/src/polyglot-notebooks/src/compositeKernel.ts +++ b/src/polyglot-notebooks/src/compositeKernel.ts @@ -54,6 +54,7 @@ export class CompositeKernel extends Kernel { { targetKernelName: kernel.kernelInfo.localName }); + childCommand.setParent(invocation.commandEnvelope); childCommand.routingSlip.continueWith(invocation.commandEnvelope.routingSlip); await kernel.handleCommand(childCommand); } diff --git a/src/polyglot-notebooks/src/kernel.ts b/src/polyglot-notebooks/src/kernel.ts index 015c2359ac..247514f014 100644 --- a/src/polyglot-notebooks/src/kernel.ts +++ b/src/polyglot-notebooks/src/kernel.ts @@ -111,8 +111,8 @@ export class Kernel { const context = KernelInvocationContext.getOrCreateAmbientContext(commandEnvelope); if (context.commandEnvelope) { - if (context.commandEnvelope !== commandEnvelope) { - commandEnvelope.parent = context.commandEnvelope; + if (!areCommandsTheSame(context.commandEnvelope, commandEnvelope)) { + commandEnvelope.setParent(context.commandEnvelope); } } const kernelUri = getKernelUri(this); diff --git a/src/polyglot-notebooks/src/proxyKernel.ts b/src/polyglot-notebooks/src/proxyKernel.ts index 29e99d51e1..1ea9143ccd 100644 --- a/src/polyglot-notebooks/src/proxyKernel.ts +++ b/src/polyglot-notebooks/src/proxyKernel.ts @@ -57,7 +57,7 @@ export class ProxyKernel extends Kernel { private async _commandHandler(commandInvocation: IKernelCommandInvocation): Promise { const commandToken = commandInvocation.commandEnvelope.getOrCreateToken(); const completionSource = new PromiseCompletionSource(); - const command = commandInvocation.commandEnvelope; + // fix : is this the right way? We are trying to avoid forwarding events we just did forward let eventSubscription = this._receiver.subscribe({ next: (envelope) => { diff --git a/src/polyglot-notebooks/tests/proxykernel.test.ts b/src/polyglot-notebooks/tests/proxykernel.test.ts index 9602518b21..24e4e7d38e 100644 --- a/src/polyglot-notebooks/tests/proxykernel.test.ts +++ b/src/polyglot-notebooks/tests/proxykernel.test.ts @@ -40,7 +40,7 @@ describe("proxyKernel", () => { }); - it("procudes commandFailed", async () => { + it("produces commandFailed", async () => { let localToRemote = new rxjs.Subject(); let remoteToLocal = new rxjs.Subject(); From 3ddb6247190c57b5778612a67fdf07beed833402 Mon Sep 17 00:00:00 2001 From: Diego Colombo Date: Mon, 18 Sep 2023 20:49:59 +0100 Subject: [PATCH 6/9] remove token property on typescript --- .../src/dynamicGrammarSemanticTokenProvider.ts | 2 +- .../src/interactiveClient.ts | 14 ++++++++------ .../tests/client.test.ts | 2 +- .../tests/testDotnetInteractiveChannel.ts | 14 ++++++++------ src/polyglot-notebooks/src/commandsAndEvents.ts | 4 +--- src/polyglot-notebooks/src/kernel.ts | 3 +-- src/polyglot-notebooks/src/proxyKernel.ts | 10 +++++----- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/polyglot-notebooks-vscode-common/src/dynamicGrammarSemanticTokenProvider.ts b/src/polyglot-notebooks-vscode-common/src/dynamicGrammarSemanticTokenProvider.ts index e30484c150..1c7210015a 100644 --- a/src/polyglot-notebooks-vscode-common/src/dynamicGrammarSemanticTokenProvider.ts +++ b/src/polyglot-notebooks-vscode-common/src/dynamicGrammarSemanticTokenProvider.ts @@ -630,7 +630,7 @@ function fixAutoClosingPairs(value: any) { open: pair[0], close: pair[1] } - ) + ); } else if (typeof pair === 'object' && pair.open && pair.close) { newAutoClosingPairs.push(pair); } diff --git a/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts b/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts index 50fb6ca658..3bc27a4e00 100644 --- a/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts +++ b/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts @@ -63,6 +63,7 @@ import { KernelHost } from './polyglot-notebooks/kernelHost'; import { KernelCommandAndEventChannel } from './DotnetInteractiveChannel'; import * as connection from './polyglot-notebooks/connection'; import { DisposableSubscription } from './polyglot-notebooks/disposables'; +import { Logger } from './polyglot-notebooks'; export interface ErrorOutputCreator { (message: string, outputId?: string): vscodeLike.NotebookCellOutput; @@ -158,7 +159,8 @@ export class InteractiveClient { } ); - const commandToken = command.token; + const commandToken = command.getOrCreateToken(); + try { return this.submitCode(command, language, eventEnvelope => { if (this.deferredOutput.length > 0) { @@ -171,7 +173,7 @@ export class InteractiveClient { switch (eventEnvelope.eventType) { // if kernel languages were added, handle those events here case CommandSucceededType: - if (eventEnvelope.command?.token === commandToken) { + if (eventEnvelope.command?.getOrCreateToken() === commandToken) { // only complete this promise if it's the root command resolve(!failureReported); } @@ -182,7 +184,7 @@ export class InteractiveClient { const errorOutput = this.config.createErrorOutput(err.message, this.getNextOutputId()); outputReporter(errorOutput); failureReported = true; - if (eventEnvelope.command?.token === commandToken) { + if (eventEnvelope.command?.getOrCreateToken() === commandToken) { // only complete this promise if it's the root command reject(err); } @@ -402,19 +404,19 @@ export class InteractiveClient { return new Promise((resolve, reject) => { let failureReported = false; const token = command.getOrCreateToken(); - const commandType = command.commandType; + let disposable = this.subscribeToKernelTokenEvents(token, eventEnvelope => { switch (eventEnvelope.eventType) { case CommandFailedType: let err = eventEnvelope.event; failureReported = true; - if (eventEnvelope.command?.token === token) { + if (eventEnvelope.command?.getOrCreateToken() === token) { disposable.dispose(); reject(err); } break; case CommandSucceededType: - if (eventEnvelope.command?.token === token) { + if (eventEnvelope.command?.getOrCreateToken() === token) { disposable.dispose(); resolve(); } diff --git a/src/polyglot-notebooks-vscode-common/tests/client.test.ts b/src/polyglot-notebooks-vscode-common/tests/client.test.ts index 2c456fb84a..1a31d387ec 100644 --- a/src/polyglot-notebooks-vscode-common/tests/client.test.ts +++ b/src/polyglot-notebooks-vscode-common/tests/client.test.ts @@ -16,7 +16,7 @@ import { createChannelConfig, decodeNotebookCellOutputs } from './utilities'; describe('InteractiveClient tests', () => { - it('command execution returns deferred events', async () => { + it.only('command execution returns deferred events', async () => { const code = '1 + 1'; const config = createChannelConfig(async (notebookPath) => new TestDotnetInteractiveChannel({ 'SubmitCode': [ diff --git a/src/polyglot-notebooks-vscode-common/tests/testDotnetInteractiveChannel.ts b/src/polyglot-notebooks-vscode-common/tests/testDotnetInteractiveChannel.ts index f2fd60e921..bc3e6efbad 100644 --- a/src/polyglot-notebooks-vscode-common/tests/testDotnetInteractiveChannel.ts +++ b/src/polyglot-notebooks-vscode-common/tests/testDotnetInteractiveChannel.ts @@ -32,28 +32,30 @@ export class TestDotnetInteractiveChannel implements DotnetInteractiveChannel { private submitCommand(commandEnvelope: commandsAndEvents.KernelCommandEnvelope) { + + const commandClone = commandEnvelope.clone(); // find bare fake command events - let eventEnvelopesToReturn = this.fakedEventEnvelopes[commandEnvelope.commandType]; + let eventEnvelopesToReturn = this.fakedEventEnvelopes[commandClone.commandType]; if (!eventEnvelopesToReturn) { // check for numbered variants - let counter = this.fakedCommandCounter.get(commandEnvelope.commandType); + let counter = this.fakedCommandCounter.get(commandClone.commandType); if (!counter) { // first encounter counter = 1; } // and increment for next time - this.fakedCommandCounter.set(commandEnvelope.commandType, counter + 1); + this.fakedCommandCounter.set(commandClone.commandType, counter + 1); - eventEnvelopesToReturn = this.fakedEventEnvelopes[`${commandEnvelope.commandType}#${counter}`]; + eventEnvelopesToReturn = this.fakedEventEnvelopes[`${commandClone.commandType}#${counter}`]; if (!eventEnvelopesToReturn) { // couldn't find numbered event names - throw new Error(`Unable to find events for command '${commandEnvelope.commandType}'.`); + throw new Error(`Unable to find events for command '${commandClone.commandType}'.`); } } for (let envelope of eventEnvelopesToReturn) { - const event = new commandsAndEvents.KernelEventEnvelope(envelope.eventType, envelope.event, commandEnvelope); + const event = new commandsAndEvents.KernelEventEnvelope(envelope.eventType, envelope.event, commandClone); this._receiverSubject.next(event); } } diff --git a/src/polyglot-notebooks/src/commandsAndEvents.ts b/src/polyglot-notebooks/src/commandsAndEvents.ts index a3b03ad754..844a29a8a4 100644 --- a/src/polyglot-notebooks/src/commandsAndEvents.ts +++ b/src/polyglot-notebooks/src/commandsAndEvents.ts @@ -56,9 +56,6 @@ export class KernelCommandEnvelope { const data = new Uint8Array(guidBytes); } - public get token(): string | undefined { - return this._token; - } public get routingSlip(): CommandRoutingSlip { return this._routingSlip; @@ -93,6 +90,7 @@ export class KernelCommandEnvelope { this._token = `${this._parentCommand.getOrCreateToken()}.${this._parentCommand.getNextChildToken()}`; return this._token; } + const guidBytes = uuid.parse(uuid.v4()); const data = new Uint8Array(guidBytes); this._token = toBase64String(data); diff --git a/src/polyglot-notebooks/src/kernel.ts b/src/polyglot-notebooks/src/kernel.ts index 247514f014..a5278dcef0 100644 --- a/src/polyglot-notebooks/src/kernel.ts +++ b/src/polyglot-notebooks/src/kernel.ts @@ -305,8 +305,7 @@ export async function submitCommandAndGetResult Date: Tue, 19 Sep 2023 00:43:01 +0100 Subject: [PATCH 7/9] cleanup getOrCreateToken usage --- .../src/interactiveClient.ts | 10 ++-- .../tests/client.test.ts | 2 +- .../src/commandsAndEvents.ts | 56 ++++++++++++++++--- src/polyglot-notebooks/src/kernel.ts | 16 +++--- .../src/kernelInvocationContext.ts | 34 +++-------- src/polyglot-notebooks/src/proxyKernel.ts | 12 ++-- src/polyglot-notebooks/src/setup.ts | 5 +- src/polyglot-notebooks/src/tokenGenerator.ts | 30 ---------- 8 files changed, 77 insertions(+), 88 deletions(-) delete mode 100644 src/polyglot-notebooks/src/tokenGenerator.ts diff --git a/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts b/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts index 3bc27a4e00..906f1a7779 100644 --- a/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts +++ b/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts @@ -173,7 +173,7 @@ export class InteractiveClient { switch (eventEnvelope.eventType) { // if kernel languages were added, handle those events here case CommandSucceededType: - if (eventEnvelope.command?.getOrCreateToken() === commandToken) { + if (eventEnvelope.command?.getToken() === commandToken) { // only complete this promise if it's the root command resolve(!failureReported); } @@ -184,7 +184,7 @@ export class InteractiveClient { const errorOutput = this.config.createErrorOutput(err.message, this.getNextOutputId()); outputReporter(errorOutput); failureReported = true; - if (eventEnvelope.command?.getOrCreateToken() === commandToken) { + if (eventEnvelope.command?.getToken() === commandToken) { // only complete this promise if it's the root command reject(err); } @@ -410,13 +410,13 @@ export class InteractiveClient { case CommandFailedType: let err = eventEnvelope.event; failureReported = true; - if (eventEnvelope.command?.getOrCreateToken() === token) { + if (eventEnvelope.command?.getToken() === token) { disposable.dispose(); reject(err); } break; case CommandSucceededType: - if (eventEnvelope.command?.getOrCreateToken() === token) { + if (eventEnvelope.command?.getToken() === token) { disposable.dispose(); resolve(); } @@ -464,7 +464,7 @@ export class InteractiveClient { } private eventListener(eventEnvelope: KernelEventEnvelope) { - let token = eventEnvelope.command?.getOrCreateToken(); + let token = eventEnvelope.command?.getToken(); if (token) { if (token.startsWith("deferredCommand::")) { switch (eventEnvelope.eventType) { diff --git a/src/polyglot-notebooks-vscode-common/tests/client.test.ts b/src/polyglot-notebooks-vscode-common/tests/client.test.ts index 1a31d387ec..2c456fb84a 100644 --- a/src/polyglot-notebooks-vscode-common/tests/client.test.ts +++ b/src/polyglot-notebooks-vscode-common/tests/client.test.ts @@ -16,7 +16,7 @@ import { createChannelConfig, decodeNotebookCellOutputs } from './utilities'; describe('InteractiveClient tests', () => { - it.only('command execution returns deferred events', async () => { + it('command execution returns deferred events', async () => { const code = '1 + 1'; const config = createChannelConfig(async (notebookPath) => new TestDotnetInteractiveChannel({ 'SubmitCode': [ diff --git a/src/polyglot-notebooks/src/commandsAndEvents.ts b/src/polyglot-notebooks/src/commandsAndEvents.ts index 844a29a8a4..a21ffbfda7 100644 --- a/src/polyglot-notebooks/src/commandsAndEvents.ts +++ b/src/polyglot-notebooks/src/commandsAndEvents.ts @@ -51,12 +51,8 @@ export class KernelCommandEnvelope { constructor( public commandType: contracts.KernelCommandType, public command: contracts.KernelCommand) { - - const guidBytes = uuid.parse(uuid.v4()); - const data = new Uint8Array(guidBytes); } - public get routingSlip(): CommandRoutingSlip { return this._routingSlip; } @@ -65,12 +61,17 @@ export class KernelCommandEnvelope { return this._parentCommand; } + public static isKernelCommandEnvelopeModel(arg: KernelCommandEnvelope | KernelCommandEnvelopeModel): arg is KernelCommandEnvelopeModel { + return !(arg).getOrCreateToken; + } + public setParent(parentCommand: KernelCommandEnvelope | undefined) { if (this._parentCommand && this._parentCommand !== parentCommand) { throw new Error("Parent cannot be changed."); } if (this._parentCommand === null || this._parentCommand === undefined) { { + // todo: do we need to override the token? Should this throw if parenting happens after token is set? if (this._token) { this._token = undefined; } @@ -81,6 +82,36 @@ export class KernelCommandEnvelope { } + public static areCommandsTheSame(envelope1: KernelCommandEnvelope, envelope2: KernelCommandEnvelope): boolean { + envelope1;//? + envelope2;//? + envelope1 === envelope2;//? + + // reference equality + if (envelope1 === envelope2) { + return true; + } + + // commandType equality + const sameCommandType = envelope1?.commandType === envelope2?.commandType; //? + if (!sameCommandType) { + return false; + } + + // both must have tokens + if ((!envelope1?._token) || (!envelope2?._token)) { + return false; + } + + // token equality + const sameToken = envelope1?._token === envelope2?._token; //? + if (!sameToken) { + return false; + } + return true; + } + + public getOrCreateToken(): string { if (this._token) { return this._token; @@ -98,9 +129,16 @@ export class KernelCommandEnvelope { return this._token; } + public getToken(): string { + if (this._token) { + return this._token; + } + throw new Error('token not set'); + } + public isSelforDescendantOf(otherCommand: KernelCommandEnvelope) { - const otherToken = otherCommand.getOrCreateToken(); - const thisToken = this.getOrCreateToken(); + const otherToken = otherCommand._token; + const thisToken = this._token; if (thisToken && otherToken) { return thisToken.startsWith(otherToken!); } @@ -109,8 +147,8 @@ export class KernelCommandEnvelope { } public hasSameRootCommandAs(otherCommand: KernelCommandEnvelope) { - const otherToken = otherCommand.getOrCreateToken(); - const thisToken = this.getOrCreateToken(); + const otherToken = otherCommand._token; + const thisToken = this._token; if (thisToken && otherToken) { const otherRootToken = KernelCommandEnvelope.getRootToken(otherToken); const thisRootToken = KernelCommandEnvelope.getRootToken(thisToken); @@ -187,4 +225,4 @@ export class KernelEventEnvelope { public clone(): KernelEventEnvelope { return KernelEventEnvelope.fromJson(this.toJson()); } -} \ No newline at end of file +} diff --git a/src/polyglot-notebooks/src/kernel.ts b/src/polyglot-notebooks/src/kernel.ts index a5278dcef0..f9dc7f3b64 100644 --- a/src/polyglot-notebooks/src/kernel.ts +++ b/src/polyglot-notebooks/src/kernel.ts @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -import { KernelInvocationContext, areCommandsTheSame } from "./kernelInvocationContext"; +import { KernelInvocationContext } from "./kernelInvocationContext"; import * as commandsAndEvents from "./commandsAndEvents"; import { Logger } from "./logger"; import { CompositeKernel } from "./compositeKernel"; @@ -104,14 +104,14 @@ export class Kernel { async send(commandEnvelopeOrModel: commandsAndEvents.KernelCommandEnvelope | commandsAndEvents.KernelCommandEnvelopeModel): Promise { let commandEnvelope = commandEnvelopeOrModel; - if (!(commandEnvelopeOrModel).getOrCreateToken) { + if (commandsAndEvents.KernelCommandEnvelope.isKernelCommandEnvelopeModel(commandEnvelopeOrModel)) { Logger.default.warn(`Converting command envelope model to command envelope for backawards compatibility.`); - commandEnvelope = commandsAndEvents.KernelCommandEnvelope.fromJson(commandEnvelopeOrModel); + commandEnvelope = commandsAndEvents.KernelCommandEnvelope.fromJson(commandEnvelopeOrModel); } const context = KernelInvocationContext.getOrCreateAmbientContext(commandEnvelope); if (context.commandEnvelope) { - if (!areCommandsTheSame(context.commandEnvelope, commandEnvelope)) { + if (!commandsAndEvents.KernelCommandEnvelope.areCommandsTheSame(context.commandEnvelope, commandEnvelope)) { commandEnvelope.setParent(context.commandEnvelope); } } @@ -158,7 +158,7 @@ export class Kernel { const previoudHendlingKernel = context.handlingKernel; context.handlingKernel = this; - let isRootCommand = areCommandsTheSame(context.commandEnvelope, commandEnvelope); + let isRootCommand = commandsAndEvents.KernelCommandEnvelope.areCommandsTheSame(context.commandEnvelope, commandEnvelope); let eventSubscription: rxjs.Subscription | undefined = undefined;//? @@ -166,7 +166,7 @@ export class Kernel { const kernelType = (this.kernelInfo.isProxy ? "proxy" : "") + (this.kernelInfo.isComposite ? "composite" : ""); Logger.default.info(`kernel ${this.name} of type ${kernelType} subscribing to context events`); eventSubscription = context.kernelEvents.pipe(rxjs.map(e => { - const message = `kernel ${this.name} of type ${kernelType} saw event ${e.eventType} with token ${e.command?.getOrCreateToken()}`; + const message = `kernel ${this.name} of type ${kernelType} saw event ${e.eventType} with token ${e.command?.getToken()}`; message;//? Logger.default.info(message); const kernelUri = getKernelUri(this); @@ -295,7 +295,7 @@ export async function submitCommandAndGetResult(); let handled = false; let disposable = kernel.subscribeToKernelEvents(eventEnvelope => { - if (eventEnvelope.command?.getOrCreateToken() === commandEnvelope.getOrCreateToken()) { + if (eventEnvelope.command?.getToken() === commandEnvelope.getToken()) { switch (eventEnvelope.eventType) { case commandsAndEvents.CommandFailedType: if (!handled) { @@ -305,7 +305,7 @@ export async function submitCommandAndGetResult { let commandEnvelope = kernelCommandEnvelope; - if (!(kernelCommandEnvelope).getOrCreateToken) { - commandEnvelope = commandsAndEvents.KernelCommandEnvelope.fromJson(kernelCommandEnvelope); + if (commandsAndEvents.KernelCommandEnvelope.isKernelCommandEnvelopeModel(kernelCommandEnvelope)) { + commandEnvelope = commandsAndEvents.KernelCommandEnvelope.fromJson(kernelCommandEnvelope); } + remoteToLocal.next(commandEnvelope); }; } diff --git a/src/polyglot-notebooks/src/tokenGenerator.ts b/src/polyglot-notebooks/src/tokenGenerator.ts deleted file mode 100644 index d42d49eed6..0000000000 --- a/src/polyglot-notebooks/src/tokenGenerator.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -import { KernelCommandEnvelope } from "./commandsAndEvents"; - -export function isSelforDescendantOf(thisCommand: KernelCommandEnvelope, otherCommand: KernelCommandEnvelope) { - const otherToken = otherCommand.getOrCreateToken(); - const thisToken = thisCommand.getOrCreateToken(); - if (thisToken && otherToken) { - return thisToken.startsWith(otherToken!); - } - - throw new Error('both commands must have tokens'); -} - -export function hasSameRootCommandAs(thisCommand: KernelCommandEnvelope, otherCommand: KernelCommandEnvelope) { - const otherToken = otherCommand.getOrCreateToken(); - const thisToken = thisCommand.getOrCreateToken(); - if (thisToken && otherToken) { - const otherRootToken = getRootToken(otherToken); - const thisRootToken = getRootToken(thisToken); - return thisRootToken === otherRootToken; - } - throw new Error('both commands must have tokens'); -} - -export function getRootToken(token: string): string { - const parts = token.split('.'); - return parts[0]; -} \ No newline at end of file From 14eba3481342366b03d147a32170a83614427c69 Mon Sep 17 00:00:00 2001 From: Diego Colombo Date: Tue, 19 Sep 2023 17:43:08 +0100 Subject: [PATCH 8/9] fix the child command root --- src/polyglot-notebooks/src/commandsAndEvents.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/polyglot-notebooks/src/commandsAndEvents.ts b/src/polyglot-notebooks/src/commandsAndEvents.ts index a21ffbfda7..e8e579d398 100644 --- a/src/polyglot-notebooks/src/commandsAndEvents.ts +++ b/src/polyglot-notebooks/src/commandsAndEvents.ts @@ -43,7 +43,7 @@ function toBase64String(value: Uint8Array): string { } export class KernelCommandEnvelope { - private _childCommandCounter: number = 0; + private _childCommandCounter: number = 1; private _routingSlip: CommandRoutingSlip = new CommandRoutingSlip(); private _token?: string; private _parentCommand?: KernelCommandEnvelope; @@ -111,7 +111,7 @@ export class KernelCommandEnvelope { return true; } - + static _counter = 1; public getOrCreateToken(): string { if (this._token) { return this._token; @@ -126,6 +126,8 @@ export class KernelCommandEnvelope { const data = new Uint8Array(guidBytes); this._token = toBase64String(data); + // this._token = `${KernelCommandEnvelope._counter++}`; + return this._token; } From c9883508142674c03224700dd59d5892977d7c2a Mon Sep 17 00:00:00 2001 From: Jon Sequeira Date: Tue, 19 Sep 2023 12:17:57 -0700 Subject: [PATCH 9/9] rename nested classes to avoid warning --- .../KernelCommandNestingTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Interactive.Tests/KernelCommandNestingTests.cs b/src/Microsoft.DotNet.Interactive.Tests/KernelCommandNestingTests.cs index 96bf6f7424..1aa9216037 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/KernelCommandNestingTests.cs +++ b/src/Microsoft.DotNet.Interactive.Tests/KernelCommandNestingTests.cs @@ -20,7 +20,7 @@ public KernelCommandNestingTests(ITestOutputHelper output) : base(output) { } - public class KernelEvents + public class Kernel_KernelEvents { [Fact] public async Task Commands_sent_within_the_code_of_another_command_publish_error_events_on_CompositeKernel_for_failures() @@ -49,7 +49,7 @@ public async Task Commands_sent_within_the_code_of_another_command_publish_error } } - public class KernelCommandResultEvents + public class KernelCommandResult_Events { [Fact] public async Task Commands_sent_within_the_code_of_another_command_do_not_publish_CommandSucceeded_to_the_outer_result()