From 9698e0cff3944526cf142224847c017b9ffd7048 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 20:03:53 +0100 Subject: [PATCH] Address Aetheria SoA publications by generation --- Aetheria.State.Smoke/Program.cs | 23 ++++++++++++- Aetheria.State.Verify/Program.cs | 34 +++++++++++-------- Aetheria.Unity/Packages/manifest.json | 4 +-- Aetheria.Unity/Packages/packages-lock.json | 10 +++--- .../AetheriaRuntimeDaemonSoaFramePublisher.cs | 3 +- scripts/verify-aetheria-unity-client.ps1 | 8 ++--- 6 files changed, 55 insertions(+), 27 deletions(-) diff --git a/Aetheria.State.Smoke/Program.cs b/Aetheria.State.Smoke/Program.cs index fe58dee85..9670051a3 100644 --- a/Aetheria.State.Smoke/Program.cs +++ b/Aetheria.State.Smoke/Program.cs @@ -979,17 +979,38 @@ static async Task ProveDirectSoaPublicationPipeline() if (cache.Get(AetheriaRuntimeVerseRecordKeys.EveEntitySoaViewLatest) != null) throw new InvalidOperationException("Building a CultMesh body publication made the Eve view visible before commit."); + frame.FrameId++; + var next = await publisher.PublishAsync(publisher.BuildCurrentZoneEntities(frame)); + if (published.Body.RecordKey.Equals(next.Body.RecordKey)) + throw new InvalidOperationException("Distinct SoA generations collided on one CultMesh body publication key."); + await cache.UpsertAsync( published.Body, new CultRecordHandle(published.Body.RecordKey)); + await cache.UpsertAsync( + next.Body, + new CultRecordHandle(next.Body.RecordKey)); + await cache.UpsertAsync( + next.Body, + new CultRecordHandle( + CultMeshBodyPublicationDocument.CreateLatestRecordKey(next.Body.BodyId))); if (cache.Get(AetheriaRuntimeVerseRecordKeys.EveEntitySoaViewLatest) != null) throw new InvalidOperationException("Publishing the body record alone made the Eve view visible."); await cache.UpsertAsync( published.View, new CultRecordHandle(AetheriaRuntimeVerseRecordKeys.EveEntitySoaViewLatest)); - var body = cache.Get(published.Body.RecordKey) + var bodyHandle = new CultMeshBodyPublicationHandle( + published.View.Buffers[0].BufferId, + published.View.ProducerEpoch, + published.View.Sequence); + var body = cache.Get(bodyHandle.RecordKey) ?? throw new InvalidOperationException("Typed CultMesh body publication did not roundtrip through CultCache."); + bodyHandle.Validate(body); + var latest = cache.Get( + CultMeshBodyPublicationDocument.CreateLatestRecordKey(body.BodyId)); + if (latest == null || latest.Sequence != next.Body.Sequence || body.Sequence == latest.Sequence) + throw new InvalidOperationException("The view generation was substituted by the latest CultMesh body publication."); var view = cache.Get(AetheriaRuntimeVerseRecordKeys.EveEntitySoaViewLatest) ?? throw new InvalidOperationException("Typed Eve SoA view did not become visible after body publication."); if (body.PreferredLocal.TransportKind != CultMeshBodyTransportKind.SharedMemory || diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 2cb14bfc6..28ecfc1c6 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -686,9 +686,8 @@ static void RequireGameplaySourcePurity(string root) static void RequireSharedEvePackagesImportedFromEveRepo(string root) { - var manifestPath = Path.Combine(root, "Packages", "manifest.json"); - var lockPath = Path.Combine(root, "Packages", "packages-lock.json"); - var unityGeneratedProjectPath = Path.Combine(root, "GameCult.Aetheria.State.Unity.csproj"); + var manifestPath = Path.Combine(root, "Aetheria.Unity", "Packages", "manifest.json"); + var lockPath = Path.Combine(root, "Aetheria.Unity", "Packages", "packages-lock.json"); var unityAsmdefPath = Path.Combine( root, "Packages", @@ -758,9 +757,6 @@ static void RequireSharedEvePackagesImportedFromEveRepo(string root) var packageLock = File.Exists(lockPath) ? File.ReadAllText(lockPath) : throw new InvalidOperationException("Cannot verify shared Eve package ownership; packages-lock.json is missing."); - var unityGeneratedProject = File.Exists(unityGeneratedProjectPath) - ? File.ReadAllText(unityGeneratedProjectPath) - : throw new InvalidOperationException("Cannot verify shared Eve package ownership; GameCult.Aetheria.State.Unity.csproj is missing."); var unityAsmdef = File.Exists(unityAsmdefPath) ? File.ReadAllText(unityAsmdefPath) : throw new InvalidOperationException("Cannot verify shared Eve package ownership; GameCult.Aetheria.State.Unity.asmdef is missing."); @@ -794,8 +790,9 @@ static void RequireSharedEvePackagesImportedFromEveRepo(string root) var requiredManifestSymbols = new[] { - "\"org.gamecult.eve.surface\": \"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.1.0\"", - "\"org.gamecult.eve.unity-uitoolkit\": \"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-uitoolkit#eveunity-uitoolkit-v0.1.0\"" + "\"org.gamecult.cultlib\": \"https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.9\"", + "\"org.gamecult.eve.surface\": \"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.0\"", + "\"org.gamecult.eve.unity-scene\": \"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.2.1\"" }; var missingManifestSymbols = requiredManifestSymbols @@ -811,8 +808,9 @@ static void RequireSharedEvePackagesImportedFromEveRepo(string root) var requiredLockSymbols = new[] { - "eveunity-surface-v0.1.0", - "eveunity-uitoolkit-v0.1.0", + "cultlib-unity-v1.0.9", + "eveunity-surface-v0.2.0", + "eveunity-scene-v0.2.1", "\"source\": \"git\"" }; @@ -839,9 +837,7 @@ static void RequireSharedEvePackagesImportedFromEveRepo(string root) "The neighboring EveUnity repo is missing the shared Unity package roots Aetheria imports."); } - if (!unityGeneratedProject.Contains("", StringComparison.Ordinal) || - !unityGeneratedProject.Contains("GameCult.Eve.Surface.dll", StringComparison.Ordinal) || - !unityAsmdef.Contains("\"GameCult.Eve.Surface\"", StringComparison.Ordinal)) + if (!unityAsmdef.Contains("\"GameCult.Eve.Surface\"", StringComparison.Ordinal)) { throw new InvalidOperationException( "Aetheria.State.Unity no longer references the shared Eve surface package assembly."); @@ -11668,7 +11664,8 @@ static void RequireDaemonVersePublication(string root) "BuildCurrentZoneEntities(", "new CultMeshFrameBodyPublisher(", "new CultMeshNetworkBodyPublisher(", - "CultMeshBodyPublicationValidator.Validate(publication, BodyId)", + "new CultMeshBodyPublicationHandle(BodyId, publication.ProducerEpoch, publication.Sequence)", + ".Validate(publication)", "view.Buffers[0].BufferId, publication.BodyId", "view.Columns.Any(column => !string.Equals(column.BufferId, publication.BodyId", "ObserverWritable = false", @@ -11727,6 +11724,15 @@ static void RequireDaemonVersePublication(string root) { throw new InvalidOperationException("CultMesh body publication must precede the Eve entity SoA layout record."); } + if (!smoke.Contains("new CultMeshBodyPublicationHandle(", StringComparison.Ordinal) || + !smoke.Contains("published.View.ProducerEpoch", StringComparison.Ordinal) || + !smoke.Contains("published.View.Sequence", StringComparison.Ordinal) || + !smoke.Contains("CreateLatestRecordKey", StringComparison.Ordinal) || + !smoke.Contains("bodyHandle.Validate(body)", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "The Aetheria pipeline smoke must prove view N resolves its generation record while latest points at N+1."); + } if (File.Exists(legacyProviderAdvertisementPath)) { throw new InvalidOperationException( diff --git a/Aetheria.Unity/Packages/manifest.json b/Aetheria.Unity/Packages/manifest.json index 325af1865..86ce99a5f 100644 --- a/Aetheria.Unity/Packages/manifest.json +++ b/Aetheria.Unity/Packages/manifest.json @@ -6,9 +6,9 @@ "com.unity.modules.physics": "1.0.0", "com.unity.modules.uielements": "1.0.0", "com.unity.render-pipelines.universal": "17.4.0", - "org.gamecult.cultlib": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.8", + "org.gamecult.cultlib": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.9", "org.gamecult.eve.plugin-fields": "https://github.com/GameCult/EvePlugins.git?path=/plugins/eve-plugin-fields/unity/org.gamecult.eve.plugin-fields#eve-plugin-fields-unity-v0.1.1", "org.gamecult.eve.surface": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.0", - "org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.2.0" + "org.gamecult.eve.unity-scene": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.2.1" } } diff --git a/Aetheria.Unity/Packages/packages-lock.json b/Aetheria.Unity/Packages/packages-lock.json index e201d114e..1dac99e4b 100644 --- a/Aetheria.Unity/Packages/packages-lock.json +++ b/Aetheria.Unity/Packages/packages-lock.json @@ -119,11 +119,11 @@ } }, "org.gamecult.cultlib": { - "version": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.8", + "version": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.9", "depth": 0, "source": "git", "dependencies": {}, - "hash": "b73e04e01173ff0fc753727c0dc9e2eff2ce10c7" + "hash": "b1fcd95c255cd3057894678ff7d2dba28c5eb29e" }, "org.gamecult.eve.plugin-fields": { "version": "https://github.com/GameCult/EvePlugins.git?path=/plugins/eve-plugin-fields/unity/org.gamecult.eve.plugin-fields#eve-plugin-fields-unity-v0.1.1", @@ -142,16 +142,16 @@ "hash": "010ddeff90b70ce5278da373ce2dd0bb2c9eb9ac" }, "org.gamecult.eve.unity-scene": { - "version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.2.0", + "version": "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.2.1", "depth": 0, "source": "git", "dependencies": { - "org.gamecult.cultlib": "1.0.8", + "org.gamecult.cultlib": "1.0.9", "org.gamecult.eve.plugin-fields": "0.1.1", "org.gamecult.eve.surface": "0.2.0", "com.unity.mathematics": "1.3.2" }, - "hash": "010ddeff90b70ce5278da373ce2dd0bb2c9eb9ac" + "hash": "d9c1de9130419103d7421d95fb2c6789a0921f46" }, "com.unity.modules.assetbundle": { "version": "1.0.0", diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSoaFramePublisher.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSoaFramePublisher.cs index df66d8ea2..b01d75ba8 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSoaFramePublisher.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonSoaFramePublisher.cs @@ -197,7 +197,8 @@ namespace GameCult.Aetheria.State.Verse PreferredLocal = local, NetworkFallback = network }; - CultMeshBodyPublicationValidator.Validate(publication, BodyId); + new CultMeshBodyPublicationHandle(BodyId, publication.ProducerEpoch, publication.Sequence) + .Validate(publication); var view = AetheriaRuntimeEveEntitySoaProjection.Project(frame.View, generation); if (view.Buffers.Length != 1 || !string.Equals(view.Buffers[0].BufferId, publication.BodyId, StringComparison.Ordinal) || view.Columns.Any(column => !string.Equals(column.BufferId, publication.BodyId, StringComparison.Ordinal))) diff --git a/scripts/verify-aetheria-unity-client.ps1 b/scripts/verify-aetheria-unity-client.ps1 index 4135af9c9..77dd2111f 100644 --- a/scripts/verify-aetheria-unity-client.ps1 +++ b/scripts/verify-aetheria-unity-client.ps1 @@ -14,14 +14,14 @@ $manifest = Get-Content (Join-Path $ProjectPath "Packages/manifest.json") -Raw | $lock = Get-Content (Join-Path $ProjectPath "Packages/packages-lock.json") -Raw | ConvertFrom-Json $expected = @{ "org.gamecult.cultlib" = @( - "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.8", - "b73e04e01173ff0fc753727c0dc9e2eff2ce10c7") + "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.9", + "b1fcd95c255cd3057894678ff7d2dba28c5eb29e") "org.gamecult.eve.surface" = @( "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.0", "010ddeff90b70ce5278da373ce2dd0bb2c9eb9ac") "org.gamecult.eve.unity-scene" = @( - "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.2.0", - "010ddeff90b70ce5278da373ce2dd0bb2c9eb9ac") + "https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.2.1", + "d9c1de9130419103d7421d95fb2c6789a0921f46") } foreach ($packageName in $expected.Keys) {