fix(dashboard): close three low hub/page races (mxaccessgw#174)

D11: BrowsePage search CTS is cancelled+disposed exactly once under a lock.
D12: the hub refreshes the cached health status before seeding a new connection.
D13: DashboardEventBroadcaster gains DisposeAsync that awaits the pumps (bounded).

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 12:30:04 -05:00
parent f3a452810e
commit e69cd0321e
7 changed files with 128 additions and 24 deletions
@@ -68,6 +68,23 @@ public sealed class DashboardSnapshotServiceTests
Assert.Equal(1, health.CheckCount);
}
/// <summary>RefreshGatewayStatusAsync updates the cached status without a watch tick (R21-D12).</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task RefreshGatewayStatusAsync_UpdatesCachedStatusWithoutWatching()
{
using GatewayMetrics metrics = new();
StubHealthCheckService health = new(HealthStatus.Degraded);
DashboardSnapshotService service = CreateService(new SessionRegistry(), metrics, healthCheckService: health);
Assert.NotEqual(HealthStatus.Degraded.ToString(), service.GetSnapshot().GatewayStatus);
await service.RefreshGatewayStatusAsync(CancellationToken.None);
Assert.Equal(HealthStatus.Degraded.ToString(), service.GetSnapshot().GatewayStatus);
Assert.Equal(1, health.CheckCount);
}
/// <summary>A health evaluation that throws is reported as Unknown, never as Healthy.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]