fix(config): treat a wrongly typed app.json value as invalid instead of converting it

PLAN 4.3 lets a field of the wrong type fall back to its default alone.
Newtonsoft converted such values implicitly, so "delete-card": 0 became
false and "custom-pixels": "500" became 500. Booleans, integers and
strings are now read only from tokens of exactly that type.
This commit is contained in:
doyaGu committed 2026-10-03 22:45:08 -04:00
1 parent e7076a76c2
commit a2c4e1853d
4 files changed
+48 -5

No files matched your search

@@ -222,6 +222,13 @@ public class AppConfigStoreTests
[DataRow("\"column-width\": { \"custom-pixels\": \"wide\" }")]
[DataRow("\"confirmations\": { \"delete-card\": \"nope\" }")]
[DataRow("\"version\": \"one\"")]
[DataRow("\"version\": \"1\"")]
[DataRow("\"language\": [\"zh-Hans\"]")]
[DataRow("\"confirmations\": { \"delete-card\": 0 }")]
[DataRow("\"confirmations\": { \"delete-card\": \"false\" }")]
[DataRow("\"column-width\": { \"custom-pixels\": \"500\" }")]
[DataRow("\"column-width\": { \"custom-pixels\": 500.0 }")]
[DataRow("\"column-width\": { \"custom-pixels\": 99999999999 }")]
public void InvalidFieldFallsBackAloneWithoutBackup(string invalidMember)
{
using var directory = new TempDirectory();