Narrow the escaped-observer probe to what this base can show

A database write is published after its cache write returns, so a write whose
observer threw never reaches the database observers on this base. Keep the
probe to the exception reaching the writer and later changes still publishing
and logging; the ordering question belongs to the database cut.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-29 16:57:04 +02:00
commit 41b964c6f1

View file

@ -60,9 +60,11 @@ namespace GameCult.Networking.Tests
});
}
// One observer's escaped exception (a fail-fast R3 handler) does not stop the database observer after it, and the writer gets it.
// One observer's escaped exception (a fail-fast R3 handler) reaches the writer and does not stall later changes.
// A database write is published by the database after its cache write returns, so the failed write itself is not
// published here; that ordering belongs to the CultNetDatabase cut.
[Test]
public async Task AnEscapedObserverExceptionDoesNotStopTheDatabaseOrLaterChanges()
public async Task AnEscapedObserverExceptionReachesTheWriterAndDoesNotStallLaterChanges()
{
var previous = ObservableSystem.GetUnhandledExceptionHandler();
ObservableSystem.RegisterUnhandledExceptionHandler(exception => throw exception);
@ -85,7 +87,7 @@ namespace GameCult.Networking.Tests
Assert.Multiple(() =>
{
Assert.That(escaped!.Message, Is.EqualTo("observer boom"));
Assert.That(seen, Is.EqualTo(new[] { "boom", "after" }), "the database observer after the thrower saw both changes");
Assert.That(seen, Does.Contain("after"), "a later commit was never published");
Assert.That(database.LastWriteSequence(SchemaId, after), Is.Not.Null, "a later commit was never logged");
});
}