From ac860dc21cfe3acf6933272c7b76ff847e17f79e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 28 Jun 2026 05:21:42 +0100 Subject: [PATCH] Remove AetheriaClient document read helpers --- Aetheria.State.Verify/Program.cs | 69 +++++-- .../Tests/DaemonRuntimeDocumentTests.cs | 31 ++-- .../Runtime/AetheriaEveSurfacePresenter.cs | 8 +- .../Runtime/AetheriaClient.cs | 173 ------------------ 4 files changed, 69 insertions(+), 212 deletions(-) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 129f220ae..23717dc29 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -3172,10 +3172,10 @@ static void RequireEveRuntimeBootstrap(string root) "ReadDaemonSurface(statePath)", "ReadDaemonSurface(stateBoot.StateFilePath)", "AetheriaUnityRuntimeClientProvider.ResolveClient(", - "DaemonGameSurfaceAsync()", - "DaemonGameTuiSurfaceAsync()", - "DaemonEditorSurfaceAsync()", - "DaemonEditorTuiSurfaceAsync()", + "client.State.Daemon.GameSurface.LatestAsync()", + "client.State.Daemon.GameTuiSurface.LatestAsync()", + "client.State.Daemon.EditorSurface.LatestAsync()", + "client.State.Daemon.EditorTuiSurface.LatestAsync()", "AetheriaRuntimeEveSurfaceAdapter.ToEveSurfaceDocument(", "private bool ShouldMountSurface(", "_mountedSurfaceVersion != surface.Version", @@ -3202,6 +3202,15 @@ static void RequireEveRuntimeBootstrap(string root) "Aetheria Eve presenter still mounts daemon surfaces through file-reader lookup instead of the shared AetheriaClient facade."); } + if (presenter.Contains(".DaemonGameSurfaceAsync()", StringComparison.Ordinal) || + presenter.Contains(".DaemonGameTuiSurfaceAsync()", StringComparison.Ordinal) || + presenter.Contains(".DaemonEditorSurfaceAsync()", StringComparison.Ordinal) || + presenter.Contains(".DaemonEditorTuiSurfaceAsync()", StringComparison.Ordinal)) + { + throw new InvalidOperationException( + "Aetheria Eve presenter still reads daemon surfaces through AetheriaClient compatibility helpers instead of managed document handles."); + } + if (presenter.Contains("new EveUiToolkitSurfaceLowerer", StringComparison.Ordinal)) { throw new InvalidOperationException( @@ -13448,27 +13457,25 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) string.Join(", ", missingDaemonStateFacadeSymbols)); } - var requiredDaemonClientFacadeSymbols = new[] + var requiredManagedClientAccessSymbols = new[] { + "public AetheriaClientState State => _state;", + "public AetheriaClientState Aetheria() => State;", + "public CultMeshDocumentHandle Document()", + "public Task LatestAsync()", + "public Observable Watch()", + "public CultMeshReactiveDocument Reactive(", "State.Daemon.LatestFrame.LatestAsync()", - "State.Daemon.LatestSoaView.LatestAsync()", - "State.Daemon.Health.LatestAsync()", - "State.Daemon.AuthorityPolicy.LatestAsync()", - "State.Daemon.GameSurface.LatestAsync()", - "State.Daemon.GameTuiSurface.LatestAsync()", - "State.Daemon.EditorSurface.LatestAsync()", - "State.Daemon.EditorTuiSurface.LatestAsync()", - "State.Starbridge.Scenario.LatestAsync()", - "State.Starbridge.Session.LatestAsync()" + "State.Daemon.LatestSoaView.LatestAsync()" }; - var missingDaemonClientFacadeSymbols = requiredDaemonClientFacadeSymbols + var missingManagedClientAccessSymbols = requiredManagedClientAccessSymbols .Where(symbol => !aetheriaClient.Contains(symbol, StringComparison.Ordinal)) .ToArray(); - if (missingDaemonClientFacadeSymbols.Length > 0) + if (missingManagedClientAccessSymbols.Length > 0) { throw new InvalidOperationException( - "AetheriaClient daemon compatibility methods must read managed typed state documents: " + - string.Join(", ", missingDaemonClientFacadeSymbols)); + "AetheriaClient must expose managed typed document access instead of document-specific compatibility readers: " + + string.Join(", ", missingManagedClientAccessSymbols)); } var forbiddenDaemonClientBypassSymbols = new[] @@ -13489,7 +13496,31 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root) "public async Task> LoadoutTemplatesAsync()", "scenario ??= await _verse.GetStarbridgeScenarioAsync()", "session ??= await _verse.GetStarbridgeSessionAsync()", - "var frame = await _verse.GetLatestFrameAsync()" + "var frame = await _verse.GetLatestFrameAsync()", + "public async Task LatestAuthoritativeRunFrameAsync()", + "public async Task MapViewportAsync(", + "public async Task ObjectsViewportAsync(", + "public async Task GravityViewportAsync(", + "public async Task RenderSplatsViewportAsync(", + "public async Task AssetManifestAsync()", + "public async Task CurrentZoneAsync()", + "public async Task CurrentEntityAsync()", + "public async Task CurrentDockingAsync()", + "public async Task ZoneContactsAsync()", + "public async Task StationRefitAsync()", + "public async Task SectorMapAsync()", + "public async Task ZoneDetailsAsync(", + "public async Task ZoneRenderAsync()", + "public async Task StarbridgeSessionSummaryAsync(", + "public async Task SelectedObjectAsync(", + "public async Task InventoryAsync(", + "public async Task DaemonHealthAsync()", + "public async Task AuthorityStatusAsync()", + "public async Task SoaViewAsync()", + "public async Task DaemonGameSurfaceAsync()", + "public async Task DaemonGameTuiSurfaceAsync()", + "public async Task DaemonEditorSurfaceAsync()", + "public async Task DaemonEditorTuiSurfaceAsync()" }; var daemonClientBypassHits = forbiddenDaemonClientBypassSymbols .Where(symbol => aetheriaClient.Contains(symbol, StringComparison.Ordinal)) diff --git a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs index a483b7a76..7fea9b431 100644 --- a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs +++ b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs @@ -204,14 +204,13 @@ public class DaemonRuntimeDocumentTests .GetResult(); using var zoneRenderReactive = client.State .Reactive(); - var legacyCurrentEntity = client.CurrentEntityAsync().GetAwaiter().GetResult(); var legacyObserved = client.ObserveAsync().GetAwaiter().GetResult(); - var legacyAuthoritativeFrame = client.LatestAuthoritativeRunFrameAsync().GetAwaiter().GetResult(); - var legacyGameSurface = client.DaemonGameSurfaceAsync().GetAwaiter().GetResult(); - var legacyGameTuiSurface = client.DaemonGameTuiSurfaceAsync().GetAwaiter().GetResult(); - var legacyEditorSurface = client.DaemonEditorSurfaceAsync().GetAwaiter().GetResult(); - var legacyEditorTuiSurface = client.DaemonEditorTuiSurfaceAsync().GetAwaiter().GetResult(); - var legacyAuthorityStatus = client.AuthorityStatusAsync().GetAwaiter().GetResult(); + var observedAuthoritativeFrame = client.State.Daemon.LatestFrame.LatestAsync().GetAwaiter().GetResult(); + var gameSurface = client.State.Daemon.GameSurface.LatestAsync().GetAwaiter().GetResult(); + var gameTuiSurface = client.State.Daemon.GameTuiSurface.LatestAsync().GetAwaiter().GetResult(); + var editorSurface = client.State.Daemon.EditorSurface.LatestAsync().GetAwaiter().GetResult(); + var editorTuiSurface = client.State.Daemon.EditorTuiSurface.LatestAsync().GetAwaiter().GetResult(); + var authorityStatus = client.State.Daemon.AuthorityPolicy.LatestAsync().GetAwaiter().GetResult(); var dockingState = client.Aetheria() .DockingState .LatestAsync() @@ -264,14 +263,15 @@ public class DaemonRuntimeDocumentTests Assert.AreEqual(frame.FrameId, latestFrame.FrameId); Assert.AreEqual(frame.FrameId, latestFrameByType.FrameId); Assert.AreEqual(frame.FrameId, legacyObserved.Frame.FrameId); - Assert.AreEqual(frame.FrameId, legacyAuthoritativeFrame.FrameId); - Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, legacyGameSurface.Surface.Id); - Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, legacyGameTuiSurface.Surface.Id); - Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, legacyEditorSurface.Surface.Id); - Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, legacyEditorTuiSurface.Surface.Id); - Assert.IsNotNull(legacyAuthorityStatus); - Assert.AreEqual(AetheriaRuntimeVerseAuthoritySchemas.Policy, legacyAuthorityStatus!.Schema); - Assert.AreEqual(authorityPolicy.HostRuntimeId, legacyAuthorityStatus.HostRuntimeId); + Assert.AreEqual(frame.FrameId, observedAuthoritativeFrame.FrameId); + Assert.IsTrue(observedAuthoritativeFrame.IsAuthoritative); + Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, gameSurface.Surface.Id); + Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, gameTuiSurface.Surface.Id); + Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, editorSurface.Surface.Id); + Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, editorTuiSurface.Surface.Id); + Assert.IsNotNull(authorityStatus); + Assert.AreEqual(AetheriaRuntimeVerseAuthoritySchemas.Policy, authorityStatus!.Schema); + Assert.AreEqual(authorityPolicy.HostRuntimeId, authorityStatus.HostRuntimeId); Assert.AreEqual(AetheriaRuntimeCatalogSnapshot.SchemaId, client.State.Catalog.Sources.Last().SchemaId); Assert.GreaterOrEqual(catalog.Items.Count, 0); Assert.AreEqual(AetheriaRuntimePlayerSettingsDocument.SchemaId, playerSettings.Schema); @@ -289,7 +289,6 @@ public class DaemonRuntimeDocumentTests Assert.AreEqual(AetheriaRuntimeDaemonSchemas.ZoneRender, zoneRenderReactive.Current.Schema); Assert.AreEqual(currentEntity.EntityKey, currentEntityByType.EntityKey); Assert.AreEqual(currentEntity.EntityKey, currentEntityFromClientType.EntityKey); - Assert.AreEqual(legacyCurrentEntity.EntityKey, currentEntity.EntityKey); Assert.AreEqual(currentEntity.EntityKey, dockingState.CurrentEntityKey); Assert.AreEqual("", dockingState.DockParentEntityKey); Assert.AreEqual(-1, dockingState.DockingBayIndex); diff --git a/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs b/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs index b3cbf4a62..ac5d85e7f 100644 --- a/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs +++ b/Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs @@ -132,16 +132,16 @@ namespace GameCult.Aetheria.EveRuntime private global::Aetheria.State.Documents.EveSurfaceState? ReadDaemonSurfaceState(AetheriaClient client) { if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, StringComparison.Ordinal)) - return client.DaemonGameSurfaceAsync().GetAwaiter().GetResult(); + return client.State.Daemon.GameSurface.LatestAsync().GetAwaiter().GetResult(); if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal)) - return client.DaemonGameTuiSurfaceAsync().GetAwaiter().GetResult(); + return client.State.Daemon.GameTuiSurface.LatestAsync().GetAwaiter().GetResult(); if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, StringComparison.Ordinal)) - return client.DaemonEditorSurfaceAsync().GetAwaiter().GetResult(); + return client.State.Daemon.EditorSurface.LatestAsync().GetAwaiter().GetResult(); if (string.Equals(surfaceId, AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, StringComparison.Ordinal)) - return client.DaemonEditorTuiSurfaceAsync().GetAwaiter().GetResult(); + return client.State.Daemon.EditorTuiSurface.LatestAsync().GetAwaiter().GetResult(); return null; } diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClient.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClient.cs index 63dba1eab..e95df742d 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClient.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaClient.cs @@ -158,179 +158,6 @@ namespace GameCult.Aetheria.State.Verse entityKey ?? ""); } - public async Task LatestAuthoritativeRunFrameAsync() - { - ThrowIfDisposed(); - var frame = await State.Daemon.LatestFrame.LatestAsync().ConfigureAwait(false); - if (frame == null || - !frame.IsAuthoritative || - frame.Run == null || - frame.Run.Zones == null || - frame.Run.Zones.Count == 0) - { - return null; - } - - return frame; - } - - public async Task MapViewportAsync( - AetheriaRuntimeRtsViewportBounds viewport) - { - ThrowIfDisposed(); - return await State.Viewports.Map(viewport).LatestAsync().ConfigureAwait(false); - } - - public async Task ObjectsViewportAsync( - AetheriaRuntimeRtsViewportBounds viewport) - { - ThrowIfDisposed(); - return await State.Viewports.Objects(viewport).LatestAsync().ConfigureAwait(false); - } - - public async Task GravityViewportAsync( - AetheriaRuntimeRtsViewportBounds viewport) - { - ThrowIfDisposed(); - return await State.Viewports.Gravity(viewport).LatestAsync().ConfigureAwait(false); - } - - public async Task RenderSplatsViewportAsync( - AetheriaRuntimeRtsViewportBounds viewport) - { - ThrowIfDisposed(); - return await State.Viewports.RenderSplats(viewport).LatestAsync().ConfigureAwait(false); - } - - public async Task AssetManifestAsync() - { - ThrowIfDisposed(); - var frame = await RequireFrameAsync().ConfigureAwait(false); - return AetheriaRuntimeAssets.ProjectManifest( - State.Catalog.Latest(), - frame.Run?.RunId ?? ""); - } - - public async Task CurrentZoneAsync() - { - ThrowIfDisposed(); - return await State.Current.Zone.LatestAsync().ConfigureAwait(false); - } - - public async Task CurrentEntityAsync() - { - ThrowIfDisposed(); - return await State.Current.Entity.LatestAsync().ConfigureAwait(false); - } - - public async Task CurrentDockingAsync() - { - ThrowIfDisposed(); - return await State.Current.Docking.LatestAsync().ConfigureAwait(false); - } - - public async Task ZoneContactsAsync() - { - ThrowIfDisposed(); - return await State.ZoneContacts.LatestAsync().ConfigureAwait(false); - } - - public async Task StationRefitAsync() - { - ThrowIfDisposed(); - return await State.StationRefit.LatestAsync().ConfigureAwait(false); - } - - public async Task SectorMapAsync() - { - ThrowIfDisposed(); - return await State.SectorMap.LatestAsync().ConfigureAwait(false); - } - - public async Task ZoneDetailsAsync(int zoneIndex) - { - ThrowIfDisposed(); - return await State.Details.Zone(zoneIndex).LatestAsync().ConfigureAwait(false); - } - - public async Task ZoneRenderAsync() - { - ThrowIfDisposed(); - return await State.ZoneRender.LatestAsync().ConfigureAwait(false); - } - - public async Task StarbridgeSessionSummaryAsync( - AetheriaRuntimeStarbridgeScenarioDocument? scenario = null, - AetheriaRuntimeStarbridgeSessionDocument? session = null) - { - ThrowIfDisposed(); - if (scenario == null && session == null) - return await State.Starbridge.Summary.LatestAsync().ConfigureAwait(false); - - var frame = await RequireFrameAsync().ConfigureAwait(false); - scenario ??= await State.Starbridge.Scenario.LatestAsync().ConfigureAwait(false); - session ??= await State.Starbridge.Session.LatestAsync().ConfigureAwait(false); - return AetheriaRuntimeStarbridgeProjection.ProjectSessionSummary( - frame, - scenario, - session, - State.Catalog.Latest()); - } - - public async Task SelectedObjectAsync(int entityIndex) - { - ThrowIfDisposed(); - return await State.Details.SelectedObject(entityIndex).LatestAsync().ConfigureAwait(false); - } - - public async Task InventoryAsync(int entityIndex) - { - ThrowIfDisposed(); - return await State.Details.Inventory(entityIndex).LatestAsync().ConfigureAwait(false); - } - - public async Task DaemonHealthAsync() - { - ThrowIfDisposed(); - return await State.Daemon.Health.LatestAsync().ConfigureAwait(false); - } - - public async Task AuthorityStatusAsync() - { - ThrowIfDisposed(); - return await State.Daemon.AuthorityPolicy.LatestAsync().ConfigureAwait(false); - } - - public async Task SoaViewAsync() - { - ThrowIfDisposed(); - return await State.Daemon.LatestSoaView.LatestAsync().ConfigureAwait(false); - } - - public async Task DaemonGameSurfaceAsync() - { - ThrowIfDisposed(); - return await State.Daemon.GameSurface.LatestAsync().ConfigureAwait(false); - } - - public async Task DaemonGameTuiSurfaceAsync() - { - ThrowIfDisposed(); - return await State.Daemon.GameTuiSurface.LatestAsync().ConfigureAwait(false); - } - - public async Task DaemonEditorSurfaceAsync() - { - ThrowIfDisposed(); - return await State.Daemon.EditorSurface.LatestAsync().ConfigureAwait(false); - } - - public async Task DaemonEditorTuiSurfaceAsync() - { - ThrowIfDisposed(); - return await State.Daemon.EditorTuiSurface.LatestAsync().ConfigureAwait(false); - } - public Func CreateEveSurfaceStateRefResolver() { ThrowIfDisposed();