CultCache: element ids on every object-list element (C2a)

[CultElementId] marks a string member; the registry refuses a document type
whose list element type (union bases included) lacks one, naming the type and
member. A write mints a random 12-hex id for each unset id and refuses a
duplicate within one list. A store written before ids loads with ids minted in
memory from SHA-256(record key, element path), so every reader and every reload
agrees; they persist on the store's first write. CultCache.MintElementIds()
rewrites the records whose ids exist only in memory.

CultLib's own list-element types gain an id (Geometry, Mesh body, discovery,
entity prefab). CultMeshCdnChunkRef and the CultWitness* elements are pinned by
cross-runtime vectors and are left alone; see the C2a report.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
x 2026-09-29 12:31:12 +02:00
commit 0d2645d056
7 changed files with 646 additions and 0 deletions

View file

@ -60,6 +60,10 @@ namespace GameCult.Geometry
[MessagePackObject]
public sealed class CultGeometryDomainNode
{
[Key(7)]
[CultElementId]
public string Id { get; set; } = string.Empty;
[Key(0)]
public string Name { get; set; } = string.Empty;
@ -105,6 +109,10 @@ namespace GameCult.Geometry
[MessagePackObject]
public sealed class CultGeometryFeatureClaim
{
[Key(8)]
[CultElementId]
public string Id { get; set; } = string.Empty;
[Key(0)]
public string Name { get; set; } = string.Empty;
@ -261,6 +269,10 @@ namespace GameCult.Geometry
[MessagePackObject]
public sealed class CultGeometryContributionRow
{
[Key(13)]
[CultElementId]
public string Id { get; set; } = string.Empty;
[Key(0)]
public string DomainKey { get; set; } = string.Empty;