fix(battle-node): Bot mode must push Matched + BattleStart (client state-machine triggers)

Phase 3 shipped a Bot dispatch table that ack'd InitBattle without
pushing Matched and stayed silent on Loaded, per the architecture spec's
inference that "the client uses AIBattleStart HTTP data instead of
Matched in Bot mode." That inference was wrong.

The client's matching state machine (Matching.ReactionReceiveUri,
Matching.cs:400) gates StartBattleLoad() on the Matched envelope, and
BattleStart at Matching.cs:417 triggers GotoBattle. Without those
envelopes the client never transitions out of MatchingStatus.Connect —
which renders as the "Waiting for opponent" hang on the loading screen.
AIBattleStart HTTP only provides opponent cosmetics, not state-machine
triggers.

Fix: drop the Bot-specific InitBattle ack-only and Loaded silent arms;
let Bot fall through to the existing handshake arms that push Matched
and BattleStart + Deal. Only TurnEnd stays Bot-specific (Judge to
sender, not broadcast — there's no real other side to broadcast to).

Tests updated to match the corrected contract. ai-passive.md doc
amended with a correction note.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-02 09:56:22 -04:00
parent 45c4461515
commit 51e9dd2094
4 changed files with 46 additions and 37 deletions

View File

@@ -109,7 +109,9 @@ public class RankBattleControllerTests
using var doc = JsonDocument.Parse(raw);
var data = doc.RootElement;
Assert.That(data.GetProperty("ai_id").GetInt32(), Is.InRange(4001, 4008));
// Series-1 ids from rm_ai_setting.csv — must be one of the real catalog entries.
Assert.That(data.GetProperty("ai_id").GetInt32(),
Is.AnyOf(1111, 1121, 1131, 1141, 1151, 1161, 1171, 1181));
Assert.That(data.GetProperty("turnState").GetInt32(), Is.EqualTo(0));
// Literal camelCase wire-key checks — these MUST be present verbatim