From 7d4da69f22993183f005f32bc43edfa7c4129ca6 Mon Sep 17 00:00:00 2001 From: gamer147 Date: Thu, 4 Jun 2026 23:06:44 -0400 Subject: [PATCH] =?UTF-8?q?refactor(battlenode):=20low-churn=20=C2=A7B/?= =?UTF-8?q?=C2=A7D/=C2=A7E/=C2=A7F=20quality=20cleanups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Behavior-preserving; 231 BattleNode tests green. - §D: MsgEnvelope.Try -> RetryAttempt (drops keyword-escape; wire key stays "try"); SocketIoFrame.AckResponse arg -> pubSeqEcho. - §B: Gungnir.EmitInterval -> BattleNodeOptions.AliveEmitInterval (unused literal moved to its config home); deck-idx 4L -> InitialHand.Length + 1. - §E: shared Wire.WireJsonOptions.CamelCase replaces the duplicated camelCase JsonSerializerOptions in EngineIoHandshake and MsgEnvelope. - §F: do-NOT-consistency-fix polarity notes on TurnEndFinalHandler (From wins) and RetireKillHandler (From loses). Co-Authored-By: Claude Opus 4.8 --- SVSim.BattleNode/Bridge/BattleNodeOptions.cs | 7 +++++ .../Lifecycle/ServerBattleFrames.cs | 9 ++++--- SVSim.BattleNode/Protocol/MsgEnvelope.cs | 27 ++++++------------- SVSim.BattleNode/Reliability/Gungnir.cs | 7 +++-- .../Sessions/Dispatch/BattleFrames.cs | 8 +++--- .../Dispatch/Handlers/RetireKillHandler.cs | 3 +++ .../Dispatch/Handlers/TurnEndFinalHandler.cs | 4 +++ .../Sessions/Participants/RealParticipant.cs | 2 +- SVSim.BattleNode/Wire/EngineIoHandshake.cs | 8 +----- SVSim.BattleNode/Wire/SocketIoFrame.cs | 7 ++--- SVSim.BattleNode/Wire/WireJsonOptions.cs | 24 +++++++++++++++++ .../Integration/BattleNodeFlowTests.cs | 2 +- .../Integration/CaptureConformanceTests.cs | 12 ++++----- .../BattleNode/Protocol/MsgEnvelopeTests.cs | 8 +++--- .../Protocol/MsgPayloadCodecTests.cs | 2 +- .../Reliability/OutboundSequencerTests.cs | 2 +- .../BattleSessionDispatchConcurrencyTests.cs | 2 +- .../Sessions/BattleSessionDispatchTests.cs | 4 +-- .../BattleSessionTerminateCascadeTests.cs | 2 +- .../Participants/NoOpBotParticipantTests.cs | 2 +- .../Participants/RealParticipantTests.cs | 2 +- .../BattleNode/Wire/SocketIoFrameTests.cs | 2 +- 22 files changed, 84 insertions(+), 62 deletions(-) create mode 100644 SVSim.BattleNode/Wire/WireJsonOptions.cs diff --git a/SVSim.BattleNode/Bridge/BattleNodeOptions.cs b/SVSim.BattleNode/Bridge/BattleNodeOptions.cs index 36e8c25..1cd3597 100644 --- a/SVSim.BattleNode/Bridge/BattleNodeOptions.cs +++ b/SVSim.BattleNode/Bridge/BattleNodeOptions.cs @@ -16,6 +16,13 @@ public sealed class BattleNodeOptions /// public TimeSpan WaitingRoomTimeout { get; set; } = TimeSpan.FromSeconds(60); + /// + /// Cadence of the server→client alive ("Gungnir") keepalive emit. The driving timer/loop + /// (to live on ) is deferred in v1; this is its future + /// home so the interval isn't a magic literal stranded on the Gungnir body factory. + /// + public TimeSpan AliveEmitInterval { get; set; } = TimeSpan.FromSeconds(5); + /// /// When true, emits per-frame /// diagnostic logs at Information level: [sio-in] on every inbound msg/alive/hand diff --git a/SVSim.BattleNode/Lifecycle/ServerBattleFrames.cs b/SVSim.BattleNode/Lifecycle/ServerBattleFrames.cs index a7754bd..9495082 100644 --- a/SVSim.BattleNode/Lifecycle/ServerBattleFrames.cs +++ b/SVSim.BattleNode/Lifecycle/ServerBattleFrames.cs @@ -90,13 +90,14 @@ public static class ServerBattleFrames /// /// Compute the player's hand after a mulligan. For every idx in - /// that is currently in the hand, replace it with the next unused deck idx (starting at 4, - /// since 1..3 were dealt). Positions of kept cards are preserved. + /// that is currently in the hand, replace it with the next unused deck idx (the first idx past + /// the opening hand — is 1-based and contiguous, so that's + /// InitialHand.Length + 1). Positions of kept cards are preserved. /// public static long[] ComputeHandAfterSwap(IReadOnlyList swapIndices) { var hand = InitialHand.ToArray(); - var nextDeckIdx = 4L; + var nextDeckIdx = (long)(InitialHand.Length + 1); for (var pos = 0; pos < hand.Length; pos++) { if (swapIndices.Contains(hand[pos])) @@ -151,7 +152,7 @@ public static class ServerBattleFrames ViewerId: FakeOpponentViewerId, Uuid: WireConstants.ServerUuid, Bid: bid, - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, diff --git a/SVSim.BattleNode/Protocol/MsgEnvelope.cs b/SVSim.BattleNode/Protocol/MsgEnvelope.cs index 3e89738..7baa7a6 100644 --- a/SVSim.BattleNode/Protocol/MsgEnvelope.cs +++ b/SVSim.BattleNode/Protocol/MsgEnvelope.cs @@ -1,6 +1,6 @@ using System.Text.Json; using System.Text.Json.Nodes; -using System.Text.Json.Serialization; +using SVSim.BattleNode.Wire; namespace SVSim.BattleNode.Protocol; @@ -14,32 +14,21 @@ public sealed record MsgEnvelope( long ViewerId, string Uuid, string? Bid, - int Try, + int RetryAttempt, EmitCategory Cat, long? PubSeq, long? PlaySeq, IMsgBody Body) { - private static readonly JsonSerializerOptions Options = CreateOptions(); + // Bare-camelCase wire serialization, single-sourced in Wire.WireJsonOptions (shared with + // EngineIoHandshake). Every wire key here is explicit via the manual ToJson layering below. + private static readonly JsonSerializerOptions Options = WireJsonOptions.CamelCase; private static readonly HashSet ReservedEnvelopeKeys = new() { "uri", "viewerId", "uuid", "bid", "try", "cat", "pubSeq", "playSeq", }; - private static JsonSerializerOptions CreateOptions() - { - var opt = new JsonSerializerOptions - { - // Wire-key casing is bare camelCase via per-field [JsonPropertyName] — - // NOT EmulatedEntrypoint's snake_case policy. The naming-policy line - // that was here previously was dead code (every wire key is explicit). - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - }; - opt.Converters.Add(new JsonStringEnumConverter()); - return opt; - } - public static string ToJson(MsgEnvelope env) { // Envelope fields MUST come before body fields on the wire. The client's @@ -51,7 +40,7 @@ public sealed record MsgEnvelope( result["uri"] = env.Uri.ToString(); result["viewerId"] = env.ViewerId; result["uuid"] = env.Uuid; - result["try"] = env.Try; + result["try"] = env.RetryAttempt; result["cat"] = (int)env.Cat; if (env.Bid is not null) result["bid"] = env.Bid; if (env.PubSeq.HasValue) result["pubSeq"] = env.PubSeq.Value; @@ -133,7 +122,7 @@ public sealed record MsgEnvelope( var viewerId = root.GetProperty("viewerId").GetInt64(); var uuid = root.GetProperty("uuid").GetString()!; var bid = root.TryGetProperty("bid", out var bidEl) ? bidEl.GetString() : null; - var @try = root.TryGetProperty("try", out var tryEl) ? tryEl.GetInt32() : 0; + var retryAttempt = root.TryGetProperty("try", out var tryEl) ? tryEl.GetInt32() : 0; var cat = root.TryGetProperty("cat", out var catEl) ? (EmitCategory)catEl.GetInt32() : EmitCategory.Battle; var pubSeq = root.TryGetProperty("pubSeq", out var psEl) ? psEl.GetInt64() : (long?)null; var playSeq = root.TryGetProperty("playSeq", out var plsEl) ? plsEl.GetInt64() : (long?)null; @@ -145,7 +134,7 @@ public sealed record MsgEnvelope( bodyDict[prop.Name] = ToObject(prop.Value); } - return new MsgEnvelope(uri, viewerId, uuid, bid, @try, cat, pubSeq, playSeq, new RawBody(bodyDict)); + return new MsgEnvelope(uri, viewerId, uuid, bid, retryAttempt, cat, pubSeq, playSeq, new RawBody(bodyDict)); } private static object? ToObject(JsonElement el) => el.ValueKind switch diff --git a/SVSim.BattleNode/Reliability/Gungnir.cs b/SVSim.BattleNode/Reliability/Gungnir.cs index 1d5146b..9198870 100644 --- a/SVSim.BattleNode/Reliability/Gungnir.cs +++ b/SVSim.BattleNode/Reliability/Gungnir.cs @@ -3,8 +3,9 @@ namespace SVSim.BattleNode.Reliability; /// /// Body builders for the alive channel ("Gungnir" is the client's codename for the /// keepalive/connection-status channel — see ). -/// The timer/loop that drives emits lives on -/// BattleSession; this class is just the pure body-shape factory. +/// The timer/loop that would drive the emit cadence +/// () is to live on BattleSession; +/// this class is just the pure body-shape factory. /// v1 always reports scs/ocs=ONLINE — real disconnect detection is deferred. The push /// body itself is constructed inline in BattleSession.HandleAliveEventAsync using /// AlivePushBody; only the emit body (sent by us TO the client on the alive channel, @@ -12,8 +13,6 @@ namespace SVSim.BattleNode.Reliability; /// public static class Gungnir { - public static readonly TimeSpan EmitInterval = TimeSpan.FromSeconds(5); - public static Dictionary BuildAliveEmitBody(InboundTracker tracker) => new() { ["currentSeq"] = tracker.HighWaterMark, diff --git a/SVSim.BattleNode/Sessions/Dispatch/BattleFrames.cs b/SVSim.BattleNode/Sessions/Dispatch/BattleFrames.cs index 1f4dc97..843b870 100644 --- a/SVSim.BattleNode/Sessions/Dispatch/BattleFrames.cs +++ b/SVSim.BattleNode/Sessions/Dispatch/BattleFrames.cs @@ -13,7 +13,7 @@ internal static class BattleFrames ViewerId: ServerBattleFrames.FakeOpponentViewerId, Uuid: WireConstants.ServerUuid, Bid: null, - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.General, PubSeq: null, PlaySeq: null, @@ -24,7 +24,7 @@ internal static class BattleFrames ViewerId: ServerBattleFrames.FakeOpponentViewerId, Uuid: WireConstants.ServerUuid, Bid: null, - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, @@ -35,7 +35,7 @@ internal static class BattleFrames ViewerId: ServerBattleFrames.FakeOpponentViewerId, Uuid: WireConstants.ServerUuid, Bid: null, - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, @@ -46,7 +46,7 @@ internal static class BattleFrames ViewerId: ServerBattleFrames.FakeOpponentViewerId, Uuid: WireConstants.ServerUuid, Bid: null, - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, diff --git a/SVSim.BattleNode/Sessions/Dispatch/Handlers/RetireKillHandler.cs b/SVSim.BattleNode/Sessions/Dispatch/Handlers/RetireKillHandler.cs index cf8a72f..cbbfcc0 100644 --- a/SVSim.BattleNode/Sessions/Dispatch/Handlers/RetireKillHandler.cs +++ b/SVSim.BattleNode/Sessions/Dispatch/Handlers/RetireKillHandler.cs @@ -7,6 +7,9 @@ internal sealed class RetireKillHandler : IFrameHandler public IReadOnlyList Handle(FrameDispatchContext ctx) { ctx.State.SessionPhase = BattleSessionPhase.Terminal; + // Polarity: the SENDER retired, so From LOSES / Other WINS. This is the OPPOSITE of + // TurnEndFinalHandler (From WINS there — sender dealt the lethal). Intentional — do NOT + // "consistency-fix" the two handlers to match; a swap here silently reverses every retire. return new[] { new DispatchRoute(ctx.From, BattleFrames.BuildBattleFinish(BattleResult.RetireLose), Stock.Bypass), diff --git a/SVSim.BattleNode/Sessions/Dispatch/Handlers/TurnEndFinalHandler.cs b/SVSim.BattleNode/Sessions/Dispatch/Handlers/TurnEndFinalHandler.cs index 3981a6c..5b9f42e 100644 --- a/SVSim.BattleNode/Sessions/Dispatch/Handlers/TurnEndFinalHandler.cs +++ b/SVSim.BattleNode/Sessions/Dispatch/Handlers/TurnEndFinalHandler.cs @@ -14,6 +14,10 @@ internal sealed class TurnEndFinalHandler : IFrameHandler if (ctx.SenderPhase == BattleSessionPhase.AfterReady) { ctx.State.SessionPhase = BattleSessionPhase.Terminal; + // Polarity: the SENDER dealt the lethal, so From WINS / Other LOSES. This is the + // OPPOSITE of RetireKillHandler (From LOSES there — retire is self-inflicted). + // Intentional — do NOT "consistency-fix" the two handlers to match; a swap here + // silently reverses every lethal-turn outcome. return new[] { new DispatchRoute(ctx.Other, ctx.Env, Stock.Normal), diff --git a/SVSim.BattleNode/Sessions/Participants/RealParticipant.cs b/SVSim.BattleNode/Sessions/Participants/RealParticipant.cs index 413f2f8..28f0bd1 100644 --- a/SVSim.BattleNode/Sessions/Participants/RealParticipant.cs +++ b/SVSim.BattleNode/Sessions/Participants/RealParticipant.cs @@ -404,7 +404,7 @@ public sealed class RealParticipant : IBattleParticipant, IHasHandshakePhase ViewerId: SVSim.BattleNode.Lifecycle.ServerBattleFrames.FakeOpponentViewerId, Uuid: WireConstants.ServerUuid, Bid: null, - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.General, PubSeq: null, PlaySeq: null, diff --git a/SVSim.BattleNode/Wire/EngineIoHandshake.cs b/SVSim.BattleNode/Wire/EngineIoHandshake.cs index 8343728..62f8cc1 100644 --- a/SVSim.BattleNode/Wire/EngineIoHandshake.cs +++ b/SVSim.BattleNode/Wire/EngineIoHandshake.cs @@ -12,11 +12,5 @@ public sealed record EngineIoHandshake( [property: JsonPropertyName("pingInterval")] int PingInterval, [property: JsonPropertyName("pingTimeout")] int PingTimeout) { - // Wire-key casing here is bare camelCase — NOT EmulatedEntrypoint's snake_case policy. - private static readonly JsonSerializerOptions Options = new() - { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - }; - - public string ToJson() => JsonSerializer.Serialize(this, Options); + public string ToJson() => JsonSerializer.Serialize(this, WireJsonOptions.CamelCase); } diff --git a/SVSim.BattleNode/Wire/SocketIoFrame.cs b/SVSim.BattleNode/Wire/SocketIoFrame.cs index d3cc359..b429be8 100644 --- a/SVSim.BattleNode/Wire/SocketIoFrame.cs +++ b/SVSim.BattleNode/Wire/SocketIoFrame.cs @@ -158,10 +158,11 @@ public sealed class SocketIoFrame binaryAttachments: attachments); } - /// Build an ack response with a single int argument (the spec's pubSeq echo). - public static SocketIoFrame AckResponse(int ackId, int arg) + /// Build an ack response whose single argument echoes the inbound frame's pubSeq + /// (the client's ordered-delivery cursor — load-bearing, not a placeholder). + public static SocketIoFrame AckResponse(int ackId, int pubSeqEcho) { - var args = new JsonArray { arg }; + var args = new JsonArray { pubSeqEcho }; return new SocketIoFrame( SocketIoPacketType.Ack, ackId, 0, null, NodesToElements(args), Array.Empty()); } diff --git a/SVSim.BattleNode/Wire/WireJsonOptions.cs b/SVSim.BattleNode/Wire/WireJsonOptions.cs new file mode 100644 index 0000000..7c50bda --- /dev/null +++ b/SVSim.BattleNode/Wire/WireJsonOptions.cs @@ -0,0 +1,24 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace SVSim.BattleNode.Wire; + +/// Shared System.Text.Json options for the bare-camelCase Socket.IO / Engine.IO wire: +/// per-field [JsonPropertyName] casing (NOT EmulatedEntrypoint's snake_case policy), null +/// fields omitted, and unattributed enums written as their name. Single-sourced here because +/// and previously each built a +/// byte-identical block in their own namespace — a drift hazard. +internal static class WireJsonOptions +{ + public static readonly JsonSerializerOptions CamelCase = Create(); + + private static JsonSerializerOptions Create() + { + var opt = new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + }; + opt.Converters.Add(new JsonStringEnumConverter()); + return opt; + } +} diff --git a/SVSim.UnitTests/BattleNode/Integration/BattleNodeFlowTests.cs b/SVSim.UnitTests/BattleNode/Integration/BattleNodeFlowTests.cs index 96c21bc..081d47a 100644 --- a/SVSim.UnitTests/BattleNode/Integration/BattleNodeFlowTests.cs +++ b/SVSim.UnitTests/BattleNode/Integration/BattleNodeFlowTests.cs @@ -119,7 +119,7 @@ public class BattleNodeFlowTests private static MsgEnvelope MakeEnvelopeWith(long vid, NetworkBattleUri uri, long pubSeq, Dictionary? body = null) => - new(uri, ViewerId: vid, Uuid: "udid-test", Bid: null, Try: 0, + new(uri, ViewerId: vid, Uuid: "udid-test", Bid: null, RetryAttempt: 0, Cat: uri == NetworkBattleUri.InitNetwork ? EmitCategory.General : uri == NetworkBattleUri.InitBattle ? EmitCategory.Matching : EmitCategory.Battle, diff --git a/SVSim.UnitTests/BattleNode/Integration/CaptureConformanceTests.cs b/SVSim.UnitTests/BattleNode/Integration/CaptureConformanceTests.cs index 1126463..23fa508 100644 --- a/SVSim.UnitTests/BattleNode/Integration/CaptureConformanceTests.cs +++ b/SVSim.UnitTests/BattleNode/Integration/CaptureConformanceTests.cs @@ -250,7 +250,7 @@ public class CaptureConformanceTests private static MsgEnvelope MakeEnvelope(long vid, NetworkBattleUri uri, long pubSeq, Dictionary? body = null) => - new(uri, ViewerId: vid, Uuid: "udid-test", Bid: null, Try: 0, + new(uri, ViewerId: vid, Uuid: "udid-test", Bid: null, RetryAttempt: 0, Cat: uri == NetworkBattleUri.InitNetwork ? EmitCategory.General : uri == NetworkBattleUri.InitBattle ? EmitCategory.Matching : EmitCategory.Battle, @@ -287,7 +287,7 @@ public class CaptureConformanceTests var body = new SVSim.BattleNode.Protocol.Bodies.PlayActionsBroadcastBody( PlayIdx: 17, Type: 30, KnownList: new[] { entry! }, OppoTargetList: null); - var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: body); using var ourDoc = JsonDocument.Parse(MsgEnvelope.ToJson(env)); @@ -335,7 +335,7 @@ public class CaptureConformanceTests var body = new SVSim.BattleNode.Protocol.Bodies.PlayActionsBroadcastBody( PlayIdx: 38, Type: 30, KnownList: new[] { entry! }, OppoTargetList: null); - var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: body); using var ourDoc = JsonDocument.Parse(MsgEnvelope.ToJson(env)); @@ -376,7 +376,7 @@ public class CaptureConformanceTests var body = new SVSim.BattleNode.Protocol.Bodies.PlayActionsBroadcastBody( PlayIdx: 37, Type: 30, KnownList: null, OppoTargetList: null, UList: relayed); - var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: body); using var ourDoc = JsonDocument.Parse(MsgEnvelope.ToJson(env)); @@ -455,7 +455,7 @@ public class CaptureConformanceTests var keyActionOut = SVSim.BattleNode.Sessions.Dispatch.KnownListBuilder.StripKeyActionForOpponent(keyActionIn); var body = new SVSim.BattleNode.Protocol.Bodies.PlayActionsBroadcastBody( PlayIdx: 18, Type: 30, KnownList: new[] { played! }, OppoTargetList: null, KeyAction: keyActionOut); - var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: body); using var ourDoc = JsonDocument.Parse(MsgEnvelope.ToJson(env)); @@ -520,7 +520,7 @@ public class CaptureConformanceTests var body = new SVSim.BattleNode.Protocol.Bodies.PlayActionsBroadcastBody( PlayIdx: 46, Type: 30, KnownList: new[] { entry! }, OppoTargetList: null); - var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + var env = new MsgEnvelope(NetworkBattleUri.PlayActions, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: body); using var ourDoc = JsonDocument.Parse(MsgEnvelope.ToJson(env)); diff --git a/SVSim.UnitTests/BattleNode/Protocol/MsgEnvelopeTests.cs b/SVSim.UnitTests/BattleNode/Protocol/MsgEnvelopeTests.cs index abb8d27..25f1f55 100644 --- a/SVSim.UnitTests/BattleNode/Protocol/MsgEnvelopeTests.cs +++ b/SVSim.UnitTests/BattleNode/Protocol/MsgEnvelopeTests.cs @@ -35,7 +35,7 @@ public class MsgEnvelopeTests ViewerId: 906243102, Uuid: "udid-1234", Bid: "597830888107", - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.General, PubSeq: null, PlaySeq: null, @@ -60,7 +60,7 @@ public class MsgEnvelopeTests ViewerId: 1, Uuid: "u", Bid: null, - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: 5, @@ -92,7 +92,7 @@ public class MsgEnvelopeTests ViewerId: 1, Uuid: "u", Bid: null, - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, @@ -110,7 +110,7 @@ public class MsgEnvelopeTests ViewerId: 1, Uuid: "u", Bid: null, - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, diff --git a/SVSim.UnitTests/BattleNode/Protocol/MsgPayloadCodecTests.cs b/SVSim.UnitTests/BattleNode/Protocol/MsgPayloadCodecTests.cs index fc2b9ef..d9ea21e 100644 --- a/SVSim.UnitTests/BattleNode/Protocol/MsgPayloadCodecTests.cs +++ b/SVSim.UnitTests/BattleNode/Protocol/MsgPayloadCodecTests.cs @@ -20,7 +20,7 @@ public class MsgPayloadCodecTests ViewerId: 906243102, Uuid: "udid", Bid: "1234", - Try: 0, + RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: 3, PlaySeq: null, diff --git a/SVSim.UnitTests/BattleNode/Reliability/OutboundSequencerTests.cs b/SVSim.UnitTests/BattleNode/Reliability/OutboundSequencerTests.cs index c20e337..6f9b4c0 100644 --- a/SVSim.UnitTests/BattleNode/Reliability/OutboundSequencerTests.cs +++ b/SVSim.UnitTests/BattleNode/Reliability/OutboundSequencerTests.cs @@ -8,7 +8,7 @@ namespace SVSim.UnitTests.BattleNode.Reliability; public class OutboundSequencerTests { private static MsgEnvelope MakeEnvelope(NetworkBattleUri uri) => - new(uri, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, Cat: EmitCategory.Battle, + new(uri, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: new RawBody(new Dictionary())); [Test] diff --git a/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchConcurrencyTests.cs b/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchConcurrencyTests.cs index 8e35852..d59f759 100644 --- a/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchConcurrencyTests.cs +++ b/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchConcurrencyTests.cs @@ -56,7 +56,7 @@ public class BattleSessionDispatchConcurrencyTests } private static MsgEnvelope Env(NetworkBattleUri uri) => - new(uri, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + new(uri, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: new RawBody(new Dictionary())); diff --git a/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchTests.cs b/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchTests.cs index bf34b13..ac16298 100644 --- a/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchTests.cs +++ b/SVSim.UnitTests/BattleNode/Sessions/BattleSessionDispatchTests.cs @@ -1068,12 +1068,12 @@ public class BattleSessionDispatchTests BattleType: 11); private static MsgEnvelope NewEnvelope(NetworkBattleUri uri) => - new(uri, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + new(uri, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: new RawBody(new Dictionary())); private static MsgEnvelope EnvWith(NetworkBattleUri uri, Dictionary body) => - new(uri, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + new(uri, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: new RawBody(body)); private static Dictionary MoveOrderList(int idx, int from, int to) => new() diff --git a/SVSim.UnitTests/BattleNode/Sessions/BattleSessionTerminateCascadeTests.cs b/SVSim.UnitTests/BattleNode/Sessions/BattleSessionTerminateCascadeTests.cs index 490d1a7..fd92574 100644 --- a/SVSim.UnitTests/BattleNode/Sessions/BattleSessionTerminateCascadeTests.cs +++ b/SVSim.UnitTests/BattleNode/Sessions/BattleSessionTerminateCascadeTests.cs @@ -47,7 +47,7 @@ public class BattleSessionTerminateCascadeTests } private static MsgEnvelope MakeEnvelope(NetworkBattleUri uri) => - new(uri, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, Cat: EmitCategory.Battle, + new(uri, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: new RawBody(new Dictionary())); private static MatchContext MakeFakeContext() => new( diff --git a/SVSim.UnitTests/BattleNode/Sessions/Participants/NoOpBotParticipantTests.cs b/SVSim.UnitTests/BattleNode/Sessions/Participants/NoOpBotParticipantTests.cs index 4bbd80d..a21d8d0 100644 --- a/SVSim.UnitTests/BattleNode/Sessions/Participants/NoOpBotParticipantTests.cs +++ b/SVSim.UnitTests/BattleNode/Sessions/Participants/NoOpBotParticipantTests.cs @@ -18,7 +18,7 @@ public class NoOpBotParticipantTests p.FrameEmitted += (_, _) => { fired++; return Task.CompletedTask; }; var env = new MsgEnvelope( - NetworkBattleUri.TurnEnd, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + NetworkBattleUri.TurnEnd, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: new ResultCodeOnlyBody()); diff --git a/SVSim.UnitTests/BattleNode/Sessions/Participants/RealParticipantTests.cs b/SVSim.UnitTests/BattleNode/Sessions/Participants/RealParticipantTests.cs index d9ed77f..a3eb759 100644 --- a/SVSim.UnitTests/BattleNode/Sessions/Participants/RealParticipantTests.cs +++ b/SVSim.UnitTests/BattleNode/Sessions/Participants/RealParticipantTests.cs @@ -177,7 +177,7 @@ public class RealParticipantTests BattleType: 11); private static MsgEnvelope NewEnvelope(NetworkBattleUri uri) => - new(uri, ViewerId: 1, Uuid: "u", Bid: null, Try: 0, + new(uri, ViewerId: 1, Uuid: "u", Bid: null, RetryAttempt: 0, Cat: EmitCategory.Battle, PubSeq: null, PlaySeq: null, Body: new ResultCodeOnlyBody()); } diff --git a/SVSim.UnitTests/BattleNode/Wire/SocketIoFrameTests.cs b/SVSim.UnitTests/BattleNode/Wire/SocketIoFrameTests.cs index a147cdd..12311b4 100644 --- a/SVSim.UnitTests/BattleNode/Wire/SocketIoFrameTests.cs +++ b/SVSim.UnitTests/BattleNode/Wire/SocketIoFrameTests.cs @@ -72,7 +72,7 @@ public class SocketIoFrameTests [Test] public void Encode_AckResponse_IsTypeIdAndArrayOfArgs() { - var frame = SocketIoFrame.AckResponse(ackId: 7, arg: 123); + var frame = SocketIoFrame.AckResponse(ackId: 7, pubSeqEcho: 123); var (text, bins) = frame.Encode(); Assert.That(text, Is.EqualTo("37[123]"));