Neutralize Unity runtime client fallback

This commit is contained in:
Meta Vens 2026-07-05 21:16:38 +01:00
commit e1506d4db0
3 changed files with 13 additions and 3 deletions

View file

@ -16102,6 +16102,7 @@ static void RequireUnityDoesNotCallSharedSimulationTicks(string root)
"org.gamecult.aetheria.state",
"Runtime",
"AetheriaRuntimeClientTargetStore.cs");
var runtimeClientProviderPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaUnityRuntimeClientProvider.cs");
var rtsLocalDocumentsPath = Path.Combine(root, "Aetheria.Rts.Web", "Electron", "aetheria-rts-local-documents.ts");
var authoritySmokePath = Path.Combine(root, "Aetheria.State.AuthoritySmoke", "Program.cs");
var freezePath = Path.Combine(root, "Aetheria.State.Freeze", "Program.cs");
@ -16129,6 +16130,9 @@ static void RequireUnityDoesNotCallSharedSimulationTicks(string root)
var clientTargetStore = File.Exists(clientTargetStorePath)
? File.ReadAllText(clientTargetStorePath)
: throw new InvalidOperationException("Cannot verify runtime-neutral client target authority; client target store is missing.");
var runtimeClientProvider = File.Exists(runtimeClientProviderPath)
? File.ReadAllText(runtimeClientProviderPath)
: throw new InvalidOperationException("Cannot verify runtime-neutral client target authority; Unity runtime client provider is missing.");
var rtsLocalDocuments = File.Exists(rtsLocalDocumentsPath)
? File.ReadAllText(rtsLocalDocumentsPath)
: throw new InvalidOperationException("Cannot verify daemon projectile authority; Electron local projection is missing.");
@ -16269,10 +16273,12 @@ static void RequireUnityDoesNotCallSharedSimulationTicks(string root)
}
if (stateBoundary.Contains("UnityRuntimeIdOverrideEnvironmentVariable", StringComparison.Ordinal) ||
stateBoundary.Contains("AETHERIA_UNITY_RUNTIME_ID", StringComparison.Ordinal) ||
clientTargetStore.Contains("raven-unity", StringComparison.Ordinal))
clientTargetStore.Contains("raven-unity", StringComparison.Ordinal) ||
runtimeClientProvider.Contains("raven-unity", StringComparison.Ordinal) ||
!runtimeClientProvider.Contains("AetheriaRuntimeStateBoundary.DefaultClientRuntimeId", StringComparison.Ordinal))
{
throw new InvalidOperationException(
"Aetheria shared client-target authority must use generic runtime identity only; Unity-specific defaults and environment fallbacks belong at the Unity edge.");
"Aetheria shared client-target authority must use generic runtime identity only; Unity-specific defaults and environment fallbacks must not survive as ambient provider defaults.");
}
var sharedRuntimeText = string.Join(

View file

@ -356,6 +356,8 @@ $renderSettingsBridge = Read-Text "Assets\Scripts\Gameplay\AetheriaUnityRenderSe
$cockpitHudShell = Read-Text "Assets\Scripts\Gameplay\AetheriaUnityCockpitHudShell.cs"
$gameplayBootShell = Read-Text "Assets\Scripts\Gameplay\AetheriaUnityGameplayBootShell.cs"
$sceneWiring = Read-Text "Assets\Scripts\Gameplay\AetheriaUnityGameplaySceneWiring.cs"
Assert-Contains $runtimeClientProvider "AetheriaRuntimeStateBoundary.DefaultClientRuntimeId" "Unity runtime provider must default unnamed readers to the shared client runtime identity."
Assert-NotContains $runtimeClientProvider "raven-unity" "Unity runtime provider must not preserve a Unity-branded ambient runtime id."
Assert-Contains $actionGameManager "private readonly AetheriaUnityPresentationEntityIndex _presentationEntityIndex" "ActionGameManager must keep observed entity adaptation behind an explicit helper."
Assert-Contains $actionGameManager "private AetheriaClientState _gameplayState;" "ActionGameManager must cache the managed CultMesh state handle for gameplay reads."
Assert-Contains $actionGameManager "AetheriaUnityRuntimeClientProvider.RuntimeState(""unity-action-game-manager"")" "ActionGameManager must grab gameplay state through the Unity runtime provider."

View file

@ -28,7 +28,9 @@ public static class AetheriaUnityRuntimeClientProvider
private static AetheriaClient ResolveClient(string stateFilePath, string runtimeId = "")
{
var effectiveRuntimeId = string.IsNullOrWhiteSpace(runtimeId) ? "raven-unity" : runtimeId;
var effectiveRuntimeId = string.IsNullOrWhiteSpace(runtimeId)
? AetheriaRuntimeStateBoundary.DefaultClientRuntimeId
: runtimeId;
var cacheKey = CacheKey(stateFilePath, effectiveRuntimeId);
if (RuntimeClients.TryGetValue(cacheKey, out var runtimeClient))
return runtimeClient;