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 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-27 19:01:16 +01:00
commit 9e698c86df
3 changed files with 15 additions and 7 deletions

View file

@ -36,6 +36,10 @@ public sealed class ParityTests
(cache.GetAll<AssetCatalog>().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();
}

View file

@ -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<GameCult.Thing.Contract.X>`. |
| `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.

Binary file not shown.