From a5d1be650dbb9dae0f2c7e7cd678377173043af4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 13 Sep 2026 23:38:08 +0200 Subject: [PATCH] Mark every Cult document [MessagePackObject] PlayerData, CultMeshSimulationFact, the Networking interop peer's CultNetInteropNote, the cultnet-py benchmark item and the Caching test documents lacked [MessagePackObject]. Only the generated codec could serialize them; MessagePackSerializer refuses such types. Non-public test documents take [MessagePackObject(AllowPrivate = true)], as consumer internal documents already do, and ConditionalCommitTests.Slow marks its private backing fields [IgnoreMember]. Same [Key]s, so payloads are unchanged: a pre/post probe over the Networking assembly and both interop peers showed identical schema id, content hash and payload bytes for all 9 documents, PlayerData equal once its Guid.NewGuid() default id is masked. Co-Authored-By: Claude Opus 5 --- .../cultnet-py/tools/GameCult.Caching.Benchmark/Program.cs | 1 + src/GameCult.Mesh/CultMeshSimulationFacts.cs | 1 + src/GameCult.Networking/PlayerData.cs | 1 + tests/GameCult.Caching.Tests/ConditionalCommitTests.cs | 7 +++++-- .../DirectoryStoreDurabilityTests.cs | 1 + tests/GameCult.Caching.Tests/PreCut2FixtureDocuments.cs | 2 ++ tests/GameCult.Caching.Tests/StoreRoutingTests.cs | 7 +++++++ tests/GameCult.Networking.InteropPeer/Program.cs | 1 + 8 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/cultnet-py/tools/GameCult.Caching.Benchmark/Program.cs b/packages/cultnet-py/tools/GameCult.Caching.Benchmark/Program.cs index e5f9d5fd..14ec8d5e 100644 --- a/packages/cultnet-py/tools/GameCult.Caching.Benchmark/Program.cs +++ b/packages/cultnet-py/tools/GameCult.Caching.Benchmark/Program.cs @@ -94,6 +94,7 @@ internal sealed record BenchmarkResult(string Runtime, int Records, IReadOnlyLis internal sealed record BenchmarkMetric(string Name, int Operations, double ElapsedMs, double OpsPerSecond); [CultDocument("bench.item", "bench.item.v1")] +[MessagePackObject(AllowPrivate = true)] internal sealed class BenchItem { [Key(0)] [CultName] diff --git a/src/GameCult.Mesh/CultMeshSimulationFacts.cs b/src/GameCult.Mesh/CultMeshSimulationFacts.cs index 6efa8711..11c7d296 100644 --- a/src/GameCult.Mesh/CultMeshSimulationFacts.cs +++ b/src/GameCult.Mesh/CultMeshSimulationFacts.cs @@ -13,6 +13,7 @@ namespace GameCult.Mesh /// Committed simulation fact derived from witness consensus. /// [CultDocument("gamecult.mesh.simulation_fact", "gamecult.mesh.simulation_fact.v1")] + [MessagePackObject] public sealed class CultMeshSimulationFact { /// diff --git a/src/GameCult.Networking/PlayerData.cs b/src/GameCult.Networking/PlayerData.cs index 997db848..ade82c0f 100644 --- a/src/GameCult.Networking/PlayerData.cs +++ b/src/GameCult.Networking/PlayerData.cs @@ -8,6 +8,7 @@ namespace GameCult.Networking /// Basic player account document used by the sample networking stack. /// [CultDocument("gamecult.player_data", "gamecult.player_data.v2")] + [MessagePackObject] public class PlayerData { /// diff --git a/tests/GameCult.Caching.Tests/ConditionalCommitTests.cs b/tests/GameCult.Caching.Tests/ConditionalCommitTests.cs index 875d7664..adfd67e3 100644 --- a/tests/GameCult.Caching.Tests/ConditionalCommitTests.cs +++ b/tests/GameCult.Caching.Tests/ConditionalCommitTests.cs @@ -911,6 +911,7 @@ namespace GameCult.Caching.Tests } [CultDocument("tests.conditional_counter", "tests.conditional_counter.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class Counter { [Key(0)] @@ -922,6 +923,7 @@ namespace GameCult.Caching.Tests } [CultDocument("tests.conditional_tally", "tests.conditional_tally.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class Tally { [Key(0)] @@ -931,14 +933,15 @@ namespace GameCult.Caching.Tests // Loading a record with Blocks set waits on Pause, which parks a directory pull inside its page load. [CultDocument("tests.conditional_slow", "tests.conditional_slow.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class Slow { internal static volatile ManualResetEventSlim? Pause; internal static readonly ManualResetEventSlim Entered = new(); internal static volatile bool Paused; internal static volatile bool ReadWhilePaused; - private bool _blocks; - private string _name = string.Empty; + [IgnoreMember] private bool _blocks; + [IgnoreMember] private string _name = string.Empty; [Key(0)] [CultName] diff --git a/tests/GameCult.Caching.Tests/DirectoryStoreDurabilityTests.cs b/tests/GameCult.Caching.Tests/DirectoryStoreDurabilityTests.cs index 473717cc..41ef46ad 100644 --- a/tests/GameCult.Caching.Tests/DirectoryStoreDurabilityTests.cs +++ b/tests/GameCult.Caching.Tests/DirectoryStoreDurabilityTests.cs @@ -228,6 +228,7 @@ namespace GameCult.Caching.Tests Path.Combine(_records, BitConverter.ToString(identity).Replace("-", string.Empty).ToLowerInvariant() + ".msgpack"); [CultDocument("tests.durability_page", "tests.durability_page.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class Page { [Key(0)] diff --git a/tests/GameCult.Caching.Tests/PreCut2FixtureDocuments.cs b/tests/GameCult.Caching.Tests/PreCut2FixtureDocuments.cs index 4598b7a5..9f9ab7dc 100644 --- a/tests/GameCult.Caching.Tests/PreCut2FixtureDocuments.cs +++ b/tests/GameCult.Caching.Tests/PreCut2FixtureDocuments.cs @@ -4,6 +4,7 @@ using MessagePack; namespace GameCult.Caching.Tests { [CultDocument("fixtures.precut2.item", "fixtures.precut2.item.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class PreCut2FixtureItem { [Key(0)] @@ -15,6 +16,7 @@ namespace GameCult.Caching.Tests } [CultDocument("fixtures.precut2.note", "fixtures.precut2.note.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class PreCut2FixtureNote { [Key(0)] diff --git a/tests/GameCult.Caching.Tests/StoreRoutingTests.cs b/tests/GameCult.Caching.Tests/StoreRoutingTests.cs index 31619292..9a65dc89 100644 --- a/tests/GameCult.Caching.Tests/StoreRoutingTests.cs +++ b/tests/GameCult.Caching.Tests/StoreRoutingTests.cs @@ -707,6 +707,7 @@ namespace GameCult.Caching.Tests } [CultDocument("tests.routing_note", "tests.routing_note.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class RoutingNote { [Key(0)] @@ -718,6 +719,7 @@ namespace GameCult.Caching.Tests } [CultDocument("tests.routing_other", "tests.routing_other.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class RoutingOther { [Key(0)] @@ -729,6 +731,7 @@ namespace GameCult.Caching.Tests } [CultDocument("tests.routing_gear", "tests.routing_gear.v1")] + [MessagePackObject] public class RoutingGear { [Key(0)] @@ -736,6 +739,7 @@ namespace GameCult.Caching.Tests } [CultDocument("tests.routing_weapon", "tests.routing_weapon.v1")] + [MessagePackObject] public sealed class RoutingWeapon : RoutingGear { [Key(1)] @@ -747,6 +751,7 @@ namespace GameCult.Caching.Tests } [CultDocument("tests.routing_leaf", "tests.routing_leaf.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class RoutingLeaf : RoutingBase { [Key(0)] @@ -755,6 +760,7 @@ namespace GameCult.Caching.Tests } [CultDocument("tests.routing_leaf_twin", "tests.routing_leaf_twin.v1")] + [MessagePackObject(AllowPrivate = true)] internal sealed class RoutingLeafTwin : RoutingBase { [Key(0)] @@ -767,6 +773,7 @@ namespace GameCult.Caching.Tests } [CultDocument("tests.routing_global", "tests.routing_global.v1")] + [MessagePackObject(AllowPrivate = true)] [CultGlobal] internal sealed class RoutingGlobal : RoutingGlobalBase { diff --git a/tests/GameCult.Networking.InteropPeer/Program.cs b/tests/GameCult.Networking.InteropPeer/Program.cs index 953ee097..d4c8fab7 100644 --- a/tests/GameCult.Networking.InteropPeer/Program.cs +++ b/tests/GameCult.Networking.InteropPeer/Program.cs @@ -1490,6 +1490,7 @@ static class InteropPeerShared } [CultDocument(InteropPeerShared.InteropDocumentType, InteropPeerShared.InteropSchemaVersion)] +[MessagePackObject] public sealed class CultNetInteropNote { [Key(0)] public string SchemaVersion { get; set; } = InteropPeerShared.InteropSchemaVersion;