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
@@ -15,7 +15,7 @@ using ZB.MOM.WW.Secrets.Abstractions;
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests.Actors;
/// <summary>
/// Task 10, site-secrets artifact deploy: <see cref="DeploymentManagerActor.HandleDeployArtifacts"/>
/// Site-secrets artifact deploy: <see cref="DeploymentManagerActor.HandleDeployArtifacts"/>
/// writes shipped secrets to <c>deployed_secrets</c>, runs <see cref="DeployedSecretsMirror.ReconcileAsync"/>
/// synchronously, and answers with <see cref="ArtifactDeploymentResponse.SecretsApplied"/> or a failure.
/// Follows the shape of the existing artifact-apply tests in <c>DeploymentManagerActorTests</c>.
@@ -27,6 +27,7 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
private readonly SharedScriptLibrary _sharedScriptLibrary;
private readonly TestLocalDb _localDb;
/// <summary>Initializes a new instance of <c>DeploymentManagerActorArtifactSecretsTests</c>.</summary>
public DeploymentManagerActorArtifactSecretsTests()
{
_localDb = TestLocalDb.CreateTemp("dm-artifact-secrets-test");
@@ -40,6 +41,7 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
_compilationService, NullLogger<SharedScriptLibrary>.Instance);
}
/// <inheritdoc />
void IDisposable.Dispose()
{
Shutdown();
@@ -120,6 +122,8 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
UpdatedUtc: new DateTimeOffset(2026, 9, 28, 1, 0, 0, TimeSpan.Zero),
Description: "test secret");
/// <summary>Verifies that secrets null leaves table untouched and secrets applied null.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Secrets_Null_LeavesTableUntouched_AndSecretsAppliedNull()
{
@@ -138,6 +142,8 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
Assert.Empty(rows);
}
/// <summary>Verifies that secrets present full set write sync reconcile secrets applied equals shipped count.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Secrets_Present_FullSetWrite_SyncReconcile_SecretsAppliedEqualsShippedCount()
{
@@ -158,6 +164,8 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
Assert.True(store.Contains("b"));
}
/// <summary>Verifies that secrets empty with mirror secrets applied zero success.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Secrets_Empty_WithMirror_SecretsAppliedZero_Success()
{
@@ -173,6 +181,8 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
Assert.Equal(0, response.SecretsApplied);
}
/// <summary>Verifies that secrets dropped reply names the retired secrets.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Secrets_Dropped_ReplyNamesTheRetiredSecrets()
{
@@ -202,6 +212,8 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
await Task.CompletedTask;
}
/// <summary>Verifies that secrets mirror fails one success false kek id in message secrets applied excludes failure.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Secrets_MirrorFailsOne_SuccessFalse_KekIdInMessage_SecretsAppliedExcludesFailure()
{
@@ -222,6 +234,8 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
Assert.Equal(1, response.SecretsApplied); // "good" applied+verified; "bad" failed
}
/// <summary>Verifies that secrets non empty no mirror registered fails deploy.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Secrets_NonEmpty_NoMirrorRegistered_FailsDeploy()
{
@@ -234,6 +248,8 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
Assert.Equal("Secret deployment is not enabled on this site node", response.ErrorMessage);
}
/// <summary>Verifies that secrets empty no mirror registered treated as zero success.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Secrets_Empty_NoMirrorRegistered_TreatedAsZeroSuccess()
{
@@ -246,6 +262,8 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
Assert.Equal(0, response.SecretsApplied);
}
/// <summary>Verifies that secrets removal failure does not fail deploy and excluded from error message.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Secrets_RemovalFailure_DoesNotFailDeploy_AndExcludedFromErrorMessage()
{
@@ -275,10 +293,11 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
Assert.Null(r2.ErrorMessage);
}
/// <summary>Verifies that data connections pushed to dcl only after shipped secrets are mirrored.</summary>
[Fact]
public void DataConnections_PushedToDcl_OnlyAfterShippedSecretsAreMirrored()
{
// M2 (final review): a connection whose config references a secret shipped by THIS
// A connection whose config references a secret shipped by THIS
// deploy must find it on its first connect, so the DCL create must not reach the
// DCL manager before the secret is in this node's store.
var store = new FakeSecretStore();
@@ -310,6 +329,8 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
Assert.True(secretPresentWhenDclSawCreate);
}
/// <summary>Verifies that data connections still stored and pushed when secrets step fails.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DataConnections_StillStoredAndPushed_WhenSecretsStepFails()
{
@@ -336,19 +357,36 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
{
private readonly Dictionary<string, StoredSecret> _rows = new(StringComparer.Ordinal);
/// <summary>When set, deleting any secret throws.</summary>
public bool ThrowOnDelete { get; set; }
/// <summary>Returns whether the store currently holds a live secret with the given name.</summary>
/// <param name="name">The secret name.</param>
/// <returns>True when a live secret with that name exists.</returns>
public bool Contains(string name) => _rows.TryGetValue(name, out var row) && !row.IsDeleted;
/// <summary>Returns the stored or configured secret.</summary>
/// <param name="name">The secret name.</param>
/// <param name="ct">The cancellation token.</param>
/// <returns>The secret, or null when absent.</returns>
public Task<StoredSecret?> GetAsync(SecretName name, CancellationToken ct) =>
Task.FromResult(_rows.TryGetValue(name.Value, out var row) ? row : null);
/// <summary>Stores the row, replacing any existing row of the same name.</summary>
/// <param name="row">The secret row.</param>
/// <param name="ct">The cancellation token.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
public Task UpsertAsync(StoredSecret row, CancellationToken ct)
{
_rows[row.Name.Value] = row;
return Task.CompletedTask;
}
/// <summary>Soft-deletes the named secret.</summary>
/// <param name="name">The secret name.</param>
/// <param name="actor">The acting user.</param>
/// <param name="ct">The cancellation token.</param>
/// <returns>True when a live secret was deleted; otherwise false.</returns>
public Task<bool> DeleteAsync(SecretName name, string? actor, CancellationToken ct)
{
if (ThrowOnDelete)
@@ -372,12 +410,23 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
return Task.FromResult(true);
}
/// <summary>Returns an empty metadata list.</summary>
/// <param name="includeDeleted">Whether deleted secrets are included.</param>
/// <param name="ct">The cancellation token.</param>
/// <returns>An empty list.</returns>
public Task<IReadOnlyList<SecretMetadata>> ListAsync(bool includeDeleted, CancellationToken ct) =>
Task.FromResult<IReadOnlyList<SecretMetadata>>([]);
/// <summary>Returns an empty manifest.</summary>
/// <param name="ct">The cancellation token.</param>
/// <returns>An empty manifest.</returns>
public Task<IReadOnlyList<SecretManifestEntry>> GetManifestAsync(CancellationToken ct) =>
Task.FromResult<IReadOnlyList<SecretManifestEntry>>([]);
/// <summary>Applies a replicated row when it is newer than the stored one.</summary>
/// <param name="row">The replicated row.</param>
/// <param name="ct">The cancellation token.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
public Task ApplyReplicatedAsync(StoredSecret row, CancellationToken ct)
{
if (_rows.TryGetValue(row.Name.Value, out var existing)
@@ -390,6 +439,11 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
return Task.CompletedTask;
}
/// <summary>Reports that no rewrap was applied.</summary>
/// <param name="rewrappedRow">The rewrapped row.</param>
/// <param name="expectedCurrentWrappedDek">The wrapped key the row is expected to hold.</param>
/// <param name="ct">The cancellation token.</param>
/// <returns>Always false.</returns>
public Task<bool> ApplyRewrapAsync(
StoredSecret rewrappedRow, byte[] expectedCurrentWrappedDek, CancellationToken ct) =>
Task.FromResult(false);
@@ -399,8 +453,14 @@ public class DeploymentManagerActorArtifactSecretsTests : TestKit, IDisposable
{
private readonly HashSet<string> _throwing = new(StringComparer.Ordinal);
/// <summary>Throws the configured fault when the named secret is requested.</summary>
/// <param name="name">The secret name that should fail.</param>
public void ThrowFor(string name) => _throwing.Add(name);
/// <summary>Returns the stored or configured secret.</summary>
/// <param name="name">The secret name.</param>
/// <param name="ct">The cancellation token.</param>
/// <returns>The secret, or null when absent.</returns>
public Task<string?> GetAsync(SecretName name, CancellationToken ct)
{
if (_throwing.Contains(name.Value))