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
@@ -9,7 +9,7 @@ using Xunit;
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Tests.Maintenance;
/// <summary>
/// Bundle D (#23 M6-T5) integration tests for
/// Integration tests for
/// <see cref="AuditLogPartitionMaintenance"/>. Uses the same
/// <see cref="MsSqlMigrationFixture"/> as the AuditLog migration / repository
/// tests so the ALTER PARTITION FUNCTION DDL runs against the actual seeded
@@ -27,6 +27,8 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
{
private readonly MsSqlMigrationFixture _fixture;
/// <summary>Initializes the tests with the shared SQL Server migration fixture.</summary>
/// <param name="fixture">The fixture that provides the migrated test database.</param>
public AuditLogPartitionMaintenanceTests(MsSqlMigrationFixture fixture)
{
_fixture = fixture;
@@ -80,6 +82,8 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
return firstOfThisMonth.AddMonths(1);
}
/// <summary>Verifies that no split occurs and an empty result is returned when the future range already exists.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task EnsureLookahead_AlreadyHasFutureRange_NoSplit_ReturnsEmpty()
{
@@ -105,6 +109,8 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
Assert.Equal(max, maxAfter);
}
/// <summary>Verifies that one missing boundary is split and returned as a single boundary.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task EnsureLookahead_NeedsOneMoreBoundary_Splits_Returns1Boundary()
{
@@ -128,6 +134,8 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
Assert.Equal(expectedAdded, maxAfter);
}
/// <summary>Verifies that three missing boundaries are split and returned as three boundaries.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task EnsureLookahead_NeedsThreeBoundaries_Splits_Returns3Boundaries()
{
@@ -153,8 +161,8 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
}
/// <summary>
/// ConfigurationDatabase-024: CD-019 removed the try/catch around the per-month
/// SPLIT call so a genuine SQL failure (deadlock, permission, log full, transient
/// The try/catch around the per-month
/// SPLIT call was removed, so a genuine SQL failure (deadlock, permission, log full, transient
/// connection drop) now aborts the loop instead of leaving partition holes. This
/// test pins that abort behaviour: with an interceptor that throws on the SECOND
/// SPLIT, the call must propagate the exception AND the first SPLIT's boundary
@@ -163,10 +171,11 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
/// commit boundary N before throwing, and that the next tick can resume from
/// boundary N+1 at-least-once with no holes.
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task EnsureLookahead_SecondSplitThrows_LoopAborts_FirstBoundaryStillCommitted()
{
// STM: CD-024-SecondSplitThrowsAbortsLoop marker.
// STM: SecondSplitThrowsAbortsLoop marker.
Skip.IfNot(_fixture.Available, _fixture.SkipReason);
// Baseline max-boundary observed via a clean context.
@@ -180,7 +189,7 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
// Build a fresh context with an interceptor that throws on the 2nd ALTER
// PARTITION FUNCTION SPLIT RANGE. EF Core surfaces the throw through
// ExecuteSqlRawAsync exactly as a SqlException would — the loop has no
// try/catch (CD-019), so the exception propagates after the first SPLIT
// try/catch, so the exception propagates after the first SPLIT
// has already committed.
var interceptor = new SecondSplitThrowsInterceptor();
var options = new DbContextOptionsBuilder<ScadaBridgeDbContext>()
@@ -194,8 +203,8 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
() => maintenance.EnsureLookaheadAsync(lookahead));
// Verify exactly one ALTER PARTITION FUNCTION SPLIT RANGE actually ran
// before the interceptor's throw: split #1 committed, split #2 threw,
// split #3 was never attempted.
// before the interceptor's throw: the first split committed, the second threw,
// and the third was never attempted.
Assert.Equal(1, interceptor.SuccessfulSplits);
// And verify the first boundary IS now persisted — the loop aborted but
@@ -217,12 +226,14 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
/// </summary>
private sealed class SecondSplitThrowsInterceptor : DbCommandInterceptor
{
/// <summary>Gets the number of partition splits that were allowed to run.</summary>
public int SuccessfulSplits { get; private set; }
private bool IsTargetSplit(DbCommand command) =>
command.CommandText.Contains("SPLIT RANGE", StringComparison.OrdinalIgnoreCase)
&& command.CommandText.Contains("pf_AuditLog_Month", StringComparison.OrdinalIgnoreCase);
/// <inheritdoc />
public override InterceptionResult<int> NonQueryExecuting(
DbCommand command,
CommandEventData eventData,
@@ -232,6 +243,7 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
return base.NonQueryExecuting(command, eventData, result);
}
/// <inheritdoc />
public override ValueTask<InterceptionResult<int>> NonQueryExecutingAsync(
DbCommand command,
CommandEventData eventData,
@@ -242,6 +254,7 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
return base.NonQueryExecutingAsync(command, eventData, result, cancellationToken);
}
/// <inheritdoc />
public override int NonQueryExecuted(
DbCommand command,
CommandExecutedEventData eventData,
@@ -254,6 +267,7 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
return base.NonQueryExecuted(command, eventData, result);
}
/// <inheritdoc />
public override ValueTask<int> NonQueryExecutedAsync(
DbCommand command,
CommandExecutedEventData eventData,
@@ -275,7 +289,7 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
}
// Allow the first SPLIT through; throw on the second so the loop's
// post-CD-019 "let it propagate" behaviour can be asserted.
// "let it propagate" behaviour can be asserted.
if (SuccessfulSplits >= 1)
{
throw new InvalidOperationException(
@@ -284,6 +298,8 @@ public class AuditLogPartitionMaintenanceTests : IClassFixture<MsSqlMigrationFix
}
}
/// <summary>Verifies that a boundary that already exists causes no error, making the call idempotent.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task EnsureLookahead_BoundaryAlreadyExists_NoError_Idempotent()
{
@@ -8,7 +8,7 @@ namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Tests.Maintenance;
/// <summary>
/// Integration tests for <see cref="AuditLogRepository.BackfillSourceNodeAsync"/>
/// (M5.6 T5 — SourceNode sentinel backfill).
/// (SourceNode sentinel backfill).
///
/// <para>
/// These tests exercise the real <see cref="AuditLogRepository"/> against a
@@ -21,6 +21,8 @@ public class BackfillSourceNodeTests : IClassFixture<MsSqlMigrationFixture>
{
private readonly MsSqlMigrationFixture _fixture;
/// <summary>Initializes the test class with the shared MSSQL migration fixture.</summary>
/// <param name="fixture">The shared MSSQL migration fixture.</param>
public BackfillSourceNodeTests(MsSqlMigrationFixture fixture)
{
_fixture = fixture;
@@ -83,6 +85,8 @@ VALUES
// 1. SetsNullRowsBeforeThreshold
// ------------------------------------------------------------------
/// <summary>Verifies that the backfill sets rows with a null source node that are before the threshold.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task BackfillSourceNode_SetsNullRowsBeforeThreshold()
{
@@ -118,6 +122,8 @@ VALUES
// 2. LeavesNonNullRowsUntouched
// ------------------------------------------------------------------
/// <summary>Verifies that the backfill leaves rows that already have a source node untouched.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task BackfillSourceNode_LeavesNonNullRowsUntouched()
{
@@ -144,6 +150,8 @@ VALUES
// 3. Idempotent_SecondRunUpdatesZeroRows
// ------------------------------------------------------------------
/// <summary>Verifies that the backfill is idempotent, so a second run updates zero rows.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task BackfillSourceNode_Idempotent_SecondRunUpdatesZeroRows()
{
@@ -181,6 +189,8 @@ VALUES
// 4. CustomSentinelIsWritten
// ------------------------------------------------------------------
/// <summary>Verifies that a custom sentinel value is written.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task BackfillSourceNode_CustomSentinel_IsWritten()
{
@@ -206,6 +216,8 @@ VALUES
// 5. ArgumentValidation
// ------------------------------------------------------------------
/// <summary>Verifies that an empty sentinel throws.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task BackfillSourceNode_EmptySentinel_Throws()
{
@@ -222,6 +234,8 @@ VALUES
() => repo.BackfillSourceNodeAsync("", DateTime.UtcNow, 1000));
}
/// <summary>Verifies that a zero batch size throws.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task BackfillSourceNode_ZeroBatchSize_Throws()
{