refactor(battlenode): split BattleSessionPhase into HandshakePhase + SessionLifecycle
Behavior-preserving; 231 BattleNode tests green. One enum conflated two axes. Split: - HandshakePhase (per participant): AwaitingInitNetwork..AfterReady. On IHasHandshakePhase.Phase, FrameDispatchContext.SenderPhase, the handler gates. - SessionLifecycle (per battle): Active | Terminal. On the renamed BattleSessionState.Lifecycle (was SessionPhase, defaulting to a handshake value) and BattleSession.Lifecycle (was Phase). Reads are only != Terminal, so the Active default is behavior-identical. OpponentTurn was dead (never assigned) -> dropped. BattleSessionPhase deleted; the two axes can no longer be cross-assigned. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -97,7 +97,7 @@ public class RealParticipantTests
|
||||
var p = new RealParticipant(ws, viewerId: 1, FixtureCtx(),
|
||||
NullLogger<RealParticipant>.Instance);
|
||||
|
||||
Assert.That(p.Phase, Is.EqualTo(SVSim.BattleNode.Sessions.BattleSessionPhase.AwaitingInitNetwork));
|
||||
Assert.That(p.Phase, Is.EqualTo(SVSim.BattleNode.Sessions.HandshakePhase.AwaitingInitNetwork));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -108,9 +108,9 @@ public class RealParticipantTests
|
||||
NullLogger<RealParticipant>.Instance);
|
||||
|
||||
// Setter is `internal`; SVSim.UnitTests has InternalsVisibleTo on SVSim.BattleNode.
|
||||
p.Phase = SVSim.BattleNode.Sessions.BattleSessionPhase.AfterReady;
|
||||
p.Phase = SVSim.BattleNode.Sessions.HandshakePhase.AfterReady;
|
||||
|
||||
Assert.That(p.Phase, Is.EqualTo(SVSim.BattleNode.Sessions.BattleSessionPhase.AfterReady));
|
||||
Assert.That(p.Phase, Is.EqualTo(SVSim.BattleNode.Sessions.HandshakePhase.AfterReady));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -121,9 +121,9 @@ public class RealParticipantTests
|
||||
var a = new RealParticipant(wsA, viewerId: 1, FixtureCtx(), NullLogger<RealParticipant>.Instance);
|
||||
var b = new RealParticipant(wsB, viewerId: 2, FixtureCtx(), NullLogger<RealParticipant>.Instance);
|
||||
|
||||
a.Phase = SVSim.BattleNode.Sessions.BattleSessionPhase.AfterReady;
|
||||
a.Phase = SVSim.BattleNode.Sessions.HandshakePhase.AfterReady;
|
||||
|
||||
Assert.That(b.Phase, Is.EqualTo(SVSim.BattleNode.Sessions.BattleSessionPhase.AwaitingInitNetwork),
|
||||
Assert.That(b.Phase, Is.EqualTo(SVSim.BattleNode.Sessions.HandshakePhase.AwaitingInitNetwork),
|
||||
"B's Phase must not change when A's Phase is set.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user