refactor(host)/test: M2.14 review nits — simplify probe cancellation + pre-cancelled-token test (#28)

- Remove redundant linked CancellationTokenSource in ProbeAsync; pass the
  framework cancellationToken and ProbeTimeout directly to Ask (the two-CTS
  pattern was redundant — Ask already honours both the timeout and the token).
- Add EchoActor XML <remarks> explaining why no Receive<Identify> handler is
  needed (ActorBase answers Identify automatically).
- Add PreCancelledToken_ReportsUnhealthy_DoesNotThrow test: verifies the
  never-throws guarantee on the shutdown-race path (token already cancelled
  before CheckHealthAsync is invoked).
This commit is contained in:
Joseph Doherty
2026-06-16 06:54:28 -04:00
parent 473429a202
commit 6b1cb9e0e6
2 changed files with 35 additions and 3 deletions
@@ -157,11 +157,9 @@ public sealed class RequiredSingletonsHealthCheck : IHealthCheck
// ActorSelection so a missing path resolves an ActorIdentity with a null
// Subject (rather than throwing) within the bounded timeout.
var selection = system.ActorSelection($"/user/{proxyName}");
using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
cts.CancelAfter(ProbeTimeout);
var identity = await selection
.Ask<ActorIdentity>(new Identify(proxyName), ProbeTimeout, cts.Token)
.Ask<ActorIdentity>(new Identify(proxyName), ProbeTimeout, cancellationToken)
.ConfigureAwait(false);
return (proxyName, identity.Subject is not null);