Skip to content

Commit 7ace0ad

Browse files
HandyS11claude
andcommitted
docs(test): clarify hosted-service fault tests assert crash-isolation, not per-event resilience
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6586cc0 commit 7ace0ad

5 files changed

Lines changed: 10 additions & 5 deletions

File tree

tests/RustPlusBot.Features.Alarms.Tests/Hosting/AlarmsHostedServiceTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ public async Task TriggeredLoop_survives_a_faulting_relay_and_StopAsync_complete
216216
await Task.Delay(20);
217217
}
218218

219-
// The relay threw; the loop swallowed it (LogTriggeredLoopFaulted) so StopAsync joins cleanly.
219+
// The relay threw, causing the loop to fault and complete (LogTriggeredLoopFaulted). StopAsync joins the
220+
// faulted task cleanly — no rethrow. This is crash-isolation, not per-event resilience.
220221
await h.Store.Received().GetAsync(10UL, serverId, 42UL, Arg.Any<CancellationToken>());
221222
await h.Service.StopAsync(default);
222223
}

tests/RustPlusBot.Features.Chat.Tests/Hosting/ChatHostedServiceTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ await bus.PublishAsync(
9999
await Task.Delay(20);
100100
}
101101

102-
// The loop swallowed the fault (LogRelayLoopFaulted); StopAsync must join cleanly, not rethrow.
102+
// The relay threw, causing the loop to fault and complete (LogRelayLoopFaulted). StopAsync joins the
103+
// faulted task cleanly — no rethrow. This is crash-isolation, not per-event resilience.
103104
await poster.Received().PostAsync(Arg.Any<ulong>(), "Bob", "boom", Arg.Any<CancellationToken>());
104105
await service.StopAsync(default);
105106
}

tests/RustPlusBot.Features.Players.Tests/Hosting/PlayersHostedServiceTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ await h.Bus.PublishAsync(new PlayerStateChangedEvent(
106106
await Task.Delay(20);
107107
}
108108

109-
// The loop swallowed the fault (LogRelayLoopFaulted); StopAsync must join cleanly, not rethrow.
109+
// The relay threw, causing the loop to fault and complete (LogRelayLoopFaulted). StopAsync joins the
110+
// faulted task cleanly — no rethrow. This is crash-isolation, not per-event resilience.
110111
await h.Sender.Received().SendAsync(
111112
10UL, Arg.Any<Guid>(), Arg.Is<string>(s => s.Contains("Bob")), Arg.Any<CancellationToken>());
112113
await h.Service.StopAsync(default);

tests/RustPlusBot.Features.StorageMonitors.Tests/Hosting/StorageMonitorsHostedServiceTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ await h.Bus.PublishAsync(new StorageMonitorTriggeredEvent(
230230
await Task.Delay(20);
231231
}
232232

233-
// The relay threw; the loop swallowed it (LogTriggeredLoopFaulted) so StopAsync joins cleanly.
233+
// The relay threw, causing the loop to fault and complete (LogTriggeredLoopFaulted). StopAsync joins the
234+
// faulted task cleanly — no rethrow. This is crash-isolation, not per-event resilience.
234235
await h.Store.Received().GetAsync(Guild, serverId, 7UL, Arg.Any<CancellationToken>());
235236
await h.Service.StopAsync(default);
236237
}

tests/RustPlusBot.Features.Switches.Tests/Hosting/SwitchesHostedServiceTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ public async Task StateLoop_survives_a_faulting_relay_and_StopAsync_completes_cl
255255
await Task.Delay(20);
256256
}
257257

258-
// The relay threw; the loop must have swallowed it (LogStateLoopFaulted) so StopAsync joins cleanly.
258+
// The relay threw, causing the loop to fault and complete (LogStateLoopFaulted). StopAsync joins the
259+
// faulted task cleanly — no rethrow. This is crash-isolation, not per-event resilience.
259260
await h.Store.Received().UpdateStateAsync(10UL, serverId, 42UL, true, Arg.Any<CancellationToken>());
260261
await h.Service.StopAsync(default);
261262
}

0 commit comments

Comments
 (0)