From 9e698c86df1029b73c4cd21c2ab35a5e9115bc30 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 19:01:16 +0100 Subject: [PATCH] thing-contract parity: written-by-cs.cc under the package's record keys; README rows for both fixtures Co-Authored-By: Claude Sonnet 5.5 --- .../ParityTests.cs | 18 ++++++++++++------ tests/thing-contract-parity/README.md | 4 +++- tests/thing-contract-parity/written-by-cs.cc | Bin 0 -> 13924 bytes 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 tests/thing-contract-parity/written-by-cs.cc diff --git a/tests/GameCult.Thing.Contract.Tests/ParityTests.cs b/tests/GameCult.Thing.Contract.Tests/ParityTests.cs index 3cd5ce5..5aa8d95 100644 --- a/tests/GameCult.Thing.Contract.Tests/ParityTests.cs +++ b/tests/GameCult.Thing.Contract.Tests/ParityTests.cs @@ -36,6 +36,10 @@ public sealed class ParityTests (cache.GetAll().Single(), "asset-catalog", "thing:asset_catalog:provider.a.icons"), }; + // Stored under the package's own record key, the one keys.ts builds, so the other runtime finds each record by it. + private static void Put(CultCacheBatch batch, object document) => + batch.Upsert(document.GetType(), document, new CultRecordKey((string)document.GetType().GetProperty("RecordKey")!.GetValue(document)!)); + private static void AssertFiveRecords(CultCache cache) { foreach (var (value, golden, key) in Records(cache)) @@ -111,12 +115,14 @@ public sealed class ParityTests { using (var cache = CultCacheMessagePack.Create(scratch, new CultCacheOpenOptions { Registry = Wire.Registry })) { - cache.Commit(b => b - .Upsert(FullSurface()) - .Upsert(FullComposition()) - .Upsert(Invocation()) - .Upsert(Results(Invocation()).Single(r => r.Name == "result-pending").Result) - .Upsert(FullAssetCatalog())); + cache.Commit(b => + { + Put(b, FullSurface()); + Put(b, FullComposition()); + Put(b, Invocation()); + Put(b, Results(Invocation()).Single(r => r.Name == "result-pending").Result); + Put(b, FullAssetCatalog()); + }); cache.FlushAsync().GetAwaiter().GetResult(); } diff --git a/tests/thing-contract-parity/README.md b/tests/thing-contract-parity/README.md index 87895a0..ea5084b 100644 --- a/tests/thing-contract-parity/README.md +++ b/tests/thing-contract-parity/README.md @@ -6,5 +6,7 @@ The names the C# package `GameCult.Thing.Contract` gives its types. The C# packa |---|---| | `catalog-members.tsv` | One row per document slot, `schemaId`, `slot`, `memberName`, `typeName`, as `Wire.Registry`'s catalog entries print them. A list slot reads `System.Collections.Generic.IReadOnlyList`. | | `type-names.txt` | The full name of every public type in `GameCult.Thing.Contract`, sorted ordinally. | +| `written-by-cs.cc` | A single-file store the C# package's CultCache wrote from its own builders, one record of each kind. `packages/thing-contract/test/parity.test.ts` reads it. Regenerate: `THING_PARITY_WRITE=1 dotnet test tests/GameCult.Thing.Contract.Tests` (`ParityTests.cs`). | +| `written-by-ts.cc` | The same five records, written by `@gamecult/thing-contract`'s CultCache. `ParityTests.cs` reads it. Regenerate: `THING_PARITY_WRITE=1 npm test` in `packages/thing-contract` (`parity.test.ts`). | -`tests/GameCult.Thing.Contract.Tests/NameSetTests.cs` fails when either file disagrees with the C# types. These files change only in the commit that changes the C# types, and the other runtime packages read them without writing them. +`tests/GameCult.Thing.Contract.Tests/NameSetTests.cs` fails when either file disagrees with the C# types. The two name files change only in the commit that changes the C# types, and the other runtime packages read them without writing them. Each `.cc` is written by its own package and read by the other. diff --git a/tests/thing-contract-parity/written-by-cs.cc b/tests/thing-contract-parity/written-by-cs.cc new file mode 100644 index 0000000000000000000000000000000000000000..ebd057f953f07d49201d5c7d92941a892bc79ff6 GIT binary patch literal 13924 zcmd^G&2JmW6(=dlPCpJsf!-Ct=_Mw!v)>eoI<8U}M$*KvjRO4)W_M<3!mC|ocO_dW z(o_Eca!J|Ft&&N}QXCg3iUKWCgs{?+dMHq!0F4~lTaP{FmcE%;?ye;2!;$q-#jquE zcIM4{Z{Gao_uj1AzqjYy$j0_9S_vaRpp|*FczWLNw%rl zj)W<)RflRC)ui{G!dv_5Jhoh4atsfQpdEgN*qa25JIMH%N9aalW3MnEm>Bo z)IiTl|Nhlf2qw8ZVDp1PRy{V@%~y6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