mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-08-29 10:09:43 +02:00
reword phase-4 comments in my voice
This commit is contained in:
@@ -59,7 +59,7 @@ public sealed partial class JsonRpcExtensionService : IExtensionService, IDispos
|
||||
private readonly List<CommandProviderWrapper> _providerWrappers = [];
|
||||
private readonly HashSet<string> _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)
|
||||
{
|
||||
|
||||
@@ -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<string, string> _owners = new(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,14 +8,10 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
namespace Microsoft.CmdPal.UI.ViewModels.UnitTests;
|
||||
|
||||
/// <summary>
|
||||
/// 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 <c>IsRunning()</c> probe that
|
||||
/// drives <c>OnExtensionProcessExited</c>, 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 <see cref="JsonRpcExtensionService.DecideCrashAction"/>
|
||||
/// 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
|
||||
/// <see cref="JsonRpcExtensionService.DecideCrashAction"/> decision the service depends on.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class JsonRpcExtensionServiceCrashRecoveryTests
|
||||
|
||||
@@ -15,9 +15,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
namespace Microsoft.CmdPal.UI.ViewModels.UnitTests;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class JsonRpcExtensionServiceReconciliationTests
|
||||
|
||||
Reference in New Issue
Block a user