From f3076264fc2c36f749764c12b1c872b5d8f12a51 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 02:51:14 +0200 Subject: [PATCH] Journal tests: a plain put of an unowned schema is unlogged, a door put keeps the fallback shard Co-Authored-By: Claude Sonnet 5.5 --- .../CultNetJournalTests.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/GameCult.Networking.Tests/CultNetJournalTests.cs b/tests/GameCult.Networking.Tests/CultNetJournalTests.cs index 208feb1d..b50d675d 100644 --- a/tests/GameCult.Networking.Tests/CultNetJournalTests.cs +++ b/tests/GameCult.Networking.Tests/CultNetJournalTests.cs @@ -627,15 +627,23 @@ namespace GameCult.Networking.Tests Assert.That(database.GetMutationLog(ShardId).Select(entry => entry.Key.Value), Is.EqualTo(new[] { One.Value })); } - // A door chose its shard, by the fallback when none matches; the journal honours it. + // A door chose its shard, by the fallback when none matches; the journal honours it. A plain PutAsync carries no + // door, so an unowned schema written through it is cached and not logged. [Test] - public async Task ADatabaseWriteOfASchemaNoShardOwnsIsLoggedInTheFallbackShard() + public async Task AnAuthoritativePutOfASchemaNoShardOwnsIsLoggedInTheFallbackShardButAPlainPutIsNot() { var store = new FlakyLogStore(); var cache = new CultCache(); var database = Database(cache, primary: true, store); + var shard = database.Shards[0]; - await database.PutAsync(new CultRecordKey("unrelated:n"), new MeshQuickstartNote { NoteId = "n", Body = "door" }); + await database.PutAsync(new CultRecordKey("unrelated:plain"), new MeshQuickstartNote { NoteId = "p", Body = "plain" }); + Assert.That(Sequences(store), Is.Empty); + + var message = database.Documents.CreateRawDocumentPutMessage("door", new CultRecordHandle(new CultRecordKey("unrelated:door")), new MeshQuickstartNote { NoteId = "d", Body = "door" }); + message.ShardId = shard.ShardId; + message.ShardEpoch = shard.Epoch; + await database.ApplyPutAsync(message); Assert.That(Sequences(store), Is.EqualTo(new[] { 1L })); }