Files
SVSimServer/SVSim.BattleNode/Bridge/BattleNodeOptions.cs
gamer147 e70f32db79 refactor(battlenode): close §A boolean-blindness items (MinedToken, Stock, KeyActionType)
Behavior-preserving; 231 BattleNode tests green.

- MinedToken record struct replaces the transpose-prone (int Idx, long CardId,
  CardOwner IsSelf) tuple returned by KnownListBuilder.Mine*. Positional deconstruct
  keeps the Record*From call sites unchanged.
- enum Stock { Normal, Bypass } replaces the negative `bool noStock` on
  IBattleParticipant.PushAsync and DispatchRoute, threaded through both participants,
  BattleSession, and all handler construction sites.
- enum KeyActionType mirrors the client's SendKeyActionDataManager.KeyActionType;
  the StripKeyActionForOpponent guard compares named values, KeyActionEntry.Type is
  the enum (wire-identical via JsonNumberEnumConverter).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 22:53:32 -04:00

33 lines
1.6 KiB
C#

namespace SVSim.BattleNode.Bridge;
/// <summary>
/// DI-injected options for the battle node. NodeServerUrl matches the prod
/// do_matching wire format: <c>host:port/socket.io/</c>, no scheme prefix.
/// BestHTTP's SocketManager parses it as the Socket.IO v2 endpoint URL.
/// </summary>
public sealed class BattleNodeOptions
{
public string NodeServerUrl { get; set; } = "localhost:5148/socket.io/";
/// <summary>
/// How long the first arriver's WS waits for a partner before disconnecting.
/// Matches the architecture spec's 60s default; override (typically lower)
/// in tests via the factory.
/// </summary>
public TimeSpan WaitingRoomTimeout { get; set; } = TimeSpan.FromSeconds(60);
/// <summary>
/// When true, <see cref="Sessions.Participants.RealParticipant"/> emits per-frame
/// diagnostic logs at Information level: <c>[sio-in]</c> on every inbound msg/alive/hand
/// envelope (URI, pubSeq, ackId, dispatch decision, ack-sent flag, ack arg, inbound
/// watermark); <c>[sio-out]</c> on every outbound push (URI, pubSeq, playSeq, stock);
/// <c>[ws-rx-text]</c> / <c>[ws-rx-bin]</c> on every WS frame received at the transport
/// layer; <c>[ws-recv-exit]</c> / <c>[ws-loop-exit]</c> on read-loop termination
/// (with WebSocket state + exception type when applicable). Default false — keeps
/// production logs clean. Flip on per session for live WS debugging, PvP investigation,
/// or to reproduce the kind of softlock chased in
/// <c>docs/audits/battle-node-sio-events-2026-06-02.md</c>.
/// </summary>
public bool DiagnosticLogging { get; set; } = false;
}