Establish the J1 presentation-independent contract with instance-scoped clocks and generations, immutable borrowed views, typed generation-gated commands, normalized ordered diagnostics, and teardown acknowledgements. Route graphical startup plus press-time selection, movement, and combat through focused App adapters over the exact existing owners without adding a queue or mirrored world. Validated by the Release solution build, 13 Runtime tests, 3,838 App tests with three existing skips, and the complete 8,424-test Release suite with five existing skips. Co-authored-by: Codex <codex@openai.com>
45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using AcDream.Runtime;
|
|
|
|
namespace AcDream.App.Composition;
|
|
|
|
internal sealed record SessionStartDependencies(
|
|
Action<string> Log);
|
|
|
|
/// <summary>
|
|
/// Terminal startup phase. Every callback, command target, and frame root is
|
|
/// already published when this owner asks the canonical session host to start.
|
|
/// </summary>
|
|
internal sealed class SessionStartCompositionPhase
|
|
: ISessionStartCompositionPhase<FrameRootResult>
|
|
{
|
|
private readonly SessionStartDependencies _dependencies;
|
|
|
|
public SessionStartCompositionPhase(SessionStartDependencies dependencies) =>
|
|
_dependencies = dependencies
|
|
?? throw new ArgumentNullException(nameof(dependencies));
|
|
|
|
public void Start(FrameRootResult frame)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(frame);
|
|
RuntimeSessionStartResult result =
|
|
frame.GameRuntime.Session.Start(frame.GameRuntime.Generation);
|
|
Report(result, _dependencies.Log);
|
|
}
|
|
|
|
internal static void Report(
|
|
RuntimeSessionStartResult result,
|
|
Action<string> log)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(log);
|
|
switch (result.Status)
|
|
{
|
|
case RuntimeSessionStartStatus.MissingCredentials:
|
|
log(
|
|
"live: ACDREAM_LIVE set but TEST_USER/TEST_PASS missing; skipping");
|
|
break;
|
|
case RuntimeSessionStartStatus.Failed:
|
|
log($"live: session failed: {result.Error}");
|
|
break;
|
|
}
|
|
}
|
|
}
|