test(battle-engine M13): best-effort emit-payload presence (Inconclusive => deferred to structural validation)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-06 12:37:24 -04:00
parent 73286ba78b
commit feb47f6437
2 changed files with 31 additions and 0 deletions

View File

@@ -57,6 +57,17 @@ namespace SVSim.BattleEngine.Tests
Assert.That(player.CemeteryList, Does.Contain(spell), "spell should land in the cemetery");
Assert.That(player.ClassAndInPlayCardList, Does.Not.Contain(spell), "a spell does not occupy the board");
});
// Best-effort (F-E-7): with CurrentMatchingStatus seeded non-Disconnected (NewNetworkEmitBattle),
// the flow reaches stockEmitMessageMgr.StockData(info); read it back. If the stock machinery is
// not drivable headless this milestone, this assertion is DEFERRED to structural validation
// (spec §6) — the OnEmit + no-throw + state checks above are the decisive O1 read on their own.
var agent = Wizard.ToolboxGame.RealTimeNetworkAgent;
var stocked = HeadlessEngineEnv.TryReadStockedEmitData(agent); // returns null if unreachable
if (stocked != null)
Assert.That(stocked, Is.Not.Empty, "the emitted dict should be stocked non-empty");
else
Assert.Inconclusive("payload-presence DEFERRED: stock-sequencer not drivable headless (spec §6)");
}
}
}

View File

@@ -434,6 +434,26 @@ namespace SVSim.BattleEngine.Tests
return (mgr, emitted);
}
// M13 Task 4 best-effort: read the emit payload back out of the agent's stock sequencer. With
// _notEmit=true (NewNetworkEmitBattle terminates the path that way), EmitMsgUriPack short-circuits
// BEFORE stockEmitMessageMgr.StockData (RealTimeNetworkAgent.cs:1438 vs :1461), so the stock is
// expected to be null/empty — return null on any null/throw so the test degrades to Inconclusive
// rather than failing. Field `stockEmitMessageMgr` (:103) + `GetSequenceAllData()`
// (StockEmitMgr.cs:81, returns List<Dictionary<string,object>>) verified against the copied engine.
public static System.Collections.IList TryReadStockedEmitData(RealTimeNetworkAgent agent)
{
try
{
var f = typeof(RealTimeNetworkAgent).GetField("stockEmitMessageMgr",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
var stock = f?.GetValue(agent);
if (stock == null) return null;
var m = stock.GetType().GetMethod("GetSequenceAllData");
return m?.Invoke(stock, null) as System.Collections.IList;
}
catch { return null; }
}
private static void SetField(object obj, string name, object value)
{
var f = obj.GetType().GetField(name,