refactor(battle-node): remove ScriptedBotParticipant and dev-affordance wiring
Deletes the scripted opponent and every entry point that created a BattleType.Scripted session (the ?scripted=1 query opt-in, the SoloDefaultsToScripted toggle, the resolver short-circuit, the WS handler case, the bridge validation arm). Real two-client PvP and the Bot matchmaking-timeout fallback are untouched. ResolveAsync drops its scriptedOptIn parameter. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -12,9 +12,8 @@ namespace SVSim.UnitTests.BattleNode.Sessions;
|
||||
/// <summary>
|
||||
/// Audit Md11 — confirms <see cref="BattleSession.RunAsync"/> drops the per-RealParticipant
|
||||
/// <see cref="SVSim.BattleNode.Reliability.OutboundSequencer"/> archive when the session
|
||||
/// terminates. The Scripted bot has no outbound archive of its own, so the test uses a
|
||||
/// Scripted session (one Real, one ScriptedBot) and asserts only the Real side's archive
|
||||
/// is cleared.
|
||||
/// terminates. The NoOp bot has no outbound archive of its own, so the test uses a Bot
|
||||
/// session (one Real, one NoOpBot) and asserts only the Real side's archive is cleared.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class BattleSessionTerminateCascadeTests
|
||||
@@ -25,7 +24,7 @@ public class BattleSessionTerminateCascadeTests
|
||||
var ws = new TestWebSocket();
|
||||
var real = new RealParticipant(
|
||||
ws, viewerId: 1, MakeFakeContext(), NullLogger<RealParticipant>.Instance);
|
||||
var bot = new ScriptedBotParticipant();
|
||||
var bot = new NoOpBotParticipant();
|
||||
|
||||
// Pre-load the archive so we can prove it was cleared (not just empty).
|
||||
real.Outbound.AssignAndArchive(MakeEnvelope(NetworkBattleUri.Matched));
|
||||
@@ -33,7 +32,7 @@ public class BattleSessionTerminateCascadeTests
|
||||
Assume.That(real.Outbound.Archive.Count, Is.EqualTo(2), "Precondition: archive populated.");
|
||||
|
||||
var session = new BattleSession(
|
||||
battleId: "test-bid", type: BattleType.Scripted,
|
||||
battleId: "test-bid", type: BattleType.Bot,
|
||||
a: real, b: bot, log: NullLogger<BattleSession>.Instance);
|
||||
|
||||
// Drive RunAsync to completion: closing the incoming side causes
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
using SVSim.BattleNode.Bridge;
|
||||
using SVSim.BattleNode.Sessions;
|
||||
|
||||
@@ -14,7 +14,7 @@ public class InMemoryBattleSessionStoreTests
|
||||
[Test]
|
||||
public void RegisterThenGet_ReturnsRegisteredBattle()
|
||||
{
|
||||
var battle = new PendingBattle("bid-1", BattleType.Scripted, new BattlePlayer(906243102, FixtureCtx()), null);
|
||||
var battle = new PendingBattle("bid-1", BattleType.Bot, new BattlePlayer(906243102, FixtureCtx()), null);
|
||||
_store.RegisterPending(battle);
|
||||
|
||||
Assert.That(_store.TryGetPending("bid-1"), Is.EqualTo(battle));
|
||||
@@ -29,7 +29,7 @@ public class InMemoryBattleSessionStoreTests
|
||||
[Test]
|
||||
public void Remove_ReturnsTrueWhenPresent_FalseWhenAbsent()
|
||||
{
|
||||
_store.RegisterPending(new PendingBattle("bid", BattleType.Scripted, new BattlePlayer(1, FixtureCtx()), null));
|
||||
_store.RegisterPending(new PendingBattle("bid", BattleType.Bot, new BattlePlayer(1, FixtureCtx()), null));
|
||||
Assert.That(_store.RemovePending("bid"), Is.True);
|
||||
Assert.That(_store.RemovePending("bid"), Is.False);
|
||||
}
|
||||
@@ -37,8 +37,8 @@ public class InMemoryBattleSessionStoreTests
|
||||
[Test]
|
||||
public void Register_DuplicateBattleId_OverwritesPrior()
|
||||
{
|
||||
_store.RegisterPending(new PendingBattle("bid", BattleType.Scripted, new BattlePlayer(1, FixtureCtx()), null));
|
||||
_store.RegisterPending(new PendingBattle("bid", BattleType.Scripted, new BattlePlayer(2, FixtureCtx()), null));
|
||||
_store.RegisterPending(new PendingBattle("bid", BattleType.Bot, new BattlePlayer(1, FixtureCtx()), null));
|
||||
_store.RegisterPending(new PendingBattle("bid", BattleType.Bot, new BattlePlayer(2, FixtureCtx()), null));
|
||||
Assert.That(_store.TryGetPending("bid")!.P1.ViewerId, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
@@ -49,3 +49,4 @@ public class InMemoryBattleSessionStoreTests
|
||||
EmblemId: "701441011", DegreeId: "300003", FieldId: 43, IsOfficial: 0,
|
||||
BattleType: 11);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user