refactor(app): compose session and player startup
Move streaming, live-session, hydration, local-player, combat, and teleport construction behind the typed Phase-7 boundary. Add exact-owner runtime bindings and focused spawn-claim classification so partial startup rolls back without retaining old session targets while preserving the accepted construction and frame dependencies. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
3573da12e1
commit
7771c07fb6
31 changed files with 1759 additions and 532 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using AcDream.App.Diagnostics;
|
||||
using AcDream.App.Net;
|
||||
using AcDream.App.Rendering;
|
||||
using AcDream.UI.Abstractions;
|
||||
|
||||
|
|
@ -8,6 +9,24 @@ namespace AcDream.App.Tests.Rendering;
|
|||
|
||||
public sealed class DevToolsFramePresenterTests
|
||||
{
|
||||
[Fact]
|
||||
public void CommandBusOwnedBindingReleasesExactlyAndAllowsRebind()
|
||||
{
|
||||
var source = new DevToolsCommandBusSource();
|
||||
using var first = new LiveSessionController();
|
||||
using var second = new LiveSessionController();
|
||||
|
||||
IDisposable firstBinding = source.BindOwned(first);
|
||||
Assert.Same(first.Commands, source.Current);
|
||||
Assert.Throws<InvalidOperationException>(() => source.BindOwned(second));
|
||||
|
||||
firstBinding.Dispose();
|
||||
using IDisposable secondBinding = source.BindOwned(second);
|
||||
firstBinding.Dispose();
|
||||
|
||||
Assert.Same(second.Commands, source.Current);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Frame_PreservesBeginThenMenuPanelsAndDrawDataOrder()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,6 +61,25 @@ public sealed class DevToolsRuntimeSourcesTests
|
|||
Assert.Throws<ObjectDisposedException>(() => source.Bind(first));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PlayerModeOwnedBindingReleasesExactlyAndAllowsRebind()
|
||||
{
|
||||
var source = new DeferredDevToolsPlayerModeCommands();
|
||||
var first = new PlayerModeTarget();
|
||||
var second = new PlayerModeTarget();
|
||||
|
||||
IDisposable firstBinding = source.BindOwned(first);
|
||||
Assert.Throws<InvalidOperationException>(() => source.BindOwned(second));
|
||||
|
||||
firstBinding.Dispose();
|
||||
using IDisposable secondBinding = source.BindOwned(second);
|
||||
firstBinding.Dispose();
|
||||
source.ToggleFlyOrChase();
|
||||
|
||||
Assert.Equal(0, first.ToggleCalls);
|
||||
Assert.Equal(1, second.ToggleCalls);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WorldCountSlotCannotFreezeOrReleaseTheWrongWorld()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,14 +39,24 @@ public sealed class GameWindowRenderLeafCompositionTests
|
|||
[Fact]
|
||||
public void Composition_transfers_portal_tunnel_before_constructing_frame_borrowers()
|
||||
{
|
||||
string phase = File.ReadAllText(Path.Combine(
|
||||
FindRepoRoot(),
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Composition",
|
||||
"SessionPlayerComposition.cs"));
|
||||
string source = GameWindowSource();
|
||||
|
||||
AssertAppearsInOrder(
|
||||
phase,
|
||||
"d.PortalTunnelFallback.Transfer(",
|
||||
"new LocalPlayerTeleportController(",
|
||||
"new LocalPlayerTeleportPresentation(portalTunnel)",
|
||||
"d.TeleportSink.BindOwned(localTeleport)",
|
||||
"_publication.PublishSessionPlayer(result);");
|
||||
AssertAppearsInOrder(
|
||||
source,
|
||||
"_portalTunnelFallback.Transfer(",
|
||||
"new AcDream.App.Streaming.LocalPlayerTeleportController(",
|
||||
"new AcDream.App.Streaming.LocalPlayerTeleportPresentation(",
|
||||
"_localPlayerTeleportSink.Bind(_localPlayerTeleport);",
|
||||
"new SessionPlayerCompositionPhase(",
|
||||
"new AcDream.App.Rendering.LocalPlayerTeleportRenderStateSource(",
|
||||
"new AcDream.App.Rendering.RenderFrameResourceController(",
|
||||
"new AcDream.App.Rendering.PrivatePresentationRenderer(",
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ public sealed class GameWindowSlice8BoundaryTests
|
|||
"private AcDream.App.Net.LiveSessionHost");
|
||||
string body = MethodBody(
|
||||
"private void OnFramebufferResize(",
|
||||
"private (uint Claim, bool Unhydratable)? _spawnClaimRangeMemo;");
|
||||
"private void OnClosing()");
|
||||
|
||||
Assert.Contains("=> _framebufferResize.Resize(newSize);", body, StringComparison.Ordinal);
|
||||
Assert.DoesNotContain("Viewport(", body, StringComparison.Ordinal);
|
||||
|
|
@ -294,8 +294,18 @@ public sealed class GameWindowSlice8BoundaryTests
|
|||
"new SettingsDevToolsCompositionPhase(",
|
||||
"this).Compose(platform, hostInputCamera, contentEffectsAudio);",
|
||||
"new WorldRenderCompositionPhase(",
|
||||
"_runtimeSettings.BindRuntimeTargets(",
|
||||
"new SessionPlayerCompositionPhase(",
|
||||
"_liveSessionHost.Start(_options)");
|
||||
string sessionPhase = File.ReadAllText(Path.Combine(
|
||||
FindRepoRoot(),
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Composition",
|
||||
"SessionPlayerComposition.cs"));
|
||||
Assert.Contains(
|
||||
"d.Settings.BindRuntimeTargetsOwned(settingsTargets)",
|
||||
sessionPhase,
|
||||
StringComparison.Ordinal);
|
||||
string settingsPhase = File.ReadAllText(Path.Combine(
|
||||
FindRepoRoot(),
|
||||
"src",
|
||||
|
|
@ -320,7 +330,8 @@ public sealed class GameWindowSlice8BoundaryTests
|
|||
AssertAppearsInOrder(
|
||||
shutdown,
|
||||
"_runtimeSettings.UnbindViewModel()",
|
||||
"_runtimeSettings.UnbindRuntimeTargets",
|
||||
"new ResourceShutdownStage(\"frame borrowers\"",
|
||||
"bindings.Dispose();",
|
||||
"_retailUiLease.Dispose()",
|
||||
"_streamer?.Dispose()",
|
||||
"_wbDrawDispatcher?.Dispose()",
|
||||
|
|
@ -425,7 +436,6 @@ public sealed class GameWindowSlice8BoundaryTests
|
|||
"pointer.Dispose();",
|
||||
"new ResourceShutdownStage(\"session dependents\"",
|
||||
"pointer.ReleaseMouseLookAfterSessionRetirement();",
|
||||
"pointer.UnbindGameplayFrame(gameplayFrame);",
|
||||
"_cameraPointerInput = null;");
|
||||
AssertAppearsInOrder(
|
||||
dispose,
|
||||
|
|
@ -472,6 +482,12 @@ public sealed class GameWindowSlice8BoundaryTests
|
|||
"Composition",
|
||||
"WorldRenderComposition.cs"));
|
||||
string livePhase = LivePresentationSource();
|
||||
string sessionPhase = File.ReadAllText(Path.Combine(
|
||||
FindRepoRoot(),
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Composition",
|
||||
"SessionPlayerComposition.cs"));
|
||||
|
||||
AssertAppearsInOrder(
|
||||
livePhase,
|
||||
|
|
@ -483,8 +499,13 @@ public sealed class GameWindowSlice8BoundaryTests
|
|||
load,
|
||||
"new WorldRenderCompositionPhase(",
|
||||
"new LivePresentationCompositionPhase(",
|
||||
"_portalTunnelFallback.Transfer(",
|
||||
"new SessionPlayerCompositionPhase(",
|
||||
"_frameGraphs.Publish(updateFrameOrchestrator, renderFrameOrchestrator);");
|
||||
AssertAppearsInOrder(
|
||||
sessionPhase,
|
||||
"d.PortalTunnelFallback.Transfer(",
|
||||
"new LocalPlayerTeleportController(",
|
||||
"_publication.PublishSessionPlayer(result);");
|
||||
AssertAppearsInOrder(
|
||||
worldPhase,
|
||||
"lifetime.AcquireTerrainAtlas(",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue