From 54c2d6214c4d0936c6da07a04332ddbe7b294659 Mon Sep 17 00:00:00 2001 From: Michael Jolley Date: Thu, 20 Aug 2026 19:08:29 -0500 Subject: [PATCH] reword phase-4 comments in my voice --- .../Services/JsonRpcExtensionService.cs | 10 +++++----- .../Services/ProviderIdReservations.cs | 2 +- .../JsonRpcExtensionServiceCrashRecoveryTests.cs | 12 ++++-------- .../JsonRpcExtensionServiceReconciliationTests.cs | 6 +++--- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/JsonRpcExtensionService.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/JsonRpcExtensionService.cs index 6e8e4d5087..87cead8756 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/JsonRpcExtensionService.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/JsonRpcExtensionService.cs @@ -59,7 +59,7 @@ public sealed partial class JsonRpcExtensionService : IExtensionService, IDispos private readonly List _providerWrappers = []; private readonly HashSet _disabledExtensions = new(StringComparer.Ordinal); - // Provider-id (normalized manifest name key) reservations shared by every + // Provider ID (normalized manifest name key) reservations shared by every // registration path. Consulted and claimed atomically under _extensionsLock so a // duplicate id can never register regardless of how it arrives (initial scan, // refresh, dynamic install, hot-reload, or crash-restart). @@ -1230,8 +1230,8 @@ public sealed partial class JsonRpcExtensionService : IExtensionService, IDispos private void OnDirectoryWatcherRenamed(object sender, RenamedEventArgs e) { - // A rename can be an atomic promotion (temp -> final) or a demotion/uninstall - // (final -> temp). Treat the new name as a possible install and the old name as + // A rename can be an atomic promotion from temp to final, or a demotion or uninstall + // from final to temp. Treat the new name as a possible install and the old name as // a possible removal, ignoring either side that sits under an ignored segment. // The new name must also be a top-level extension entry (directory or its own // manifest); a nested rename is not an extension change. @@ -1695,11 +1695,11 @@ public sealed partial class JsonRpcExtensionService : IExtensionService, IDispos using (gate) { - // Validate-then-swap. Start the replacement FIRST, before removing the + // Validate then swap. Start the replacement before removing the // incumbent, so a failed reload keeps the incumbent provider (and its source // watcher) live and a later corrective edit re-triggers this reload. The old // provider is only removed once the new one has started and registered, so a - // duplicate-id refresh never leaves the directory with neither provider. + // duplicate ID refresh never leaves the directory with neither provider. var replacement = await StartInstanceAsync(directory, parseResult.Manifest, _reload.Token).ConfigureAwait(false); if (replacement is null) { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/ProviderIdReservations.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/ProviderIdReservations.cs index c56bde9056..fd305263b1 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/ProviderIdReservations.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/ProviderIdReservations.cs @@ -24,7 +24,7 @@ internal sealed class ProviderIdReservations { private readonly Lock _lock = new(); - // Provider id (ordinal name key) -> canonical directory that owns it. + // Provider ID (ordinal name key) mapped to the canonical directory that owns it. private readonly Dictionary _owners = new(StringComparer.Ordinal); /// diff --git a/src/modules/cmdpal/Tests/Microsoft.CmdPal.UI.ViewModels.UnitTests/JsonRpcExtensionServiceCrashRecoveryTests.cs b/src/modules/cmdpal/Tests/Microsoft.CmdPal.UI.ViewModels.UnitTests/JsonRpcExtensionServiceCrashRecoveryTests.cs index 4521926eb5..a15da81de8 100644 --- a/src/modules/cmdpal/Tests/Microsoft.CmdPal.UI.ViewModels.UnitTests/JsonRpcExtensionServiceCrashRecoveryTests.cs +++ b/src/modules/cmdpal/Tests/Microsoft.CmdPal.UI.ViewModels.UnitTests/JsonRpcExtensionServiceCrashRecoveryTests.cs @@ -8,14 +8,10 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.CmdPal.UI.ViewModels.UnitTests; /// -/// Documents the crash-lifecycle decisions behind r2-p4-03 (an immediate post-init -/// crash must be handled) and r2-p4-07 (a crash-disabled extension recovers after a -/// source edit). The end-to-end wiring (the post-init IsRunning() probe that -/// drives OnExtensionProcessExited, the disable branch keeping the source -/// watcher alive, and hot-reload resetting the crash count) requires spawning a Node -/// process and is verified by inspection; the deterministic decision the wiring relies -/// on is exercised here through the pure -/// seam. +/// Documents the crash lifecycle decisions behind r2-p4-03 (handle a crash right after +/// init) and r2-p4-07 (recover a disabled extension after a source edit). +/// The full wiring needs a Node process, so these tests cover the pure +/// decision the service depends on. /// [TestClass] public class JsonRpcExtensionServiceCrashRecoveryTests diff --git a/src/modules/cmdpal/Tests/Microsoft.CmdPal.UI.ViewModels.UnitTests/JsonRpcExtensionServiceReconciliationTests.cs b/src/modules/cmdpal/Tests/Microsoft.CmdPal.UI.ViewModels.UnitTests/JsonRpcExtensionServiceReconciliationTests.cs index 35d325ef73..00d82f2f3c 100644 --- a/src/modules/cmdpal/Tests/Microsoft.CmdPal.UI.ViewModels.UnitTests/JsonRpcExtensionServiceReconciliationTests.cs +++ b/src/modules/cmdpal/Tests/Microsoft.CmdPal.UI.ViewModels.UnitTests/JsonRpcExtensionServiceReconciliationTests.cs @@ -15,9 +15,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.CmdPal.UI.ViewModels.UnitTests; /// -/// Covers the robust-discovery and duplicate-id remediations (p4-04, p4-07): the -/// reconciliation diff, the deterministic collision policy, the manifest-stability -/// retry, and mapping a changed path back to its owning extension directory. +/// Covers the discovery and duplicate ID fixes (p4-04, p4-07): the reconciliation +/// diff, deterministic collision policy, manifest stability retry, and mapping a +/// changed path back to its owning extension directory. /// [TestClass] public class JsonRpcExtensionServiceReconciliationTests