docs(tests): fix CommentChecker findings across tests/ — 13,392 → 0 (repo-wide scan clean)

Comment/XML-doc changes only:
- add summaries to ~10k test methods, fixtures, fakes and helpers
  (+ <param> on theories, <returns> on async Task methods,
  <inheritdoc/> on interface implementations the checker can resolve)
- strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N,
  #NN, Component-0NN) from comments, keeping the explanatory text;
  reword false positives in comments only
- real docs on fakes implementing BCL/library interfaces
  (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime)
- reword the last 5 src/ false positives (CWE-1236, failures-1,
  year-0001, M365)

Only non-comment edits: four one-line nested classes split across lines
so members can carry docs. Build 0 errors / 0 warnings.
This commit is contained in:
Joseph Doherty
2026-10-07 15:05:49 -04:00
parent 0ffd4bdbea
commit 513fa1aa16
998 changed files with 17896 additions and 2395 deletions
@@ -17,7 +17,7 @@ using System.Text.Json;
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests.Actors;
/// <summary>
/// Regression tests for SiteRuntime-003: redeployment of an existing instance must
/// Regression tests: redeployment of an existing instance must
/// wait for the terminating Instance Actor before recreating the child, instead of
/// relying on a fixed 500 ms reschedule that can collide on the child actor name.
/// </summary>
@@ -28,6 +28,7 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
private readonly SharedScriptLibrary _sharedScriptLibrary;
private readonly TestLocalDb _localDb;
/// <summary>Initializes a temporary LocalDb, site storage and script compilation services for the tests.</summary>
public DeploymentManagerRedeployTests()
{
_localDb = TestLocalDb.CreateTemp("dm-redeploy-test");
@@ -41,6 +42,7 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
_compilationService, NullLogger<SharedScriptLibrary>.Instance);
}
/// <inheritdoc />
void IDisposable.Dispose()
{
// TestKit teardown first, so no in-flight actor can reach a disposed ILocalDb;
@@ -95,25 +97,45 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
/// </summary>
private sealed class CountCapturingHealthCollector : ISiteHealthCollector
{
/// <summary>Gets the most recently reported deployed-instance count.</summary>
public int LastDeployedCount { get; private set; }
/// <inheritdoc />
public void IncrementScriptError() { }
/// <inheritdoc />
public void IncrementAlarmError() { }
/// <inheritdoc />
public void IncrementDeadLetter() { }
/// <inheritdoc />
public void IncrementSiteAuditWriteFailures() { }
/// <inheritdoc />
public void IncrementAuditRedactionFailure() { }
/// <inheritdoc />
public void UpdateSiteAuditBacklog(ZB.MOM.WW.ScadaBridge.Commons.Types.SiteAuditBacklogSnapshot snapshot) { }
/// <inheritdoc />
public void UpdateConnectionHealth(string connectionName, ConnectionHealth health) { }
/// <inheritdoc />
public void RemoveConnection(string connectionName) { }
/// <inheritdoc />
public void UpdateTagResolution(string connectionName, int totalSubscribed, int successfullyResolved) { }
/// <inheritdoc />
public void UpdateConnectionEndpoint(string connectionName, string endpoint) { }
/// <inheritdoc />
public void UpdateTagQuality(string connectionName, int good, int bad, int uncertain) { }
/// <inheritdoc />
public void SetStoreAndForwardDepths(IReadOnlyDictionary<string, int> depths) { }
/// <inheritdoc />
public void SetInstanceCounts(int deployed, int enabled, int disabled) => LastDeployedCount = deployed;
/// <inheritdoc />
public void SetParkedMessageCount(int count) { }
/// <inheritdoc />
public void SetNodeHostname(string hostname) { }
/// <inheritdoc />
public void SetClusterNodes(IReadOnlyList<NodeStatus> nodes) { }
/// <inheritdoc />
public void SetActiveNode(bool isActive) { }
/// <inheritdoc />
public bool IsActiveNode => true;
/// <inheritdoc />
public SiteHealthReport CollectReport(string siteId) => throw new NotSupportedException();
}
@@ -130,6 +152,8 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
return JsonSerializer.Serialize(config);
}
/// <summary>Verifies that redeploying an existing instance succeeds without a child actor name collision.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Redeploy_ExistingInstance_SucceedsWithoutNameCollision()
{
@@ -155,10 +179,12 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
Assert.True(disable.Success);
}
/// <summary>Verifies that three rapid deploys do not throw an invalid-actor-name exception and the latest deploy wins.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SR020_ThreeRapidDeploys_DoNotThrowInvalidActorNameException_LatestWins()
{
// Regression test for SiteRuntime-020. The previous implementation tracked
// Regression test: the previous implementation tracked
// pending redeploys by IActorRef (_pendingRedeploys) but had no
// name-keyed shadow, so a third DeployInstanceCommand arriving WHILE the
// first redeploy's predecessor was still terminating saw
@@ -184,7 +210,7 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
// Two rapid redeploys before the predecessor has time to fully terminate.
// The second deploy stops the actor (watching it) and buffers itself.
// The third deploy arrives almost immediately and must NOT crash — it
// overwrites the buffered pending command and tells dep-2 it was superseded.
// overwrites the buffered pending command and tells the first deployment it was superseded.
var probe2 = CreateTestProbe();
var probe3 = CreateTestProbe();
@@ -195,7 +221,7 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
"dep-3", "RapidPump", "h3", MakeConfigJson("RapidPump"), "admin", DateTimeOffset.UtcNow),
probe3.Ref);
// dep-2 must be told it was superseded; dep-3 must succeed once the
// The first deployment must be told it was superseded; the second must succeed once the
// predecessor finishes terminating.
var superseded = probe2.ExpectMsg<DeploymentStatusResponse>(TimeSpan.FromSeconds(10));
Assert.Equal("dep-2", superseded.DeploymentId);
@@ -214,10 +240,12 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
Assert.True(disable.Success);
}
/// <summary>Verifies that a delete during a pending redeploy leaves the instance deleted and the deployed count correct.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SR029_DeleteDuringPendingRedeploy_InstanceStaysDeleted_AndCounterIsCorrect()
{
// Regression test for SiteRuntime-029. A delete arriving WHILE a redeploy is
// Regression test: a delete arriving WHILE a redeploy is
// still terminating used to: (1) over-decrement _totalDeployedCount, and
// (2) leave the buffered _pendingRedeploys entry intact — so when Terminated
// fired, HandleTerminated called ApplyDeployment(isRedeploy: true) and
@@ -241,7 +269,7 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
// singleton mailbox: HandleDeploy runs first (removes from _instanceActors,
// watches + stops the predecessor, buffers the redeploy, sets the terminating
// shadow), then HandleDelete runs while the predecessor is still terminating
// (Terminated has not fired) — exactly the SiteRuntime-029 window.
// (Terminated has not fired) — exactly the delete-during-redeploy window.
var redeployProbe = CreateTestProbe();
actor.Tell(new DeployInstanceCommand(
"dep-2", "RaceTarget", "h2", MakeConfigJson("RaceTarget"), "admin", DateTimeOffset.UtcNow),
@@ -270,10 +298,12 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
Assert.Equal(0, health.LastDeployedCount);
}
/// <summary>Verifies that deleting a disabled instance decrements the deployed count.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SR032_DeleteDisabledInstance_DecrementsDeployedCount()
{
// Regression test for SiteRuntime-032. SiteRuntime-029 gated the deployed-count
// Regression test: the earlier delete-during-redeploy fix gated the deployed-count
// decrement on the instance being present in _instanceActors OR mid-redeploy in
// _terminatingActorsByName. A DISABLED instance is in NEITHER map (disable removes
// it from _instanceActors and never adds it to the terminating shadow) yet still has
@@ -300,7 +330,7 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
Assert.Equal(1, health.LastDeployedCount);
// Delete the DISABLED instance → the deployed count must return to 0.
// (The SiteRuntime-029 regression left it stuck at 1.)
// (The delete-during-redeploy regression left it stuck at 1.)
actor.Tell(new DeleteInstanceCommand("del-1", "DisablePump", DateTimeOffset.UtcNow));
var delete = ExpectMsg<InstanceLifecycleResponse>(TimeSpan.FromSeconds(5));
Assert.True(delete.Success);
@@ -311,6 +341,8 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
Assert.DoesNotContain(configs, c => c.InstanceUniqueName == "DisablePump");
}
/// <summary>Verifies that redeploying an existing instance does not over-count deployed instances.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Redeploy_ExistingInstance_DoesNotOverCountDeployedInstances()
{
@@ -344,6 +376,8 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
// ── S6: an Instance Actor that dies during init must not linger as a dead ref ──
/// <summary>Verifies that an Instance Actor init failure at startup evicts the dead reference and logs a site event.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task InstanceActorInitFailure_OnStartup_EvictsDeadRefAndLogsSiteEvent()
{
@@ -367,6 +401,8 @@ public class DeploymentManagerRedeployTests : TestKit, IDisposable
}, TimeSpan.FromSeconds(10));
}
/// <summary>Verifies that a deploy whose actor dies during initialization reports failure rather than success.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Deploy_WhoseActorDiesDuringInit_ReportsFailed_NotSuccess()
{