From b6977e276e362212bef90e1e639992271d1d0103 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 14 Oct 2026 23:48:21 +0200 Subject: [PATCH] ElementIdTests: the staged-holds-an-id gate is pinned with two written records, only one holding an id Co-Authored-By: Claude Sonnet 5.5 --- tests/GameCult.Caching.Tests/ElementIdTests.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/GameCult.Caching.Tests/ElementIdTests.cs b/tests/GameCult.Caching.Tests/ElementIdTests.cs index 8dded774..70201d19 100644 --- a/tests/GameCult.Caching.Tests/ElementIdTests.cs +++ b/tests/GameCult.Caching.Tests/ElementIdTests.cs @@ -1056,16 +1056,21 @@ namespace GameCult.Caching.Tests Assert.That(CommitItemCountingDecodes(noLists, typeof(PreCut2FixtureItem)), Is.EqualTo((0, "cultcache.store.v1")), "a type with no object list is not decoded"); - // A written record that holds an id already marks the store. + // A written record that holds an id already marks the store, whichever of the written records it is. var stagedPath = PathOf("gate-staged.cc"); WritePreIdStore(stagedPath, null, ("a", "a", 1), ("b", "b", 1), ("c", "c", 1)); var stagedStore = new SingleFileMessagePackBackingStore(stagedPath); - using (var cache = new CultCache(Registry, CultCacheMessagePack.CreateCodec(Registry))) + var stagedRegistry = CultDocumentRegistry.ForTypes(new[] { typeof(IdDeck), typeof(PreCut2FixtureItem) }); + using (var cache = new CultCache(stagedRegistry, CultCacheMessagePack.CreateCodec(stagedRegistry))) { cache.AddBackingStore(stagedStore); cache.PullAllBackingStoresAsync().GetAwaiter().GetResult(); stagedStore.CopiedRecordsDecoded = 0; - cache.Commit(batch => batch.Upsert(typeof(IdDeck), Deck("fresh"), new CultRecordKey("fresh"))); + cache.Commit(batch => + { + batch.Upsert(typeof(PreCut2FixtureItem), new PreCut2FixtureItem { Name = "plain" }, new CultRecordKey("plain")); + batch.Upsert(typeof(IdDeck), Deck("fresh"), new CultRecordKey("fresh")); + }); } Assert.That(stagedStore.CopiedRecordsDecoded, Is.EqualTo(0), "a staged record holding an id marks without asking");