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
@@ -23,6 +23,7 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
private readonly SqliteConnection _connection;
private readonly ServiceProvider _provider;
/// <summary>Initializes a new instance of the <c>FleetWideUnlockThrottleTests</c> class.</summary>
public FleetWideUnlockThrottleTests()
{
// One open in-memory SQLite connection for the fixture's lifetime — the database
@@ -40,6 +41,7 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
scope.ServiceProvider.GetRequiredService<ScadaBridgeDbContext>().Database.EnsureCreated();
}
/// <summary>Disposes the service provider and the shared connection.</summary>
public void Dispose()
{
_provider.Dispose();
@@ -61,10 +63,12 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
_provider.GetRequiredService<IServiceScopeFactory>(), clock),
logger: null);
/// <summary>Verifies that two nodes sharing one store enforce a single combined throttle window.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task TwoNodesSharingOneStore_EnforceASingleCombinedWindow()
{
// The headline row-52 contract: attempts spread across both central nodes count
// The headline contract: attempts spread across both central nodes count
// against ONE budget. Before this, five attempts per node were both allowed.
var clock = new TestClock(new DateTimeOffset(2026, 6, 1, 12, 0, 0, TimeSpan.Zero));
var nodeA = NewNode(clock);
@@ -81,6 +85,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.False(await nodeB.TryRegisterAttemptAsync("10.0.0.1", 10));
}
/// <summary>Verifies that denied attempts do not consume any of the throttle budget.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task DeniedAttempts_BurnNoBudget()
{
@@ -108,6 +114,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.Equal(3, recorded);
}
/// <summary>Verifies that the throttle window survives a restart.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task TheWindowIsRestartDurable()
{
@@ -125,6 +133,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.False(await afterRestart.TryRegisterAttemptAsync("10.0.0.1", 3));
}
/// <summary>Verifies that the throttle window slides so an aged-out budget is released.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task TheWindowSlides_SoAnAgedOutBudgetIsReleased()
{
@@ -142,6 +152,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.True(await node.TryRegisterAttemptAsync("10.0.0.1", 3));
}
/// <summary>Verifies that throttle buckets are isolated per client.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task BucketsAreIsolatedPerClient()
{
@@ -156,6 +168,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.True(await node.TryRegisterAttemptAsync("<unattributed>", 1));
}
/// <summary>Verifies that a store failure fails open and does not block the unlock.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task StoreFailure_FailsOpen_AndDoesNotBlockTheUnlock()
{
@@ -176,6 +190,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
}
}
/// <summary>Verifies that caller cancellation is not swallowed by the fail-open path.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task CallerCancellation_IsNotSwallowedByTheFailOpenPath()
{
@@ -197,10 +213,12 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
() => limiter.TryRegisterAttemptAsync("10.0.0.1", 10, cts.Token));
}
/// <summary>Verifies that without a shared window the limiter still enforces a process-local cap.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task WithoutASharedWindow_TheLimiterStillEnforcesAProcessLocalCap()
{
// Hosts that register Transport without a shared window keep the pre-row-52
// Hosts that register Transport without a shared window keep the pre-shared-window
// behaviour rather than losing the cap entirely.
var clock = new TestClock(new DateTimeOffset(2026, 6, 1, 12, 0, 0, TimeSpan.Zero));
var limiter = new BundleUnlockRateLimiter(clock, BundleUnlockRateLimiter.DefaultWindow);
@@ -210,6 +228,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.False(await limiter.TryRegisterAttemptAsync("10.0.0.1", 1));
}
/// <summary>Verifies that aged rows are pruned opportunistically once the prune interval has elapsed.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task AgedRowsArePrunedOpportunistically_OnceThePruneIntervalHasElapsed()
{
@@ -233,6 +253,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.Equal("10.0.0.2", Assert.Single(remaining).ClientKey);
}
/// <summary>Verifies that recent rows survive a prune pass.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task RecentRowsSurviveAPrunePass()
{
@@ -252,6 +274,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.Equal(2, await ctx.BundleUnlockAttempts.AsNoTracking().CountAsync());
}
/// <summary>Verifies that the scheduled prune clears aged rows even when there is no unlock traffic.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task ScheduledPrune_ClearsAgedRows_WithNoUnlockTrafficAtAll()
{
@@ -275,6 +299,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.Empty(await ctx.BundleUnlockAttempts.AsNoTracking().ToListAsync());
}
/// <summary>Verifies that the scheduled prune respects the retention horizon and the cadence claim.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task ScheduledPrune_RespectsTheRetentionHorizonAndTheCadenceClaim()
{
@@ -300,6 +326,8 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
Assert.Equal(1, await ctx.BundleUnlockAttempts.AsNoTracking().CountAsync());
}
/// <summary>Verifies that the scheduled prune does not throw when the store is unavailable.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task ScheduledPrune_DoesNotThrow_WhenTheStoreIsUnavailable()
{
@@ -320,8 +348,13 @@ public sealed class FleetWideUnlockThrottleTests : IDisposable
private sealed class TestClock : TimeProvider
{
private DateTimeOffset _now;
/// <summary>Initializes a new instance of the <c>TestClock</c> class.</summary>
/// <param name="start">The initial time of the clock.</param>
public TestClock(DateTimeOffset start) { _now = start; }
/// <inheritdoc />
public override DateTimeOffset GetUtcNow() => _now;
/// <summary>Moves the test clock forward by the given amount.</summary>
/// <param name="by">The amount to advance the clock by.</param>
public void Advance(TimeSpan by) => _now = _now.Add(by);
}
}