From 5607d9703d3ddbfb61ec56af3efa50ffa963318b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 12:52:15 +0200 Subject: [PATCH] C#: the directory store's loaded id is its manifest's; the variant fixture names itself A directory-store record's identity on disk is its manifest entry, which is what a commit condition compares; the page holds its own copy of the id. A load now takes StoredSchemaId from the manifest, so a manifest rewritten under an older id (AConditionOnARecordUnderADeclaredOldIdHoldsInTheDirectoryStore) is the id the condition expects. Canonicalisation had hidden the page and manifest disagreeing in that fixture. The whole-view test's variant overrides its name: a variant may not share its base's. Co-Authored-By: Claude Opus 5.5 --- .../DirectoryMessagePackBackingStore.cs | 5 ++++- tests/GameCult.Caching.Tests/CompatibleSchemaIdTests.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/GameCult.Caching.MessagePack/DirectoryMessagePackBackingStore.cs b/src/GameCult.Caching.MessagePack/DirectoryMessagePackBackingStore.cs index d078999a..20f00c2e 100644 --- a/src/GameCult.Caching.MessagePack/DirectoryMessagePackBackingStore.cs +++ b/src/GameCult.Caching.MessagePack/DirectoryMessagePackBackingStore.cs @@ -339,11 +339,14 @@ public sealed class DirectoryMessagePackBackingStore : CacheBackingStore var started = tracePages ? Stopwatch.GetTimestamp() : 0L; var metadata = records[index]; var record = ReadPersistedRecordPage(metadata, out var pagePayload); - storedRecords[index] = ToStoredDocument( + var stored = ToStoredDocument( record, catalogEntries, (type, payload) => CultDocumentMessagePackSerialization.DeserializeUntyped(type, payload, Registry), out recordReports[index]); + // The manifest is this store's record of what is on disk, and what a commit condition compares with. + stored.StoredSchemaId = metadata.SchemaId; + storedRecords[index] = stored; if (tracePages) { pageBytes[index] = pagePayload.LongLength; diff --git a/tests/GameCult.Caching.Tests/CompatibleSchemaIdTests.cs b/tests/GameCult.Caching.Tests/CompatibleSchemaIdTests.cs index e6b5c3e2..f76d023d 100644 --- a/tests/GameCult.Caching.Tests/CompatibleSchemaIdTests.cs +++ b/tests/GameCult.Caching.Tests/CompatibleSchemaIdTests.cs @@ -354,7 +354,7 @@ namespace GameCult.Caching.Tests using (var cache = Open(path, Declaring)) { cache.Commit(batch => batch.Upsert(typeof(DeclaringDeck), new DeclaringDeck { Name = "b" }, b)); - cache.Commit(batch => batch.UpsertVariant(v, b)); + cache.Commit(batch => batch.UpsertVariant(v, b, new[] { cache.Override(typeof(DeclaringDeck), nameof(DeclaringDeck.Name), "v") })); } Rewrite(path, snapshot =>