Remove file-backed observed daemon reader

This commit is contained in:
Meta Vens 2026-06-28 04:41:12 +01:00
commit f5af83c54d
3 changed files with 39 additions and 50 deletions

View file

@ -9536,6 +9536,13 @@ static void RequireAetheriaRuntimeVerseClientContract(string root)
"AetheriaRuntimeVerseClient still routes Eve state-ref resolution through the file-backed compatibility reader.");
}
if (stateReader.Contains("TryReadObservedDaemonState", StringComparison.Ordinal) ||
stateReader.Contains("TryReadDaemonSoaView(", StringComparison.Ordinal))
{
throw new InvalidOperationException(
"AetheriaRuntimeStateReader still exposes observed daemon frame/SoA acquisition that belongs on managed AetheriaClient documents.");
}
var starbridgeSummaryStart = client.IndexOf(
"async Task<AetheriaRuntimeStarbridgeSessionSummaryDocument> ProjectStarbridgeSummaryAsync",
StringComparison.Ordinal);
@ -13061,6 +13068,13 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
"Shared runtime state reader still exposes file-backed entity snapshot reads; use daemon zone-render EntitySnapshots documents.");
}
if (runtimeStateReader.Contains("TryReadObservedDaemonState", StringComparison.Ordinal) ||
runtimeStateReader.Contains("TryReadDaemonSoaView(", StringComparison.Ordinal))
{
throw new InvalidOperationException(
"Shared runtime state reader still exposes observed daemon frame/SoA file reads; use AetheriaClient.ObserveAsync and managed typed documents.");
}
if (runtimeStateReader.Contains("ReadRunStates", StringComparison.Ordinal) ||
runtimeStateReader.Contains("ReadZoneStates", StringComparison.Ordinal))
{

View file

@ -2123,7 +2123,7 @@ public class DaemonRuntimeDocumentTests
}
[Test]
public void StateReaderReadsObservedDaemonStateWithSoaView()
public void AetheriaClientObservesManagedDaemonStateWithSoaView()
{
var statePath = Path.Combine(
Path.GetTempPath(),
@ -2174,11 +2174,15 @@ public class DaemonRuntimeDocumentTests
});
PublishLatestFrameThroughVerseClient(statePath, frame);
AetheriaRuntimeDaemonSoaViewStore.PublishView(statePath, soaView);
PublishLatestSoaViewThroughVerseClient(statePath, soaView);
var read = AetheriaRuntimeStateReader.TryReadObservedDaemonState(statePath, out var observed);
using var client = AetheriaClient
.OpenAsync(statePath, "unity-observer-test", pullOnOpen: true)
.GetAwaiter()
.GetResult();
var observed = client.ObserveAsync().GetAwaiter().GetResult();
Assert.IsTrue(read);
Assert.IsNotNull(observed);
Assert.IsTrue(observed.IsAuthoritative);
Assert.IsTrue(observed.HasSoaView);
Assert.AreEqual("daemon-run", observed.Run.RunId);
@ -2190,24 +2194,6 @@ public class DaemonRuntimeDocumentTests
Assert.IsFalse(observed.SoaView.Buffers[0].ObserverWritable);
}
[Test]
public void StateReaderReportsMissingObservedDaemonState()
{
var statePath = Path.Combine(
Path.GetTempPath(),
"aetheria-observed-daemon-state-tests",
Path.GetRandomFileName(),
"missing-state.cc");
var read = AetheriaRuntimeStateReader.TryReadObservedDaemonState(statePath, out var observed);
Assert.IsFalse(read);
Assert.IsFalse(observed.IsAuthoritative);
Assert.IsFalse(observed.HasSoaView);
Assert.AreEqual("missing", observed.Frame.StateSource);
Assert.AreEqual(AetheriaRuntimeStateBoundary.GetDaemonFramePath(statePath), observed.FramePath);
}
[Test]
public void ObservationCursorTracksFrameAndSoaGenerationChanges()
{
@ -4166,6 +4152,23 @@ public class DaemonRuntimeDocumentTests
.GetResult();
}
private static void PublishLatestSoaViewThroughVerseClient(
string statePath,
AetheriaRuntimeDaemonSoaViewDocument soaView)
{
using var client = AetheriaRuntimeVerseClient
.OpenAsync(statePath, "daemon-soa-view-test", startServer: false, pullOnOpen: true)
.GetAwaiter()
.GetResult();
client.LatestSoaView()
.ReplaceAsync(soaView)
.GetAwaiter()
.GetResult();
client.FlushAsync()
.GetAwaiter()
.GetResult();
}
private static void PublishVerseAuthorityPolicyThroughVerseClient(
string statePath,
AetheriaRuntimeVerseAuthorityPolicyDocument policy)

View file

@ -22,34 +22,6 @@ namespace GameCult.Aetheria.State.Verse
return AetheriaRuntimeDaemonFrameStore.TryReadFrame(stateFilePath, out frame);
}
public static bool TryReadDaemonSoaView(string stateFilePath, out AetheriaRuntimeDaemonSoaViewDocument view)
{
return AetheriaRuntimeDaemonSoaViewStore.TryReadView(stateFilePath, out view);
}
public static bool TryReadObservedDaemonState(
string stateFilePath,
out AetheriaRuntimeObservedDaemonState observed)
{
if (!AetheriaRuntimeDaemonFrameStore.TryReadFrame(stateFilePath, out var frame))
{
observed = new AetheriaRuntimeObservedDaemonState(
new AetheriaRuntimeDaemonFrameDocument { IsAuthoritative = false, StateSource = "missing" },
null,
AetheriaRuntimeDaemonFrameStore.GetFramePath(stateFilePath),
AetheriaRuntimeDaemonSoaViewStore.GetViewPath(stateFilePath));
return false;
}
AetheriaRuntimeDaemonSoaViewStore.TryReadView(stateFilePath, out var soaView);
observed = new AetheriaRuntimeObservedDaemonState(
frame,
string.Equals(soaView.Schema, AetheriaRuntimeDaemonSchemas.SoaView, StringComparison.Ordinal) ? soaView : null,
AetheriaRuntimeDaemonFrameStore.GetFramePath(stateFilePath),
AetheriaRuntimeDaemonSoaViewStore.GetViewPath(stateFilePath));
return true;
}
public static EveSurfaceDocument? ReadEveSurface(string stateFilePath, string surfaceId)
{
if (string.Equals(surfaceId, AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, StringComparison.Ordinal) &&