From 784dc7d6140f351dd379b0d4811130acfe69f1af Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 07:28:30 +0200 Subject: [PATCH] CultMesh: the untyped same-schema fallback reads through the database, which serves only what its shards own The string ResolveShard check was order-dependent in the full Mesh suite (schema id of a same-schema alias pair); GetAsync uses the descriptor path and adds no helper. Co-Authored-By: Claude Sonnet 5.5 --- src/GameCult.Mesh/CultMesh.cs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/GameCult.Mesh/CultMesh.cs b/src/GameCult.Mesh/CultMesh.cs index bdc1dbdc..ef41d1f7 100644 --- a/src/GameCult.Mesh/CultMesh.cs +++ b/src/GameCult.Mesh/CultMesh.cs @@ -3370,20 +3370,6 @@ namespace GameCult.Mesh $"CultMesh document '{key.Value}' was not found as {typeof(TDocument).FullName}."); } - // A database serves only what its shards own; the cache behind it may hold more. - private static bool DatabaseServes(CultNetDatabase database, object document, CultRecordKey key) - { - try - { - database.ResolveShard(CultDocumentRegistry.Shared.GetRequired(document.GetType()).SchemaId, key); - return true; - } - catch (CultNetUnownedSchemaException) - { - return false; - } - } - private static async Task ReadDatabaseDocumentRequiredAsync( CultNetDatabase database, CultRecordKey key) @@ -3393,8 +3379,9 @@ namespace GameCult.Mesh if (document != null) return document; - var untyped = database.Cache.Get(key); - if (untyped != null && IsSameCultDocumentSchema(untyped.GetType()) && DatabaseServes(database, untyped, key)) + // Through the database, which serves only what its shards own; the cache behind it may hold more. + var untyped = await database.GetAsync(key).ConfigureAwait(false); + if (untyped != null && IsSameCultDocumentSchema(untyped.GetType())) return ConvertUntypedDocument(untyped); throw new KeyNotFoundException(