From b447f5032d11cf2eaa5f949cec7f33945396d637 Mon Sep 17 00:00:00 2001 From: gamer147 Date: Tue, 9 Jun 2026 16:40:38 -0400 Subject: [PATCH] fix(mypage): wire mypage_id/select_type/mypage_id_list as strings Prod capture (traffic_prod_misc_clicking.ndjson) shows all three MyPageBgSetting fields arrive as decimal strings, not ints. Update the DTO from int/int/List to string/string/List with "0"/empty defaults, and add a literal wire-shape round-trip test pinning the exact JSON against the capture. Co-Authored-By: Claude Sonnet 4.6 --- .../Models/Dtos/UserMyPageInfo.cs | 11 ++--- SVSim.UnitTests/Wire/UserMyPageWireShape.cs | 40 +++++++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 SVSim.UnitTests/Wire/UserMyPageWireShape.cs diff --git a/SVSim.EmulatedEntrypoint/Models/Dtos/UserMyPageInfo.cs b/SVSim.EmulatedEntrypoint/Models/Dtos/UserMyPageInfo.cs index 1656925..7bc178a 100644 --- a/SVSim.EmulatedEntrypoint/Models/Dtos/UserMyPageInfo.cs +++ b/SVSim.EmulatedEntrypoint/Models/Dtos/UserMyPageInfo.cs @@ -17,21 +17,22 @@ public class UserMyPageInfo } /// -/// Active mypage background selection. Shape from prod 2026-05-23. +/// Active mypage background selection. Shape from prod 2026-06-09 (capture line 12/56). +/// All three fields ship as strings on the wire even though the underlying ids are integers. /// [MessagePackObject] public class MyPageBgSetting { [JsonPropertyName("mypage_id")] [Key("mypage_id")] - public int MyPageId { get; set; } + public string MyPageId { get; set; } = "0"; - /// 0 = single selection (mypage_id), 1+ = random rotation across mypage_id_list. + /// BGType enum as decimal string: "0"=Deck, "1"=CustomBG, "2"=RandomBG. [JsonPropertyName("select_type")] [Key("select_type")] - public int SelectType { get; set; } + public string SelectType { get; set; } = "0"; [JsonPropertyName("mypage_id_list")] [Key("mypage_id_list")] - public List MyPageIdList { get; set; } = new(); + public List MyPageIdList { get; set; } = new(); } diff --git a/SVSim.UnitTests/Wire/UserMyPageWireShape.cs b/SVSim.UnitTests/Wire/UserMyPageWireShape.cs new file mode 100644 index 0000000..6e64018 --- /dev/null +++ b/SVSim.UnitTests/Wire/UserMyPageWireShape.cs @@ -0,0 +1,40 @@ +using System.Text.Json; +using SVSim.EmulatedEntrypoint.Models.Dtos; + +namespace SVSim.UnitTests.Wire; + +public class UserMyPageWireShape +{ + [Test] + public void MyPageBgSetting_serialization_emits_strings_matching_prod_capture() + { + var setting = new MyPageBgSetting + { + MyPageId = "1213410310", + SelectType = "1", + MyPageIdList = new List + { + "1211410310", "1212410310", "1213410310", "1214410310", + "1215410310", "1216410310", "1217410310", "1218410310", + }, + }; + + var options = new JsonSerializerOptions + { + PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, + DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, + }; + var json = JsonSerializer.Serialize(setting, options); + + // Prod capture line 12 / line 56 of traffic_prod_misc_clicking.ndjson, user_mypage_info.user_mypage_setting: + var expected = + "{\"mypage_id\":\"1213410310\"," + + "\"select_type\":\"1\"," + + "\"mypage_id_list\":[" + + "\"1211410310\",\"1212410310\",\"1213410310\",\"1214410310\"," + + "\"1215410310\",\"1216410310\",\"1217410310\",\"1218410310\"" + + "]}"; + + Assert.That(json, Is.EqualTo(expected)); + } +}