refactor(engine-ambient): wrap residual UnitTests + delete EngineSessionGate

Step 7 of multi-instancing migration. Residual SVSim.UnitTests that touch
engine code directly are wrapped in TestBattleScope. EngineSessionGate is
deleted along with the _engineOwned bookkeeping in BattleSession; engine
setup is unconditional now that per-battle state is isolated on the ambient.
Gate-specific fallback branches in BattleSession.ShadowIngest are simplified.

Suite fully green (SVSim.UnitTests, SVSim.BattleEngine.Tests).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-07 22:43:18 -04:00
parent 8af1be6555
commit 9e93a7b198
6 changed files with 57 additions and 80 deletions

View File

@@ -26,9 +26,9 @@ namespace SVSim.UnitTests.BattleNode.Integration;
/// <para>Engine globals (<c>CardMaster</c>, <c>GameMgr</c>, <c>Wizard.Data</c>) are primed by
/// <c>SessionBattleEngine.Setup</c> itself (it calls <c>EngineGlobalInit.EnsureInitialized()</c>, which
/// loads the full cards.json from <c>AppContext.BaseDirectory/Data/cards.json</c>). The harness adds no
/// global init of its own. NOTE: unlike the live session, the harness does NOT acquire
/// <c>EngineSessionGate</c> — driving the engine directly bypasses it. One engine-backed battle at a
/// time is assumed within a test (the engine's process-global statics can't back two concurrently).</para>
/// global init of its own. Per-battle state is isolated via the engine's per-session
/// <c>BattleAmbientContext</c> (Task 7 of multi-instancing migration), so the historical
/// single-active-engine gate is gone — concurrent harnesses + sessions are now safe.</para>
/// </summary>
internal sealed class NodeNativeBattleHarness : IDisposable
{