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
@@ -19,7 +19,7 @@ using ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Tests.Migrations;
namespace ZB.MOM.WW.ScadaBridge.AuditLog.Tests.Integration;
/// <summary>
/// Bundle F (#23 M6-T11) end-to-end test for the daily partition-switch
/// End-to-end test for the daily partition-switch
/// purge: seeds three monthly partitions (Jan / Feb / Mar 2026) with direct
/// INSERTs that bypass the standard repository ingest path (so the seed
/// timestamps are explicit), drives <see cref="AuditLogPurgeActor"/> against
@@ -46,6 +46,8 @@ public class PartitionPurgeTests : TestKit, IClassFixture<MsSqlMigrationFixture>
{
private readonly MsSqlMigrationFixture _fixture;
/// <summary>Initializes a new instance of the <see cref="PartitionPurgeTests"/> class.</summary>
/// <param name="fixture">The fixture used by the tests.</param>
public PartitionPurgeTests(MsSqlMigrationFixture fixture)
{
_fixture = fixture;
@@ -71,11 +73,11 @@ public class PartitionPurgeTests : TestKit, IClassFixture<MsSqlMigrationFixture>
string kind = "ApiCall")
{
await using var cmd = conn.CreateCommand();
// C5 (Task 2.5): dbo.AuditLog is now the 10 canonical columns + DetailsJson;
// dbo.AuditLog is now the 10 canonical columns + DetailsJson;
// the ScadaBridge domain fields (channel/kind/status/sourceSiteId) ride in
// DetailsJson and the SourceSiteId/Kind/Status computed columns auto-derive.
// Action = "{channel}.{kind}", Category = channel name, Outcome = Success.
// The channel/kind are parameterized so the M5.5 per-channel purge test can
// The channel/kind are parameterized so the per-channel purge test can
// seed multiple channels into the same partition.
cmd.CommandText = @"
INSERT INTO dbo.AuditLog
@@ -111,7 +113,7 @@ VALUES
/// <summary>
/// Asserts the post-purge index state: the partition-ALIGNED clustered
/// <c>PK_AuditLog</c> is intact and the non-aligned <c>UX_AuditLog_EventId</c>
/// is absent (WP2.2 — <c>AlignAuditLogEventIdUniqueness</c>).
/// is absent (<c>AlignAuditLogEventIdUniqueness</c>).
/// </summary>
/// <remarks>
/// The purge used to bracket its SWITCH with a DROP/CREATE of
@@ -164,7 +166,7 @@ SELECT
/// <para>
/// Deferred-work register row 82. Every actor these tests create ticks every
/// <c>100 ms</c> (<see cref="AuditLogPurgeOptions.IntervalOverride"/>) and switches
/// out the Jan-2026 partition each time it finds one eligible. The tests relied on
/// out the January 2026 partition each time it finds one eligible. The tests relied on
/// <see cref="TestKit"/>'s <c>Dispose</c> → <c>Shutdown</c> to stop them between
/// test methods, but that shutdown is bounded by a timeout and does NOT fail when
/// it expires — so on a loaded machine a previous test's actor was still ticking
@@ -172,9 +174,9 @@ SELECT
/// </para>
/// <para>
/// That is what made <c>PerChannelOverride_DeletesOnlyOverriddenChannelsOldRows</c>
/// flake under a parallel full-solution run: it seeds a Jan-15-2026 row and expects
/// flake under a parallel full-solution run: it seeds a 2026-01-15 row and expects
/// its own per-channel DELETE to remove exactly one row, but a leaked actor could
/// switch the whole Jan-2026 partition out first, leaving nothing to delete
/// switch the whole January 2026 partition out first, leaving nothing to delete
/// (observed: <c>Assert.Equal() Failure … Expected: 1, Actual: 0</c>). Stopping the
/// actor inside the test that created it removes the dependency on shutdown timing
/// altogether.
@@ -228,9 +230,9 @@ SELECT
var retentionDays = (int)(DateTime.UtcNow - thresholdAnchor).TotalDays + 1;
return (
Old: new DateTime(2026, 1, 15, 0, 0, 0, DateTimeKind.Utc), // in Jan-2026 partition → PURGED
Mid: new DateTime(2026, 4, 15, 0, 0, 0, DateTimeKind.Utc), // in Apr-2026 partition → KEPT
Recent: new DateTime(2026, 6, 15, 0, 0, 0, DateTimeKind.Utc), // in Jun-2026 partition → KEPT
Old: new DateTime(2026, 1, 15, 0, 0, 0, DateTimeKind.Utc), // in January 2026 partition → PURGED
Mid: new DateTime(2026, 4, 15, 0, 0, 0, DateTimeKind.Utc), // in April 2026 partition → KEPT
Recent: new DateTime(2026, 6, 15, 0, 0, 0, DateTimeKind.Utc), // in June 2026 partition → KEPT
RetentionDays: retentionDays
);
}
@@ -239,6 +241,8 @@ SELECT
// 1. EndToEnd_OldestPartition_PurgedViaActor_NewerKept
// ---------------------------------------------------------------------
/// <summary>Verifies the case: end To End, oldest Partition, purged Via Actor, newer Kept.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task EndToEnd_OldestPartition_PurgedViaActor_NewerKept()
{
@@ -283,7 +287,7 @@ SELECT
var actor = CreateActor(sp, purgeOptions, auditOptions);
// The Jan-2026 partition boundary is the only eligible one in this fixture DB.
// The January 2026 partition boundary is the only eligible one in this fixture DB.
var janBoundary = new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var matched = probe.FishForMessage<AuditLogPurgedEvent>(
isMessage: m => m.MonthBoundary == janBoundary,
@@ -313,14 +317,16 @@ SELECT
// 2. EndToEnd_AlignedUniqueness_AfterPurge
// ---------------------------------------------------------------------
/// <summary>Verifies the case: end To End, aligned Uniqueness, after Purge.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task EndToEnd_AlignedUniqueness_AfterPurge()
{
Skip.IfNot(_fixture.Available, _fixture.SkipReason);
// Same shape as test 1 — purge the Jan-2026 partition and then assert the
// Same shape as test 1 — purge the January 2026 partition and then assert the
// index state. RetentionDays is computed dynamically so the threshold always
// lands near 2026-01-20 (see SeedOccurredAt()). Since WP2.2 the switch touches
// lands near 2026-01-20 (see SeedOccurredAt()). The switch touches
// no index at all: uniqueness rides the aligned clustered PK, so there is
// nothing to drop before the SWITCH and nothing to rebuild after it.
var siteId = "purge-uxidx-" + Guid.NewGuid().ToString("N").Substring(0, 8);
@@ -370,14 +376,16 @@ SELECT
// 3. EndToEnd_InsertIfNotExistsAsync_StillIdempotent_AfterPurge
// ---------------------------------------------------------------------
/// <summary>Verifies the case: end To End, insert If Not Exists Async, still Idempotent, after Purge.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task EndToEnd_InsertIfNotExistsAsync_StillIdempotent_AfterPurge()
{
Skip.IfNot(_fixture.Available, _fixture.SkipReason);
// Seed + purge the Jan-2026 row, THEN exercise InsertIfNotExistsAsync twice for
// Seed + purge the January 2026 row, THEN exercise InsertIfNotExistsAsync twice for
// a fresh recent EventId. The second call must be a no-op (duplicate-key collision
// swallowed by the repository, per M2 Bundle A's race-fix) — which means the
// swallowed by the repository, per the repository's race fix) — which means the
// aligned clustered PK is still enforcing uniqueness as intended.
// RetentionDays is computed dynamically so the threshold always lands near
// 2026-01-20 (see SeedOccurredAt()).
@@ -455,11 +463,11 @@ SELECT
}
// ---------------------------------------------------------------------
// 4. PerChannelOverride_DeletesOnlyOverriddenChannelsOldRows (M5.5 T3)
// 4. PerChannelOverride_DeletesOnlyOverriddenChannelsOldRows
// ---------------------------------------------------------------------
/// <summary>
/// M5.5 (T3): exercises <see cref="IAuditLogRepository.PurgeChannelOlderThanAsync"/>
/// Exercises <see cref="IAuditLogRepository.PurgeChannelOlderThanAsync"/>
/// directly against the real repository + fixture DB. Seeds, in the SAME partition,
/// old + recent rows for an OVERRIDDEN channel (<c>ApiOutbound</c>) and old + recent
/// rows for an UN-overridden channel (<c>DbOutbound</c>), then runs the per-channel
@@ -474,6 +482,7 @@ SELECT
/// the append-only writer-role DENYs do not bind (the role granularity is exercised
/// in the repository/migration tests).
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task PerChannelOverride_DeletesOnlyOverriddenChannelsOldRows()
{
@@ -538,17 +547,18 @@ SELECT
}
// ---------------------------------------------------------------------
// 5. SwitchOut_WithExplicitCommandTimeout_Succeeds (Task 4)
// 5. SwitchOut_WithExplicitCommandTimeout_Succeeds
// ---------------------------------------------------------------------
/// <summary>
/// Task 4 (arch-review 04, S2): proves the explicit-<see cref="TimeSpan"/> maintenance-timeout
/// Proves the explicit-<see cref="TimeSpan"/> maintenance-timeout
/// overload of <see cref="IAuditLogRepository.SwitchOutPartitionAsync"/> runs the real
/// staging/switch batch to completion against SQL Server — the old row is purged, the kept row
/// survives, and the returned sampled row-count reflects the switched partition. Exercising the
/// timeout path end-to-end guards against a regression that only sets the timeout on the sample
/// command and forgets the DDL batch (or vice versa).
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[SkippableFact]
public async Task SwitchOut_WithExplicitCommandTimeout_Succeeds()
{