From 36dd25826bc631c13e823aa28211f2d1491bfdc7 Mon Sep 17 00:00:00 2001 From: gamer147 Date: Thu, 28 May 2026 09:25:17 -0400 Subject: [PATCH] fix(deck-builder): wire key is cardID/phantomCardID, not snake_case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Client's LitJson serializer emits the C# property name verbatim — the SetParameter param classes in Wizard/GenerateDeckCodeTask.cs use cardID / phantomCardID, and the matching Parse() reads jsonData["cardID"]. Snake-case keys bound to empty in msgpack deserialize, the controller saw 0 cards, and returned INVALID_DECK — surfaced as a blank deck code in the in-game UI. Repro lived in data_dumps/traffic.ndjson #19-20. Existing tests pass through the same JsonPropertyName on both serialize and deserialize, so they happily round-tripped any consistent key — adding a wire-shape regression test that posts the literal client JSON would be the right way to catch this class of bug in the future (out of scope here). Co-Authored-By: Claude Opus 4.7 --- .../Requests/DeckBuilder/GenerateDeckCodeRequest.cs | 13 +++++++++---- .../DeckBuilder/GetDeckFromCodeResponse.cs | 6 ++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/SVSim.EmulatedEntrypoint/Models/Dtos/Requests/DeckBuilder/GenerateDeckCodeRequest.cs b/SVSim.EmulatedEntrypoint/Models/Dtos/Requests/DeckBuilder/GenerateDeckCodeRequest.cs index 4a28ada..64d5b28 100644 --- a/SVSim.EmulatedEntrypoint/Models/Dtos/Requests/DeckBuilder/GenerateDeckCodeRequest.cs +++ b/SVSim.EmulatedEntrypoint/Models/Dtos/Requests/DeckBuilder/GenerateDeckCodeRequest.cs @@ -28,12 +28,17 @@ public class GenerateDeckCodeRequest [Key("deck_format")] public int DeckFormat { get; set; } - [JsonPropertyName("card_id")] - [Key("card_id")] + // Wire key is camelCase mid-word capital — verified in data_dumps/traffic.ndjson live + // capture (`"cardID":[...]`). The client's LitJson serializer emits the C# property name + // verbatim, and the param classes in Wizard/GenerateDeckCodeTask.cs use `cardID` / + // `phantomCardID`. Snake-case would silently bind to empty and the controller would emit + // INVALID_DECK; that was the 2026-05-28 "blank code in the deck builder UI" symptom. + [JsonPropertyName("cardID")] + [Key("cardID")] public List CardID { get; set; } = new(); - [JsonPropertyName("phantom_card_id")] - [Key("phantom_card_id")] + [JsonPropertyName("phantomCardID")] + [Key("phantomCardID")] public List? PhantomCardID { get; set; } [JsonPropertyName("rotation_id")] diff --git a/SVSim.EmulatedEntrypoint/Models/Dtos/Responses/DeckBuilder/GetDeckFromCodeResponse.cs b/SVSim.EmulatedEntrypoint/Models/Dtos/Responses/DeckBuilder/GetDeckFromCodeResponse.cs index a52a043..e6383aa 100644 --- a/SVSim.EmulatedEntrypoint/Models/Dtos/Responses/DeckBuilder/GetDeckFromCodeResponse.cs +++ b/SVSim.EmulatedEntrypoint/Models/Dtos/Responses/DeckBuilder/GetDeckFromCodeResponse.cs @@ -46,7 +46,9 @@ public class DeckPayload [Key("rotation_id")] public object RotationId { get; set; } = 0; - [JsonPropertyName("card_id")] - [Key("card_id")] + // Wire key is camelCase mid-word capital to mirror the client's `cardID` parser + // (Wizard/GetDeckDataFromCodeTask.cs:44 reads `jsonData["cardID"]`). + [JsonPropertyName("cardID")] + [Key("cardID")] public List CardID { get; set; } = new(); }