refactor(app): make session start terminal
Move live-session startup and its existing diagnostics into the typed Phase-9 owner. GameWindow.OnLoad now ends immediately after that phase, so no callback binding, publication, or allocation can occur after the session becomes active. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
3628aeb520
commit
54244d31f1
11 changed files with 139 additions and 39 deletions
|
|
@ -0,0 +1,38 @@
|
|||
using AcDream.App.Composition;
|
||||
using AcDream.App.Net;
|
||||
|
||||
namespace AcDream.App.Tests.Composition;
|
||||
|
||||
public sealed class SessionStartCompositionTests
|
||||
{
|
||||
[Fact]
|
||||
public void DiagnosticsPreserveMissingCredentialAndFailureMessagesOnly()
|
||||
{
|
||||
var messages = new List<string>();
|
||||
|
||||
SessionStartCompositionPhase.Report(
|
||||
new LiveSessionStartResult(
|
||||
LiveSessionStartStatus.MissingCredentials),
|
||||
messages.Add);
|
||||
SessionStartCompositionPhase.Report(
|
||||
new LiveSessionStartResult(
|
||||
LiveSessionStartStatus.Failed,
|
||||
Error: new InvalidOperationException("boom")),
|
||||
messages.Add);
|
||||
SessionStartCompositionPhase.Report(
|
||||
new LiveSessionStartResult(LiveSessionStartStatus.Disabled),
|
||||
messages.Add);
|
||||
SessionStartCompositionPhase.Report(
|
||||
new LiveSessionStartResult(LiveSessionStartStatus.Connected),
|
||||
messages.Add);
|
||||
|
||||
Assert.Equal(2, messages.Count);
|
||||
Assert.Equal(
|
||||
"live: ACDREAM_LIVE set but TEST_USER/TEST_PASS missing; skipping",
|
||||
messages[0]);
|
||||
Assert.StartsWith(
|
||||
"live: session failed: System.InvalidOperationException: boom",
|
||||
messages[1],
|
||||
StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue