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<int> to string/string/List<string> 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 <noreply@anthropic.com>
This commit is contained in:
@@ -17,21 +17,22 @@ public class UserMyPageInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MessagePackObject]
|
[MessagePackObject]
|
||||||
public class MyPageBgSetting
|
public class MyPageBgSetting
|
||||||
{
|
{
|
||||||
[JsonPropertyName("mypage_id")]
|
[JsonPropertyName("mypage_id")]
|
||||||
[Key("mypage_id")]
|
[Key("mypage_id")]
|
||||||
public int MyPageId { get; set; }
|
public string MyPageId { get; set; } = "0";
|
||||||
|
|
||||||
/// <summary>0 = single selection (mypage_id), 1+ = random rotation across mypage_id_list.</summary>
|
/// <summary>BGType enum as decimal string: "0"=Deck, "1"=CustomBG, "2"=RandomBG.</summary>
|
||||||
[JsonPropertyName("select_type")]
|
[JsonPropertyName("select_type")]
|
||||||
[Key("select_type")]
|
[Key("select_type")]
|
||||||
public int SelectType { get; set; }
|
public string SelectType { get; set; } = "0";
|
||||||
|
|
||||||
[JsonPropertyName("mypage_id_list")]
|
[JsonPropertyName("mypage_id_list")]
|
||||||
[Key("mypage_id_list")]
|
[Key("mypage_id_list")]
|
||||||
public List<int> MyPageIdList { get; set; } = new();
|
public List<string> MyPageIdList { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
|||||||
40
SVSim.UnitTests/Wire/UserMyPageWireShape.cs
Normal file
40
SVSim.UnitTests/Wire/UserMyPageWireShape.cs
Normal file
@@ -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<string>
|
||||||
|
{
|
||||||
|
"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));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user