standard_flags 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +188 -0
  3. data/README.md +531 -59
  4. data/conformance/README.md +152 -3
  5. data/conformance/legacy_env.json +7 -1
  6. data/conformance/schema/fixture.schema.json +390 -21
  7. data/conformance/schema/manifest.schema.json +347 -0
  8. data/conformance/upgrade/client_status_server.json +297 -0
  9. data/conformance/wire/client_state.json +2115 -2
  10. data/conformance/wire/client_status.json +359 -0
  11. data/conformance/wire/manifest_check.json +5713 -0
  12. data/lib/generators/standard_flags/install/templates/initializer.rb.tt +4 -1
  13. data/lib/generators/standard_flags/migrations/migrations_generator.rb +37 -9
  14. data/lib/generators/standard_flags/migrations/templates/create_standard_flags_compat_stats.rb.tt +17 -0
  15. data/lib/standard_flags/client_app.rb +229 -0
  16. data/lib/standard_flags/client_status/controller.rb +59 -0
  17. data/lib/standard_flags/client_status.rb +110 -0
  18. data/lib/standard_flags/config.rb +18 -1
  19. data/lib/standard_flags/controller.rb +110 -5
  20. data/lib/standard_flags/definition.rb +37 -35
  21. data/lib/standard_flags/diagnostics.rb +61 -3
  22. data/lib/standard_flags/env_pin.rb +5 -15
  23. data/lib/standard_flags/errors.rb +31 -0
  24. data/lib/standard_flags/evaluator.rb +1 -0
  25. data/lib/standard_flags/mcp/flags.rb +12 -1
  26. data/lib/standard_flags/open_feature/provider.rb +2 -1
  27. data/lib/standard_flags/parser.rb +0 -16
  28. data/lib/standard_flags/registry.rb +46 -4
  29. data/lib/standard_flags/runtime/active_record_store.rb +64 -0
  30. data/lib/standard_flags/runtime/compat_tracker.rb +228 -0
  31. data/lib/standard_flags/runtime/memory_store.rb +20 -0
  32. data/lib/standard_flags/runtime/models.rb +6 -0
  33. data/lib/standard_flags/runtime/store.rb +18 -0
  34. data/lib/standard_flags/runtime.rb +33 -3
  35. data/lib/standard_flags/stores/app_store.rb +172 -0
  36. data/lib/standard_flags/stores.rb +37 -0
  37. data/lib/standard_flags/tooling/kotlin.rb +319 -0
  38. data/lib/standard_flags/tooling/manifest.rb +401 -0
  39. data/lib/standard_flags/tooling/manifest_check.rb +355 -0
  40. data/lib/standard_flags/tooling.rb +150 -55
  41. data/lib/standard_flags/version.rb +1 -1
  42. data/lib/standard_flags.rb +3 -0
  43. data/lib/tasks/standard_flags.rake +47 -0
  44. metadata +15 -2
  45. data/conformance/legacy_exact.json +0 -90
@@ -1,10 +1,11 @@
1
1
  {
2
- "description": "Client state: OFREP bulk payloads in, what client code reads out. The client declares the wire keys it reads (type, code default, allowed string values, ceiling). Each case runs its steps in order on a fresh client: a step is a payload (an object, serialised however the runner likes; payload cases stay well under the limits), raw bytes (`raw`, UTF-8; measured against max_bytes), or a 304 (`not_modified`). Expected: whether the payload was accepted, the version kept for If-None-Match (metadata.version when it is a string), and each declared key's read: state on/off/not_loaded for booleans, loaded/not_loaded for strings, the value code reads, and the entry's reason when its value is used. See conformance/README.md for the rules.",
2
+ "description": "Client state: OFREP bulk payloads in, what client code reads out. The client declares the wire keys it reads (type, code default, allowed string values, ceiling). Each case runs its steps in order on a fresh client: a step is a payload (an object, serialised however the runner likes; payload cases stay well under the limits), raw bytes (`raw`, UTF-8; measured against max_bytes), or a 304 (`not_modified`). Expected: whether the payload was accepted, the version kept for If-None-Match (metadata.version when it is a string of 1 to 256 characters, each printable ASCII other than space and double quote), and each declared key's read: state on/off/not_loaded for booleans, loaded/not_loaded for strings, the value code reads, and the entry's reason when its value is used. See conformance/README.md for the rules.",
3
3
  "suite": "client_state",
4
4
  "scope": "wire",
5
5
  "limits": {
6
6
  "max_bytes": 1024,
7
- "max_flags": 16
7
+ "max_flags": 16,
8
+ "max_nesting": 100
8
9
  },
9
10
  "declared": {
10
11
  "chat_enabled": {
@@ -1900,6 +1901,2118 @@
1900
1901
  }
1901
1902
  }
1902
1903
  ]
1904
+ },
1905
+ {
1906
+ "name": "strict JSON: unquoted literals reject the payload",
1907
+ "steps": [
1908
+ {
1909
+ "payload": {
1910
+ "flags": [
1911
+ {
1912
+ "key": "chat_enabled",
1913
+ "value": true,
1914
+ "reason": "DEFAULT",
1915
+ "variant": "on"
1916
+ },
1917
+ {
1918
+ "key": "gates",
1919
+ "value": "sensor",
1920
+ "reason": "TARGETING_MATCH",
1921
+ "variant": "sensor"
1922
+ },
1923
+ {
1924
+ "key": "homeHero",
1925
+ "value": "savings",
1926
+ "reason": "SPLIT",
1927
+ "variant": "savings"
1928
+ },
1929
+ {
1930
+ "key": "insights_enabled",
1931
+ "value": false,
1932
+ "reason": "KILL_SWITCH",
1933
+ "variant": "off"
1934
+ }
1935
+ ],
1936
+ "metadata": {
1937
+ "version": "v1"
1938
+ }
1939
+ },
1940
+ "expected": {
1941
+ "accepted": true,
1942
+ "version": "v1",
1943
+ "reads": {
1944
+ "chat_enabled": {
1945
+ "state": "on",
1946
+ "value": true,
1947
+ "reason": "DEFAULT"
1948
+ },
1949
+ "insights_enabled": {
1950
+ "state": "off",
1951
+ "value": false,
1952
+ "reason": "KILL_SWITCH"
1953
+ },
1954
+ "commerce_enabled": {
1955
+ "state": "not_loaded",
1956
+ "value": false,
1957
+ "reason": null
1958
+ },
1959
+ "purchases": {
1960
+ "state": "not_loaded",
1961
+ "value": true,
1962
+ "reason": null
1963
+ },
1964
+ "gates": {
1965
+ "state": "loaded",
1966
+ "value": "sensor",
1967
+ "reason": "TARGETING_MATCH"
1968
+ },
1969
+ "homeHero": {
1970
+ "state": "loaded",
1971
+ "value": "savings",
1972
+ "reason": "SPLIT"
1973
+ }
1974
+ }
1975
+ }
1976
+ },
1977
+ {
1978
+ "raw": "{\"flags\":[{\"key\":\"chat_enabled\",\"value\":tru}],\"metadata\":{\"version\":\"v2\"}}",
1979
+ "expected": {
1980
+ "accepted": false,
1981
+ "version": "v1",
1982
+ "reads": {
1983
+ "chat_enabled": {
1984
+ "state": "on",
1985
+ "value": true,
1986
+ "reason": "DEFAULT"
1987
+ },
1988
+ "insights_enabled": {
1989
+ "state": "off",
1990
+ "value": false,
1991
+ "reason": "KILL_SWITCH"
1992
+ },
1993
+ "commerce_enabled": {
1994
+ "state": "not_loaded",
1995
+ "value": false,
1996
+ "reason": null
1997
+ },
1998
+ "purchases": {
1999
+ "state": "not_loaded",
2000
+ "value": true,
2001
+ "reason": null
2002
+ },
2003
+ "gates": {
2004
+ "state": "loaded",
2005
+ "value": "sensor",
2006
+ "reason": "TARGETING_MATCH"
2007
+ },
2008
+ "homeHero": {
2009
+ "state": "loaded",
2010
+ "value": "savings",
2011
+ "reason": "SPLIT"
2012
+ }
2013
+ }
2014
+ }
2015
+ },
2016
+ {
2017
+ "raw": "{\"flags\":[{\"key\":\"chat_enabled\",\"value\":True}],\"metadata\":{\"version\":\"v2\"}}",
2018
+ "expected": {
2019
+ "accepted": false,
2020
+ "version": "v1",
2021
+ "reads": {
2022
+ "chat_enabled": {
2023
+ "state": "on",
2024
+ "value": true,
2025
+ "reason": "DEFAULT"
2026
+ },
2027
+ "insights_enabled": {
2028
+ "state": "off",
2029
+ "value": false,
2030
+ "reason": "KILL_SWITCH"
2031
+ },
2032
+ "commerce_enabled": {
2033
+ "state": "not_loaded",
2034
+ "value": false,
2035
+ "reason": null
2036
+ },
2037
+ "purchases": {
2038
+ "state": "not_loaded",
2039
+ "value": true,
2040
+ "reason": null
2041
+ },
2042
+ "gates": {
2043
+ "state": "loaded",
2044
+ "value": "sensor",
2045
+ "reason": "TARGETING_MATCH"
2046
+ },
2047
+ "homeHero": {
2048
+ "state": "loaded",
2049
+ "value": "savings",
2050
+ "reason": "SPLIT"
2051
+ }
2052
+ }
2053
+ }
2054
+ },
2055
+ {
2056
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":NaN}],\"metadata\":{\"version\":\"v2\"}}",
2057
+ "expected": {
2058
+ "accepted": false,
2059
+ "version": "v1",
2060
+ "reads": {
2061
+ "chat_enabled": {
2062
+ "state": "on",
2063
+ "value": true,
2064
+ "reason": "DEFAULT"
2065
+ },
2066
+ "insights_enabled": {
2067
+ "state": "off",
2068
+ "value": false,
2069
+ "reason": "KILL_SWITCH"
2070
+ },
2071
+ "commerce_enabled": {
2072
+ "state": "not_loaded",
2073
+ "value": false,
2074
+ "reason": null
2075
+ },
2076
+ "purchases": {
2077
+ "state": "not_loaded",
2078
+ "value": true,
2079
+ "reason": null
2080
+ },
2081
+ "gates": {
2082
+ "state": "loaded",
2083
+ "value": "sensor",
2084
+ "reason": "TARGETING_MATCH"
2085
+ },
2086
+ "homeHero": {
2087
+ "state": "loaded",
2088
+ "value": "savings",
2089
+ "reason": "SPLIT"
2090
+ }
2091
+ }
2092
+ }
2093
+ },
2094
+ {
2095
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":Infinity}],\"metadata\":{\"version\":\"v2\"}}",
2096
+ "expected": {
2097
+ "accepted": false,
2098
+ "version": "v1",
2099
+ "reads": {
2100
+ "chat_enabled": {
2101
+ "state": "on",
2102
+ "value": true,
2103
+ "reason": "DEFAULT"
2104
+ },
2105
+ "insights_enabled": {
2106
+ "state": "off",
2107
+ "value": false,
2108
+ "reason": "KILL_SWITCH"
2109
+ },
2110
+ "commerce_enabled": {
2111
+ "state": "not_loaded",
2112
+ "value": false,
2113
+ "reason": null
2114
+ },
2115
+ "purchases": {
2116
+ "state": "not_loaded",
2117
+ "value": true,
2118
+ "reason": null
2119
+ },
2120
+ "gates": {
2121
+ "state": "loaded",
2122
+ "value": "sensor",
2123
+ "reason": "TARGETING_MATCH"
2124
+ },
2125
+ "homeHero": {
2126
+ "state": "loaded",
2127
+ "value": "savings",
2128
+ "reason": "SPLIT"
2129
+ }
2130
+ }
2131
+ }
2132
+ }
2133
+ ]
2134
+ },
2135
+ {
2136
+ "name": "strict JSON: single quotes reject the payload",
2137
+ "steps": [
2138
+ {
2139
+ "payload": {
2140
+ "flags": [
2141
+ {
2142
+ "key": "chat_enabled",
2143
+ "value": true,
2144
+ "reason": "DEFAULT",
2145
+ "variant": "on"
2146
+ },
2147
+ {
2148
+ "key": "gates",
2149
+ "value": "sensor",
2150
+ "reason": "TARGETING_MATCH",
2151
+ "variant": "sensor"
2152
+ },
2153
+ {
2154
+ "key": "homeHero",
2155
+ "value": "savings",
2156
+ "reason": "SPLIT",
2157
+ "variant": "savings"
2158
+ },
2159
+ {
2160
+ "key": "insights_enabled",
2161
+ "value": false,
2162
+ "reason": "KILL_SWITCH",
2163
+ "variant": "off"
2164
+ }
2165
+ ],
2166
+ "metadata": {
2167
+ "version": "v1"
2168
+ }
2169
+ },
2170
+ "expected": {
2171
+ "accepted": true,
2172
+ "version": "v1",
2173
+ "reads": {
2174
+ "chat_enabled": {
2175
+ "state": "on",
2176
+ "value": true,
2177
+ "reason": "DEFAULT"
2178
+ },
2179
+ "insights_enabled": {
2180
+ "state": "off",
2181
+ "value": false,
2182
+ "reason": "KILL_SWITCH"
2183
+ },
2184
+ "commerce_enabled": {
2185
+ "state": "not_loaded",
2186
+ "value": false,
2187
+ "reason": null
2188
+ },
2189
+ "purchases": {
2190
+ "state": "not_loaded",
2191
+ "value": true,
2192
+ "reason": null
2193
+ },
2194
+ "gates": {
2195
+ "state": "loaded",
2196
+ "value": "sensor",
2197
+ "reason": "TARGETING_MATCH"
2198
+ },
2199
+ "homeHero": {
2200
+ "state": "loaded",
2201
+ "value": "savings",
2202
+ "reason": "SPLIT"
2203
+ }
2204
+ }
2205
+ }
2206
+ },
2207
+ {
2208
+ "raw": "{\"flags\":[{\"key\":\"gates\",\"value\":'on'}],\"metadata\":{\"version\":\"v2\"}}",
2209
+ "expected": {
2210
+ "accepted": false,
2211
+ "version": "v1",
2212
+ "reads": {
2213
+ "chat_enabled": {
2214
+ "state": "on",
2215
+ "value": true,
2216
+ "reason": "DEFAULT"
2217
+ },
2218
+ "insights_enabled": {
2219
+ "state": "off",
2220
+ "value": false,
2221
+ "reason": "KILL_SWITCH"
2222
+ },
2223
+ "commerce_enabled": {
2224
+ "state": "not_loaded",
2225
+ "value": false,
2226
+ "reason": null
2227
+ },
2228
+ "purchases": {
2229
+ "state": "not_loaded",
2230
+ "value": true,
2231
+ "reason": null
2232
+ },
2233
+ "gates": {
2234
+ "state": "loaded",
2235
+ "value": "sensor",
2236
+ "reason": "TARGETING_MATCH"
2237
+ },
2238
+ "homeHero": {
2239
+ "state": "loaded",
2240
+ "value": "savings",
2241
+ "reason": "SPLIT"
2242
+ }
2243
+ }
2244
+ }
2245
+ },
2246
+ {
2247
+ "raw": "{'flags':[],\"metadata\":{\"version\":\"v2\"}}",
2248
+ "expected": {
2249
+ "accepted": false,
2250
+ "version": "v1",
2251
+ "reads": {
2252
+ "chat_enabled": {
2253
+ "state": "on",
2254
+ "value": true,
2255
+ "reason": "DEFAULT"
2256
+ },
2257
+ "insights_enabled": {
2258
+ "state": "off",
2259
+ "value": false,
2260
+ "reason": "KILL_SWITCH"
2261
+ },
2262
+ "commerce_enabled": {
2263
+ "state": "not_loaded",
2264
+ "value": false,
2265
+ "reason": null
2266
+ },
2267
+ "purchases": {
2268
+ "state": "not_loaded",
2269
+ "value": true,
2270
+ "reason": null
2271
+ },
2272
+ "gates": {
2273
+ "state": "loaded",
2274
+ "value": "sensor",
2275
+ "reason": "TARGETING_MATCH"
2276
+ },
2277
+ "homeHero": {
2278
+ "state": "loaded",
2279
+ "value": "savings",
2280
+ "reason": "SPLIT"
2281
+ }
2282
+ }
2283
+ }
2284
+ }
2285
+ ]
2286
+ },
2287
+ {
2288
+ "name": "strict JSON: unquoted keys reject the payload",
2289
+ "steps": [
2290
+ {
2291
+ "payload": {
2292
+ "flags": [
2293
+ {
2294
+ "key": "chat_enabled",
2295
+ "value": true,
2296
+ "reason": "DEFAULT",
2297
+ "variant": "on"
2298
+ },
2299
+ {
2300
+ "key": "gates",
2301
+ "value": "sensor",
2302
+ "reason": "TARGETING_MATCH",
2303
+ "variant": "sensor"
2304
+ },
2305
+ {
2306
+ "key": "homeHero",
2307
+ "value": "savings",
2308
+ "reason": "SPLIT",
2309
+ "variant": "savings"
2310
+ },
2311
+ {
2312
+ "key": "insights_enabled",
2313
+ "value": false,
2314
+ "reason": "KILL_SWITCH",
2315
+ "variant": "off"
2316
+ }
2317
+ ],
2318
+ "metadata": {
2319
+ "version": "v1"
2320
+ }
2321
+ },
2322
+ "expected": {
2323
+ "accepted": true,
2324
+ "version": "v1",
2325
+ "reads": {
2326
+ "chat_enabled": {
2327
+ "state": "on",
2328
+ "value": true,
2329
+ "reason": "DEFAULT"
2330
+ },
2331
+ "insights_enabled": {
2332
+ "state": "off",
2333
+ "value": false,
2334
+ "reason": "KILL_SWITCH"
2335
+ },
2336
+ "commerce_enabled": {
2337
+ "state": "not_loaded",
2338
+ "value": false,
2339
+ "reason": null
2340
+ },
2341
+ "purchases": {
2342
+ "state": "not_loaded",
2343
+ "value": true,
2344
+ "reason": null
2345
+ },
2346
+ "gates": {
2347
+ "state": "loaded",
2348
+ "value": "sensor",
2349
+ "reason": "TARGETING_MATCH"
2350
+ },
2351
+ "homeHero": {
2352
+ "state": "loaded",
2353
+ "value": "savings",
2354
+ "reason": "SPLIT"
2355
+ }
2356
+ }
2357
+ }
2358
+ },
2359
+ {
2360
+ "raw": "{flags:[],\"metadata\":{\"version\":\"v2\"}}",
2361
+ "expected": {
2362
+ "accepted": false,
2363
+ "version": "v1",
2364
+ "reads": {
2365
+ "chat_enabled": {
2366
+ "state": "on",
2367
+ "value": true,
2368
+ "reason": "DEFAULT"
2369
+ },
2370
+ "insights_enabled": {
2371
+ "state": "off",
2372
+ "value": false,
2373
+ "reason": "KILL_SWITCH"
2374
+ },
2375
+ "commerce_enabled": {
2376
+ "state": "not_loaded",
2377
+ "value": false,
2378
+ "reason": null
2379
+ },
2380
+ "purchases": {
2381
+ "state": "not_loaded",
2382
+ "value": true,
2383
+ "reason": null
2384
+ },
2385
+ "gates": {
2386
+ "state": "loaded",
2387
+ "value": "sensor",
2388
+ "reason": "TARGETING_MATCH"
2389
+ },
2390
+ "homeHero": {
2391
+ "state": "loaded",
2392
+ "value": "savings",
2393
+ "reason": "SPLIT"
2394
+ }
2395
+ }
2396
+ }
2397
+ }
2398
+ ]
2399
+ },
2400
+ {
2401
+ "name": "strict JSON: malformed numbers reject the payload",
2402
+ "steps": [
2403
+ {
2404
+ "payload": {
2405
+ "flags": [
2406
+ {
2407
+ "key": "chat_enabled",
2408
+ "value": true,
2409
+ "reason": "DEFAULT",
2410
+ "variant": "on"
2411
+ },
2412
+ {
2413
+ "key": "gates",
2414
+ "value": "sensor",
2415
+ "reason": "TARGETING_MATCH",
2416
+ "variant": "sensor"
2417
+ },
2418
+ {
2419
+ "key": "homeHero",
2420
+ "value": "savings",
2421
+ "reason": "SPLIT",
2422
+ "variant": "savings"
2423
+ },
2424
+ {
2425
+ "key": "insights_enabled",
2426
+ "value": false,
2427
+ "reason": "KILL_SWITCH",
2428
+ "variant": "off"
2429
+ }
2430
+ ],
2431
+ "metadata": {
2432
+ "version": "v1"
2433
+ }
2434
+ },
2435
+ "expected": {
2436
+ "accepted": true,
2437
+ "version": "v1",
2438
+ "reads": {
2439
+ "chat_enabled": {
2440
+ "state": "on",
2441
+ "value": true,
2442
+ "reason": "DEFAULT"
2443
+ },
2444
+ "insights_enabled": {
2445
+ "state": "off",
2446
+ "value": false,
2447
+ "reason": "KILL_SWITCH"
2448
+ },
2449
+ "commerce_enabled": {
2450
+ "state": "not_loaded",
2451
+ "value": false,
2452
+ "reason": null
2453
+ },
2454
+ "purchases": {
2455
+ "state": "not_loaded",
2456
+ "value": true,
2457
+ "reason": null
2458
+ },
2459
+ "gates": {
2460
+ "state": "loaded",
2461
+ "value": "sensor",
2462
+ "reason": "TARGETING_MATCH"
2463
+ },
2464
+ "homeHero": {
2465
+ "state": "loaded",
2466
+ "value": "savings",
2467
+ "reason": "SPLIT"
2468
+ }
2469
+ }
2470
+ }
2471
+ },
2472
+ {
2473
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":01}],\"metadata\":{\"version\":\"v2\"}}",
2474
+ "expected": {
2475
+ "accepted": false,
2476
+ "version": "v1",
2477
+ "reads": {
2478
+ "chat_enabled": {
2479
+ "state": "on",
2480
+ "value": true,
2481
+ "reason": "DEFAULT"
2482
+ },
2483
+ "insights_enabled": {
2484
+ "state": "off",
2485
+ "value": false,
2486
+ "reason": "KILL_SWITCH"
2487
+ },
2488
+ "commerce_enabled": {
2489
+ "state": "not_loaded",
2490
+ "value": false,
2491
+ "reason": null
2492
+ },
2493
+ "purchases": {
2494
+ "state": "not_loaded",
2495
+ "value": true,
2496
+ "reason": null
2497
+ },
2498
+ "gates": {
2499
+ "state": "loaded",
2500
+ "value": "sensor",
2501
+ "reason": "TARGETING_MATCH"
2502
+ },
2503
+ "homeHero": {
2504
+ "state": "loaded",
2505
+ "value": "savings",
2506
+ "reason": "SPLIT"
2507
+ }
2508
+ }
2509
+ }
2510
+ },
2511
+ {
2512
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":1.}],\"metadata\":{\"version\":\"v2\"}}",
2513
+ "expected": {
2514
+ "accepted": false,
2515
+ "version": "v1",
2516
+ "reads": {
2517
+ "chat_enabled": {
2518
+ "state": "on",
2519
+ "value": true,
2520
+ "reason": "DEFAULT"
2521
+ },
2522
+ "insights_enabled": {
2523
+ "state": "off",
2524
+ "value": false,
2525
+ "reason": "KILL_SWITCH"
2526
+ },
2527
+ "commerce_enabled": {
2528
+ "state": "not_loaded",
2529
+ "value": false,
2530
+ "reason": null
2531
+ },
2532
+ "purchases": {
2533
+ "state": "not_loaded",
2534
+ "value": true,
2535
+ "reason": null
2536
+ },
2537
+ "gates": {
2538
+ "state": "loaded",
2539
+ "value": "sensor",
2540
+ "reason": "TARGETING_MATCH"
2541
+ },
2542
+ "homeHero": {
2543
+ "state": "loaded",
2544
+ "value": "savings",
2545
+ "reason": "SPLIT"
2546
+ }
2547
+ }
2548
+ }
2549
+ },
2550
+ {
2551
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":-}],\"metadata\":{\"version\":\"v2\"}}",
2552
+ "expected": {
2553
+ "accepted": false,
2554
+ "version": "v1",
2555
+ "reads": {
2556
+ "chat_enabled": {
2557
+ "state": "on",
2558
+ "value": true,
2559
+ "reason": "DEFAULT"
2560
+ },
2561
+ "insights_enabled": {
2562
+ "state": "off",
2563
+ "value": false,
2564
+ "reason": "KILL_SWITCH"
2565
+ },
2566
+ "commerce_enabled": {
2567
+ "state": "not_loaded",
2568
+ "value": false,
2569
+ "reason": null
2570
+ },
2571
+ "purchases": {
2572
+ "state": "not_loaded",
2573
+ "value": true,
2574
+ "reason": null
2575
+ },
2576
+ "gates": {
2577
+ "state": "loaded",
2578
+ "value": "sensor",
2579
+ "reason": "TARGETING_MATCH"
2580
+ },
2581
+ "homeHero": {
2582
+ "state": "loaded",
2583
+ "value": "savings",
2584
+ "reason": "SPLIT"
2585
+ }
2586
+ }
2587
+ }
2588
+ }
2589
+ ]
2590
+ },
2591
+ {
2592
+ "name": "strict JSON: an unquoted version rejects the payload",
2593
+ "steps": [
2594
+ {
2595
+ "payload": {
2596
+ "flags": [
2597
+ {
2598
+ "key": "chat_enabled",
2599
+ "value": true,
2600
+ "reason": "DEFAULT",
2601
+ "variant": "on"
2602
+ },
2603
+ {
2604
+ "key": "gates",
2605
+ "value": "sensor",
2606
+ "reason": "TARGETING_MATCH",
2607
+ "variant": "sensor"
2608
+ },
2609
+ {
2610
+ "key": "homeHero",
2611
+ "value": "savings",
2612
+ "reason": "SPLIT",
2613
+ "variant": "savings"
2614
+ },
2615
+ {
2616
+ "key": "insights_enabled",
2617
+ "value": false,
2618
+ "reason": "KILL_SWITCH",
2619
+ "variant": "off"
2620
+ }
2621
+ ],
2622
+ "metadata": {
2623
+ "version": "v1"
2624
+ }
2625
+ },
2626
+ "expected": {
2627
+ "accepted": true,
2628
+ "version": "v1",
2629
+ "reads": {
2630
+ "chat_enabled": {
2631
+ "state": "on",
2632
+ "value": true,
2633
+ "reason": "DEFAULT"
2634
+ },
2635
+ "insights_enabled": {
2636
+ "state": "off",
2637
+ "value": false,
2638
+ "reason": "KILL_SWITCH"
2639
+ },
2640
+ "commerce_enabled": {
2641
+ "state": "not_loaded",
2642
+ "value": false,
2643
+ "reason": null
2644
+ },
2645
+ "purchases": {
2646
+ "state": "not_loaded",
2647
+ "value": true,
2648
+ "reason": null
2649
+ },
2650
+ "gates": {
2651
+ "state": "loaded",
2652
+ "value": "sensor",
2653
+ "reason": "TARGETING_MATCH"
2654
+ },
2655
+ "homeHero": {
2656
+ "state": "loaded",
2657
+ "value": "savings",
2658
+ "reason": "SPLIT"
2659
+ }
2660
+ }
2661
+ }
2662
+ },
2663
+ {
2664
+ "raw": "{\"flags\":[],\"metadata\":{\"version\":abc}}",
2665
+ "expected": {
2666
+ "accepted": false,
2667
+ "version": "v1",
2668
+ "reads": {
2669
+ "chat_enabled": {
2670
+ "state": "on",
2671
+ "value": true,
2672
+ "reason": "DEFAULT"
2673
+ },
2674
+ "insights_enabled": {
2675
+ "state": "off",
2676
+ "value": false,
2677
+ "reason": "KILL_SWITCH"
2678
+ },
2679
+ "commerce_enabled": {
2680
+ "state": "not_loaded",
2681
+ "value": false,
2682
+ "reason": null
2683
+ },
2684
+ "purchases": {
2685
+ "state": "not_loaded",
2686
+ "value": true,
2687
+ "reason": null
2688
+ },
2689
+ "gates": {
2690
+ "state": "loaded",
2691
+ "value": "sensor",
2692
+ "reason": "TARGETING_MATCH"
2693
+ },
2694
+ "homeHero": {
2695
+ "state": "loaded",
2696
+ "value": "savings",
2697
+ "reason": "SPLIT"
2698
+ }
2699
+ }
2700
+ }
2701
+ }
2702
+ ]
2703
+ },
2704
+ {
2705
+ "name": "strict JSON: trailing commas reject the payload",
2706
+ "steps": [
2707
+ {
2708
+ "payload": {
2709
+ "flags": [
2710
+ {
2711
+ "key": "chat_enabled",
2712
+ "value": true,
2713
+ "reason": "DEFAULT",
2714
+ "variant": "on"
2715
+ },
2716
+ {
2717
+ "key": "gates",
2718
+ "value": "sensor",
2719
+ "reason": "TARGETING_MATCH",
2720
+ "variant": "sensor"
2721
+ },
2722
+ {
2723
+ "key": "homeHero",
2724
+ "value": "savings",
2725
+ "reason": "SPLIT",
2726
+ "variant": "savings"
2727
+ },
2728
+ {
2729
+ "key": "insights_enabled",
2730
+ "value": false,
2731
+ "reason": "KILL_SWITCH",
2732
+ "variant": "off"
2733
+ }
2734
+ ],
2735
+ "metadata": {
2736
+ "version": "v1"
2737
+ }
2738
+ },
2739
+ "expected": {
2740
+ "accepted": true,
2741
+ "version": "v1",
2742
+ "reads": {
2743
+ "chat_enabled": {
2744
+ "state": "on",
2745
+ "value": true,
2746
+ "reason": "DEFAULT"
2747
+ },
2748
+ "insights_enabled": {
2749
+ "state": "off",
2750
+ "value": false,
2751
+ "reason": "KILL_SWITCH"
2752
+ },
2753
+ "commerce_enabled": {
2754
+ "state": "not_loaded",
2755
+ "value": false,
2756
+ "reason": null
2757
+ },
2758
+ "purchases": {
2759
+ "state": "not_loaded",
2760
+ "value": true,
2761
+ "reason": null
2762
+ },
2763
+ "gates": {
2764
+ "state": "loaded",
2765
+ "value": "sensor",
2766
+ "reason": "TARGETING_MATCH"
2767
+ },
2768
+ "homeHero": {
2769
+ "state": "loaded",
2770
+ "value": "savings",
2771
+ "reason": "SPLIT"
2772
+ }
2773
+ }
2774
+ }
2775
+ },
2776
+ {
2777
+ "raw": "{\"flags\":[],\"metadata\":{\"version\":\"v2\"},}",
2778
+ "expected": {
2779
+ "accepted": false,
2780
+ "version": "v1",
2781
+ "reads": {
2782
+ "chat_enabled": {
2783
+ "state": "on",
2784
+ "value": true,
2785
+ "reason": "DEFAULT"
2786
+ },
2787
+ "insights_enabled": {
2788
+ "state": "off",
2789
+ "value": false,
2790
+ "reason": "KILL_SWITCH"
2791
+ },
2792
+ "commerce_enabled": {
2793
+ "state": "not_loaded",
2794
+ "value": false,
2795
+ "reason": null
2796
+ },
2797
+ "purchases": {
2798
+ "state": "not_loaded",
2799
+ "value": true,
2800
+ "reason": null
2801
+ },
2802
+ "gates": {
2803
+ "state": "loaded",
2804
+ "value": "sensor",
2805
+ "reason": "TARGETING_MATCH"
2806
+ },
2807
+ "homeHero": {
2808
+ "state": "loaded",
2809
+ "value": "savings",
2810
+ "reason": "SPLIT"
2811
+ }
2812
+ }
2813
+ }
2814
+ },
2815
+ {
2816
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":[1,]}],\"metadata\":{\"version\":\"v2\"}}",
2817
+ "expected": {
2818
+ "accepted": false,
2819
+ "version": "v1",
2820
+ "reads": {
2821
+ "chat_enabled": {
2822
+ "state": "on",
2823
+ "value": true,
2824
+ "reason": "DEFAULT"
2825
+ },
2826
+ "insights_enabled": {
2827
+ "state": "off",
2828
+ "value": false,
2829
+ "reason": "KILL_SWITCH"
2830
+ },
2831
+ "commerce_enabled": {
2832
+ "state": "not_loaded",
2833
+ "value": false,
2834
+ "reason": null
2835
+ },
2836
+ "purchases": {
2837
+ "state": "not_loaded",
2838
+ "value": true,
2839
+ "reason": null
2840
+ },
2841
+ "gates": {
2842
+ "state": "loaded",
2843
+ "value": "sensor",
2844
+ "reason": "TARGETING_MATCH"
2845
+ },
2846
+ "homeHero": {
2847
+ "state": "loaded",
2848
+ "value": "savings",
2849
+ "reason": "SPLIT"
2850
+ }
2851
+ }
2852
+ }
2853
+ }
2854
+ ]
2855
+ },
2856
+ {
2857
+ "name": "strict JSON: a raw control character inside a string rejects the payload",
2858
+ "steps": [
2859
+ {
2860
+ "payload": {
2861
+ "flags": [
2862
+ {
2863
+ "key": "chat_enabled",
2864
+ "value": true,
2865
+ "reason": "DEFAULT",
2866
+ "variant": "on"
2867
+ },
2868
+ {
2869
+ "key": "gates",
2870
+ "value": "sensor",
2871
+ "reason": "TARGETING_MATCH",
2872
+ "variant": "sensor"
2873
+ },
2874
+ {
2875
+ "key": "homeHero",
2876
+ "value": "savings",
2877
+ "reason": "SPLIT",
2878
+ "variant": "savings"
2879
+ },
2880
+ {
2881
+ "key": "insights_enabled",
2882
+ "value": false,
2883
+ "reason": "KILL_SWITCH",
2884
+ "variant": "off"
2885
+ }
2886
+ ],
2887
+ "metadata": {
2888
+ "version": "v1"
2889
+ }
2890
+ },
2891
+ "expected": {
2892
+ "accepted": true,
2893
+ "version": "v1",
2894
+ "reads": {
2895
+ "chat_enabled": {
2896
+ "state": "on",
2897
+ "value": true,
2898
+ "reason": "DEFAULT"
2899
+ },
2900
+ "insights_enabled": {
2901
+ "state": "off",
2902
+ "value": false,
2903
+ "reason": "KILL_SWITCH"
2904
+ },
2905
+ "commerce_enabled": {
2906
+ "state": "not_loaded",
2907
+ "value": false,
2908
+ "reason": null
2909
+ },
2910
+ "purchases": {
2911
+ "state": "not_loaded",
2912
+ "value": true,
2913
+ "reason": null
2914
+ },
2915
+ "gates": {
2916
+ "state": "loaded",
2917
+ "value": "sensor",
2918
+ "reason": "TARGETING_MATCH"
2919
+ },
2920
+ "homeHero": {
2921
+ "state": "loaded",
2922
+ "value": "savings",
2923
+ "reason": "SPLIT"
2924
+ }
2925
+ }
2926
+ }
2927
+ },
2928
+ {
2929
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":\"a\u0001b\"}],\"metadata\":{\"version\":\"v2\"}}",
2930
+ "expected": {
2931
+ "accepted": false,
2932
+ "version": "v1",
2933
+ "reads": {
2934
+ "chat_enabled": {
2935
+ "state": "on",
2936
+ "value": true,
2937
+ "reason": "DEFAULT"
2938
+ },
2939
+ "insights_enabled": {
2940
+ "state": "off",
2941
+ "value": false,
2942
+ "reason": "KILL_SWITCH"
2943
+ },
2944
+ "commerce_enabled": {
2945
+ "state": "not_loaded",
2946
+ "value": false,
2947
+ "reason": null
2948
+ },
2949
+ "purchases": {
2950
+ "state": "not_loaded",
2951
+ "value": true,
2952
+ "reason": null
2953
+ },
2954
+ "gates": {
2955
+ "state": "loaded",
2956
+ "value": "sensor",
2957
+ "reason": "TARGETING_MATCH"
2958
+ },
2959
+ "homeHero": {
2960
+ "state": "loaded",
2961
+ "value": "savings",
2962
+ "reason": "SPLIT"
2963
+ }
2964
+ }
2965
+ }
2966
+ }
2967
+ ]
2968
+ },
2969
+ {
2970
+ "name": "strict JSON: invalid escapes reject the payload",
2971
+ "steps": [
2972
+ {
2973
+ "payload": {
2974
+ "flags": [
2975
+ {
2976
+ "key": "chat_enabled",
2977
+ "value": true,
2978
+ "reason": "DEFAULT",
2979
+ "variant": "on"
2980
+ },
2981
+ {
2982
+ "key": "gates",
2983
+ "value": "sensor",
2984
+ "reason": "TARGETING_MATCH",
2985
+ "variant": "sensor"
2986
+ },
2987
+ {
2988
+ "key": "homeHero",
2989
+ "value": "savings",
2990
+ "reason": "SPLIT",
2991
+ "variant": "savings"
2992
+ },
2993
+ {
2994
+ "key": "insights_enabled",
2995
+ "value": false,
2996
+ "reason": "KILL_SWITCH",
2997
+ "variant": "off"
2998
+ }
2999
+ ],
3000
+ "metadata": {
3001
+ "version": "v1"
3002
+ }
3003
+ },
3004
+ "expected": {
3005
+ "accepted": true,
3006
+ "version": "v1",
3007
+ "reads": {
3008
+ "chat_enabled": {
3009
+ "state": "on",
3010
+ "value": true,
3011
+ "reason": "DEFAULT"
3012
+ },
3013
+ "insights_enabled": {
3014
+ "state": "off",
3015
+ "value": false,
3016
+ "reason": "KILL_SWITCH"
3017
+ },
3018
+ "commerce_enabled": {
3019
+ "state": "not_loaded",
3020
+ "value": false,
3021
+ "reason": null
3022
+ },
3023
+ "purchases": {
3024
+ "state": "not_loaded",
3025
+ "value": true,
3026
+ "reason": null
3027
+ },
3028
+ "gates": {
3029
+ "state": "loaded",
3030
+ "value": "sensor",
3031
+ "reason": "TARGETING_MATCH"
3032
+ },
3033
+ "homeHero": {
3034
+ "state": "loaded",
3035
+ "value": "savings",
3036
+ "reason": "SPLIT"
3037
+ }
3038
+ }
3039
+ }
3040
+ },
3041
+ {
3042
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":\"\\x41\"}],\"metadata\":{\"version\":\"v2\"}}",
3043
+ "expected": {
3044
+ "accepted": false,
3045
+ "version": "v1",
3046
+ "reads": {
3047
+ "chat_enabled": {
3048
+ "state": "on",
3049
+ "value": true,
3050
+ "reason": "DEFAULT"
3051
+ },
3052
+ "insights_enabled": {
3053
+ "state": "off",
3054
+ "value": false,
3055
+ "reason": "KILL_SWITCH"
3056
+ },
3057
+ "commerce_enabled": {
3058
+ "state": "not_loaded",
3059
+ "value": false,
3060
+ "reason": null
3061
+ },
3062
+ "purchases": {
3063
+ "state": "not_loaded",
3064
+ "value": true,
3065
+ "reason": null
3066
+ },
3067
+ "gates": {
3068
+ "state": "loaded",
3069
+ "value": "sensor",
3070
+ "reason": "TARGETING_MATCH"
3071
+ },
3072
+ "homeHero": {
3073
+ "state": "loaded",
3074
+ "value": "savings",
3075
+ "reason": "SPLIT"
3076
+ }
3077
+ }
3078
+ }
3079
+ },
3080
+ {
3081
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":\"\\u00G1\"}],\"metadata\":{\"version\":\"v2\"}}",
3082
+ "expected": {
3083
+ "accepted": false,
3084
+ "version": "v1",
3085
+ "reads": {
3086
+ "chat_enabled": {
3087
+ "state": "on",
3088
+ "value": true,
3089
+ "reason": "DEFAULT"
3090
+ },
3091
+ "insights_enabled": {
3092
+ "state": "off",
3093
+ "value": false,
3094
+ "reason": "KILL_SWITCH"
3095
+ },
3096
+ "commerce_enabled": {
3097
+ "state": "not_loaded",
3098
+ "value": false,
3099
+ "reason": null
3100
+ },
3101
+ "purchases": {
3102
+ "state": "not_loaded",
3103
+ "value": true,
3104
+ "reason": null
3105
+ },
3106
+ "gates": {
3107
+ "state": "loaded",
3108
+ "value": "sensor",
3109
+ "reason": "TARGETING_MATCH"
3110
+ },
3111
+ "homeHero": {
3112
+ "state": "loaded",
3113
+ "value": "savings",
3114
+ "reason": "SPLIT"
3115
+ }
3116
+ }
3117
+ }
3118
+ }
3119
+ ]
3120
+ },
3121
+ {
3122
+ "name": "strict JSON: more than max_nesting nested containers reject the payload; exactly max_nesting is accepted",
3123
+ "steps": [
3124
+ {
3125
+ "payload": {
3126
+ "flags": [
3127
+ {
3128
+ "key": "chat_enabled",
3129
+ "value": true,
3130
+ "reason": "DEFAULT",
3131
+ "variant": "on"
3132
+ },
3133
+ {
3134
+ "key": "gates",
3135
+ "value": "sensor",
3136
+ "reason": "TARGETING_MATCH",
3137
+ "variant": "sensor"
3138
+ },
3139
+ {
3140
+ "key": "homeHero",
3141
+ "value": "savings",
3142
+ "reason": "SPLIT",
3143
+ "variant": "savings"
3144
+ },
3145
+ {
3146
+ "key": "insights_enabled",
3147
+ "value": false,
3148
+ "reason": "KILL_SWITCH",
3149
+ "variant": "off"
3150
+ }
3151
+ ],
3152
+ "metadata": {
3153
+ "version": "v1"
3154
+ }
3155
+ },
3156
+ "expected": {
3157
+ "accepted": true,
3158
+ "version": "v1",
3159
+ "reads": {
3160
+ "chat_enabled": {
3161
+ "state": "on",
3162
+ "value": true,
3163
+ "reason": "DEFAULT"
3164
+ },
3165
+ "insights_enabled": {
3166
+ "state": "off",
3167
+ "value": false,
3168
+ "reason": "KILL_SWITCH"
3169
+ },
3170
+ "commerce_enabled": {
3171
+ "state": "not_loaded",
3172
+ "value": false,
3173
+ "reason": null
3174
+ },
3175
+ "purchases": {
3176
+ "state": "not_loaded",
3177
+ "value": true,
3178
+ "reason": null
3179
+ },
3180
+ "gates": {
3181
+ "state": "loaded",
3182
+ "value": "sensor",
3183
+ "reason": "TARGETING_MATCH"
3184
+ },
3185
+ "homeHero": {
3186
+ "state": "loaded",
3187
+ "value": "savings",
3188
+ "reason": "SPLIT"
3189
+ }
3190
+ }
3191
+ }
3192
+ },
3193
+ {
3194
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]}],\"metadata\":{\"version\":\"v2\"}}",
3195
+ "expected": {
3196
+ "accepted": false,
3197
+ "version": "v1",
3198
+ "reads": {
3199
+ "chat_enabled": {
3200
+ "state": "on",
3201
+ "value": true,
3202
+ "reason": "DEFAULT"
3203
+ },
3204
+ "insights_enabled": {
3205
+ "state": "off",
3206
+ "value": false,
3207
+ "reason": "KILL_SWITCH"
3208
+ },
3209
+ "commerce_enabled": {
3210
+ "state": "not_loaded",
3211
+ "value": false,
3212
+ "reason": null
3213
+ },
3214
+ "purchases": {
3215
+ "state": "not_loaded",
3216
+ "value": true,
3217
+ "reason": null
3218
+ },
3219
+ "gates": {
3220
+ "state": "loaded",
3221
+ "value": "sensor",
3222
+ "reason": "TARGETING_MATCH"
3223
+ },
3224
+ "homeHero": {
3225
+ "state": "loaded",
3226
+ "value": "savings",
3227
+ "reason": "SPLIT"
3228
+ }
3229
+ }
3230
+ }
3231
+ },
3232
+ {
3233
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]}],\"metadata\":{\"version\":\"v2\"}}",
3234
+ "expected": {
3235
+ "accepted": true,
3236
+ "version": "v2",
3237
+ "reads": {
3238
+ "chat_enabled": {
3239
+ "state": "not_loaded",
3240
+ "value": false,
3241
+ "reason": null
3242
+ },
3243
+ "insights_enabled": {
3244
+ "state": "not_loaded",
3245
+ "value": false,
3246
+ "reason": null
3247
+ },
3248
+ "commerce_enabled": {
3249
+ "state": "not_loaded",
3250
+ "value": false,
3251
+ "reason": null
3252
+ },
3253
+ "purchases": {
3254
+ "state": "not_loaded",
3255
+ "value": true,
3256
+ "reason": null
3257
+ },
3258
+ "gates": {
3259
+ "state": "not_loaded",
3260
+ "value": "off",
3261
+ "reason": null
3262
+ },
3263
+ "homeHero": {
3264
+ "state": "not_loaded",
3265
+ "value": "control",
3266
+ "reason": null
3267
+ }
3268
+ }
3269
+ }
3270
+ }
3271
+ ]
3272
+ },
3273
+ {
3274
+ "name": "a version is kept only when every character is printable ASCII other than a space or a double quote",
3275
+ "steps": [
3276
+ {
3277
+ "payload": {
3278
+ "flags": [
3279
+ {
3280
+ "key": "chat_enabled",
3281
+ "value": true,
3282
+ "reason": "DEFAULT",
3283
+ "variant": "on"
3284
+ },
3285
+ {
3286
+ "key": "gates",
3287
+ "value": "sensor",
3288
+ "reason": "TARGETING_MATCH",
3289
+ "variant": "sensor"
3290
+ },
3291
+ {
3292
+ "key": "homeHero",
3293
+ "value": "savings",
3294
+ "reason": "SPLIT",
3295
+ "variant": "savings"
3296
+ },
3297
+ {
3298
+ "key": "insights_enabled",
3299
+ "value": false,
3300
+ "reason": "KILL_SWITCH",
3301
+ "variant": "off"
3302
+ }
3303
+ ],
3304
+ "metadata": {
3305
+ "version": "v1"
3306
+ }
3307
+ },
3308
+ "expected": {
3309
+ "accepted": true,
3310
+ "version": "v1",
3311
+ "reads": {
3312
+ "chat_enabled": {
3313
+ "state": "on",
3314
+ "value": true,
3315
+ "reason": "DEFAULT"
3316
+ },
3317
+ "insights_enabled": {
3318
+ "state": "off",
3319
+ "value": false,
3320
+ "reason": "KILL_SWITCH"
3321
+ },
3322
+ "commerce_enabled": {
3323
+ "state": "not_loaded",
3324
+ "value": false,
3325
+ "reason": null
3326
+ },
3327
+ "purchases": {
3328
+ "state": "not_loaded",
3329
+ "value": true,
3330
+ "reason": null
3331
+ },
3332
+ "gates": {
3333
+ "state": "loaded",
3334
+ "value": "sensor",
3335
+ "reason": "TARGETING_MATCH"
3336
+ },
3337
+ "homeHero": {
3338
+ "state": "loaded",
3339
+ "value": "savings",
3340
+ "reason": "SPLIT"
3341
+ }
3342
+ }
3343
+ }
3344
+ },
3345
+ {
3346
+ "payload": {
3347
+ "flags": [],
3348
+ "metadata": {
3349
+ "version": "a\r\nb"
3350
+ }
3351
+ },
3352
+ "expected": {
3353
+ "accepted": true,
3354
+ "version": null,
3355
+ "reads": {
3356
+ "chat_enabled": {
3357
+ "state": "not_loaded",
3358
+ "value": false,
3359
+ "reason": null
3360
+ },
3361
+ "insights_enabled": {
3362
+ "state": "not_loaded",
3363
+ "value": false,
3364
+ "reason": null
3365
+ },
3366
+ "commerce_enabled": {
3367
+ "state": "not_loaded",
3368
+ "value": false,
3369
+ "reason": null
3370
+ },
3371
+ "purchases": {
3372
+ "state": "not_loaded",
3373
+ "value": true,
3374
+ "reason": null
3375
+ },
3376
+ "gates": {
3377
+ "state": "not_loaded",
3378
+ "value": "off",
3379
+ "reason": null
3380
+ },
3381
+ "homeHero": {
3382
+ "state": "not_loaded",
3383
+ "value": "control",
3384
+ "reason": null
3385
+ }
3386
+ }
3387
+ }
3388
+ },
3389
+ {
3390
+ "payload": {
3391
+ "flags": [],
3392
+ "metadata": {
3393
+ "version": "v 2"
3394
+ }
3395
+ },
3396
+ "expected": {
3397
+ "accepted": true,
3398
+ "version": null,
3399
+ "reads": {
3400
+ "chat_enabled": {
3401
+ "state": "not_loaded",
3402
+ "value": false,
3403
+ "reason": null
3404
+ },
3405
+ "insights_enabled": {
3406
+ "state": "not_loaded",
3407
+ "value": false,
3408
+ "reason": null
3409
+ },
3410
+ "commerce_enabled": {
3411
+ "state": "not_loaded",
3412
+ "value": false,
3413
+ "reason": null
3414
+ },
3415
+ "purchases": {
3416
+ "state": "not_loaded",
3417
+ "value": true,
3418
+ "reason": null
3419
+ },
3420
+ "gates": {
3421
+ "state": "not_loaded",
3422
+ "value": "off",
3423
+ "reason": null
3424
+ },
3425
+ "homeHero": {
3426
+ "state": "not_loaded",
3427
+ "value": "control",
3428
+ "reason": null
3429
+ }
3430
+ }
3431
+ }
3432
+ },
3433
+ {
3434
+ "payload": {
3435
+ "flags": [],
3436
+ "metadata": {
3437
+ "version": "v\"2"
3438
+ }
3439
+ },
3440
+ "expected": {
3441
+ "accepted": true,
3442
+ "version": null,
3443
+ "reads": {
3444
+ "chat_enabled": {
3445
+ "state": "not_loaded",
3446
+ "value": false,
3447
+ "reason": null
3448
+ },
3449
+ "insights_enabled": {
3450
+ "state": "not_loaded",
3451
+ "value": false,
3452
+ "reason": null
3453
+ },
3454
+ "commerce_enabled": {
3455
+ "state": "not_loaded",
3456
+ "value": false,
3457
+ "reason": null
3458
+ },
3459
+ "purchases": {
3460
+ "state": "not_loaded",
3461
+ "value": true,
3462
+ "reason": null
3463
+ },
3464
+ "gates": {
3465
+ "state": "not_loaded",
3466
+ "value": "off",
3467
+ "reason": null
3468
+ },
3469
+ "homeHero": {
3470
+ "state": "not_loaded",
3471
+ "value": "control",
3472
+ "reason": null
3473
+ }
3474
+ }
3475
+ }
3476
+ },
3477
+ {
3478
+ "payload": {
3479
+ "flags": [],
3480
+ "metadata": {
3481
+ "version": "vé2"
3482
+ }
3483
+ },
3484
+ "expected": {
3485
+ "accepted": true,
3486
+ "version": null,
3487
+ "reads": {
3488
+ "chat_enabled": {
3489
+ "state": "not_loaded",
3490
+ "value": false,
3491
+ "reason": null
3492
+ },
3493
+ "insights_enabled": {
3494
+ "state": "not_loaded",
3495
+ "value": false,
3496
+ "reason": null
3497
+ },
3498
+ "commerce_enabled": {
3499
+ "state": "not_loaded",
3500
+ "value": false,
3501
+ "reason": null
3502
+ },
3503
+ "purchases": {
3504
+ "state": "not_loaded",
3505
+ "value": true,
3506
+ "reason": null
3507
+ },
3508
+ "gates": {
3509
+ "state": "not_loaded",
3510
+ "value": "off",
3511
+ "reason": null
3512
+ },
3513
+ "homeHero": {
3514
+ "state": "not_loaded",
3515
+ "value": "control",
3516
+ "reason": null
3517
+ }
3518
+ }
3519
+ }
3520
+ },
3521
+ {
3522
+ "payload": {
3523
+ "flags": [],
3524
+ "metadata": {
3525
+ "version": "W/\"x\""
3526
+ }
3527
+ },
3528
+ "expected": {
3529
+ "accepted": true,
3530
+ "version": null,
3531
+ "reads": {
3532
+ "chat_enabled": {
3533
+ "state": "not_loaded",
3534
+ "value": false,
3535
+ "reason": null
3536
+ },
3537
+ "insights_enabled": {
3538
+ "state": "not_loaded",
3539
+ "value": false,
3540
+ "reason": null
3541
+ },
3542
+ "commerce_enabled": {
3543
+ "state": "not_loaded",
3544
+ "value": false,
3545
+ "reason": null
3546
+ },
3547
+ "purchases": {
3548
+ "state": "not_loaded",
3549
+ "value": true,
3550
+ "reason": null
3551
+ },
3552
+ "gates": {
3553
+ "state": "not_loaded",
3554
+ "value": "off",
3555
+ "reason": null
3556
+ },
3557
+ "homeHero": {
3558
+ "state": "not_loaded",
3559
+ "value": "control",
3560
+ "reason": null
3561
+ }
3562
+ }
3563
+ }
3564
+ },
3565
+ {
3566
+ "payload": {
3567
+ "flags": [],
3568
+ "metadata": {
3569
+ "version": "\u0001"
3570
+ }
3571
+ },
3572
+ "expected": {
3573
+ "accepted": true,
3574
+ "version": null,
3575
+ "reads": {
3576
+ "chat_enabled": {
3577
+ "state": "not_loaded",
3578
+ "value": false,
3579
+ "reason": null
3580
+ },
3581
+ "insights_enabled": {
3582
+ "state": "not_loaded",
3583
+ "value": false,
3584
+ "reason": null
3585
+ },
3586
+ "commerce_enabled": {
3587
+ "state": "not_loaded",
3588
+ "value": false,
3589
+ "reason": null
3590
+ },
3591
+ "purchases": {
3592
+ "state": "not_loaded",
3593
+ "value": true,
3594
+ "reason": null
3595
+ },
3596
+ "gates": {
3597
+ "state": "not_loaded",
3598
+ "value": "off",
3599
+ "reason": null
3600
+ },
3601
+ "homeHero": {
3602
+ "state": "not_loaded",
3603
+ "value": "control",
3604
+ "reason": null
3605
+ }
3606
+ }
3607
+ }
3608
+ },
3609
+ {
3610
+ "payload": {
3611
+ "flags": [],
3612
+ "metadata": {
3613
+ "version": "v2!#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
3614
+ }
3615
+ },
3616
+ "expected": {
3617
+ "accepted": true,
3618
+ "version": "v2!#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
3619
+ "reads": {
3620
+ "chat_enabled": {
3621
+ "state": "not_loaded",
3622
+ "value": false,
3623
+ "reason": null
3624
+ },
3625
+ "insights_enabled": {
3626
+ "state": "not_loaded",
3627
+ "value": false,
3628
+ "reason": null
3629
+ },
3630
+ "commerce_enabled": {
3631
+ "state": "not_loaded",
3632
+ "value": false,
3633
+ "reason": null
3634
+ },
3635
+ "purchases": {
3636
+ "state": "not_loaded",
3637
+ "value": true,
3638
+ "reason": null
3639
+ },
3640
+ "gates": {
3641
+ "state": "not_loaded",
3642
+ "value": "off",
3643
+ "reason": null
3644
+ },
3645
+ "homeHero": {
3646
+ "state": "not_loaded",
3647
+ "value": "control",
3648
+ "reason": null
3649
+ }
3650
+ }
3651
+ }
3652
+ }
3653
+ ]
3654
+ },
3655
+ {
3656
+ "name": "a version is kept only when it is at most 256 characters long",
3657
+ "steps": [
3658
+ {
3659
+ "payload": {
3660
+ "flags": [],
3661
+ "metadata": {
3662
+ "version": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
3663
+ }
3664
+ },
3665
+ "expected": {
3666
+ "accepted": true,
3667
+ "version": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
3668
+ "reads": {
3669
+ "chat_enabled": {
3670
+ "state": "not_loaded",
3671
+ "value": false,
3672
+ "reason": null
3673
+ },
3674
+ "insights_enabled": {
3675
+ "state": "not_loaded",
3676
+ "value": false,
3677
+ "reason": null
3678
+ },
3679
+ "commerce_enabled": {
3680
+ "state": "not_loaded",
3681
+ "value": false,
3682
+ "reason": null
3683
+ },
3684
+ "purchases": {
3685
+ "state": "not_loaded",
3686
+ "value": true,
3687
+ "reason": null
3688
+ },
3689
+ "gates": {
3690
+ "state": "not_loaded",
3691
+ "value": "off",
3692
+ "reason": null
3693
+ },
3694
+ "homeHero": {
3695
+ "state": "not_loaded",
3696
+ "value": "control",
3697
+ "reason": null
3698
+ }
3699
+ }
3700
+ }
3701
+ },
3702
+ {
3703
+ "payload": {
3704
+ "flags": [],
3705
+ "metadata": {
3706
+ "version": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0"
3707
+ }
3708
+ },
3709
+ "expected": {
3710
+ "accepted": true,
3711
+ "version": null,
3712
+ "reads": {
3713
+ "chat_enabled": {
3714
+ "state": "not_loaded",
3715
+ "value": false,
3716
+ "reason": null
3717
+ },
3718
+ "insights_enabled": {
3719
+ "state": "not_loaded",
3720
+ "value": false,
3721
+ "reason": null
3722
+ },
3723
+ "commerce_enabled": {
3724
+ "state": "not_loaded",
3725
+ "value": false,
3726
+ "reason": null
3727
+ },
3728
+ "purchases": {
3729
+ "state": "not_loaded",
3730
+ "value": true,
3731
+ "reason": null
3732
+ },
3733
+ "gates": {
3734
+ "state": "not_loaded",
3735
+ "value": "off",
3736
+ "reason": null
3737
+ },
3738
+ "homeHero": {
3739
+ "state": "not_loaded",
3740
+ "value": "control",
3741
+ "reason": null
3742
+ }
3743
+ }
3744
+ }
3745
+ }
3746
+ ]
3747
+ },
3748
+ {
3749
+ "name": "strict JSON: a lone or reversed surrogate escape rejects the payload; a high surrogate followed by a low one is a character",
3750
+ "steps": [
3751
+ {
3752
+ "payload": {
3753
+ "flags": [
3754
+ {
3755
+ "key": "chat_enabled",
3756
+ "value": true,
3757
+ "reason": "DEFAULT",
3758
+ "variant": "on"
3759
+ },
3760
+ {
3761
+ "key": "gates",
3762
+ "value": "sensor",
3763
+ "reason": "TARGETING_MATCH",
3764
+ "variant": "sensor"
3765
+ },
3766
+ {
3767
+ "key": "homeHero",
3768
+ "value": "savings",
3769
+ "reason": "SPLIT",
3770
+ "variant": "savings"
3771
+ },
3772
+ {
3773
+ "key": "insights_enabled",
3774
+ "value": false,
3775
+ "reason": "KILL_SWITCH",
3776
+ "variant": "off"
3777
+ }
3778
+ ],
3779
+ "metadata": {
3780
+ "version": "v1"
3781
+ }
3782
+ },
3783
+ "expected": {
3784
+ "accepted": true,
3785
+ "version": "v1",
3786
+ "reads": {
3787
+ "chat_enabled": {
3788
+ "state": "on",
3789
+ "value": true,
3790
+ "reason": "DEFAULT"
3791
+ },
3792
+ "insights_enabled": {
3793
+ "state": "off",
3794
+ "value": false,
3795
+ "reason": "KILL_SWITCH"
3796
+ },
3797
+ "commerce_enabled": {
3798
+ "state": "not_loaded",
3799
+ "value": false,
3800
+ "reason": null
3801
+ },
3802
+ "purchases": {
3803
+ "state": "not_loaded",
3804
+ "value": true,
3805
+ "reason": null
3806
+ },
3807
+ "gates": {
3808
+ "state": "loaded",
3809
+ "value": "sensor",
3810
+ "reason": "TARGETING_MATCH"
3811
+ },
3812
+ "homeHero": {
3813
+ "state": "loaded",
3814
+ "value": "savings",
3815
+ "reason": "SPLIT"
3816
+ }
3817
+ }
3818
+ }
3819
+ },
3820
+ {
3821
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":\"\\ud800\",\"reason\":\"SPLIT\",\"variant\":\"x\"}],\"metadata\":{\"version\":\"v2\"}}",
3822
+ "expected": {
3823
+ "accepted": false,
3824
+ "version": "v1",
3825
+ "reads": {
3826
+ "chat_enabled": {
3827
+ "state": "on",
3828
+ "value": true,
3829
+ "reason": "DEFAULT"
3830
+ },
3831
+ "insights_enabled": {
3832
+ "state": "off",
3833
+ "value": false,
3834
+ "reason": "KILL_SWITCH"
3835
+ },
3836
+ "commerce_enabled": {
3837
+ "state": "not_loaded",
3838
+ "value": false,
3839
+ "reason": null
3840
+ },
3841
+ "purchases": {
3842
+ "state": "not_loaded",
3843
+ "value": true,
3844
+ "reason": null
3845
+ },
3846
+ "gates": {
3847
+ "state": "loaded",
3848
+ "value": "sensor",
3849
+ "reason": "TARGETING_MATCH"
3850
+ },
3851
+ "homeHero": {
3852
+ "state": "loaded",
3853
+ "value": "savings",
3854
+ "reason": "SPLIT"
3855
+ }
3856
+ }
3857
+ }
3858
+ },
3859
+ {
3860
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":\"\\udc00\",\"reason\":\"SPLIT\",\"variant\":\"x\"}],\"metadata\":{\"version\":\"v2\"}}",
3861
+ "expected": {
3862
+ "accepted": false,
3863
+ "version": "v1",
3864
+ "reads": {
3865
+ "chat_enabled": {
3866
+ "state": "on",
3867
+ "value": true,
3868
+ "reason": "DEFAULT"
3869
+ },
3870
+ "insights_enabled": {
3871
+ "state": "off",
3872
+ "value": false,
3873
+ "reason": "KILL_SWITCH"
3874
+ },
3875
+ "commerce_enabled": {
3876
+ "state": "not_loaded",
3877
+ "value": false,
3878
+ "reason": null
3879
+ },
3880
+ "purchases": {
3881
+ "state": "not_loaded",
3882
+ "value": true,
3883
+ "reason": null
3884
+ },
3885
+ "gates": {
3886
+ "state": "loaded",
3887
+ "value": "sensor",
3888
+ "reason": "TARGETING_MATCH"
3889
+ },
3890
+ "homeHero": {
3891
+ "state": "loaded",
3892
+ "value": "savings",
3893
+ "reason": "SPLIT"
3894
+ }
3895
+ }
3896
+ }
3897
+ },
3898
+ {
3899
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":\"\\ude00\\ud83d\",\"reason\":\"SPLIT\",\"variant\":\"x\"}],\"metadata\":{\"version\":\"v2\"}}",
3900
+ "expected": {
3901
+ "accepted": false,
3902
+ "version": "v1",
3903
+ "reads": {
3904
+ "chat_enabled": {
3905
+ "state": "on",
3906
+ "value": true,
3907
+ "reason": "DEFAULT"
3908
+ },
3909
+ "insights_enabled": {
3910
+ "state": "off",
3911
+ "value": false,
3912
+ "reason": "KILL_SWITCH"
3913
+ },
3914
+ "commerce_enabled": {
3915
+ "state": "not_loaded",
3916
+ "value": false,
3917
+ "reason": null
3918
+ },
3919
+ "purchases": {
3920
+ "state": "not_loaded",
3921
+ "value": true,
3922
+ "reason": null
3923
+ },
3924
+ "gates": {
3925
+ "state": "loaded",
3926
+ "value": "sensor",
3927
+ "reason": "TARGETING_MATCH"
3928
+ },
3929
+ "homeHero": {
3930
+ "state": "loaded",
3931
+ "value": "savings",
3932
+ "reason": "SPLIT"
3933
+ }
3934
+ }
3935
+ }
3936
+ },
3937
+ {
3938
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":\"\\ud800\\u0041\",\"reason\":\"SPLIT\",\"variant\":\"x\"}],\"metadata\":{\"version\":\"v2\"}}",
3939
+ "expected": {
3940
+ "accepted": false,
3941
+ "version": "v1",
3942
+ "reads": {
3943
+ "chat_enabled": {
3944
+ "state": "on",
3945
+ "value": true,
3946
+ "reason": "DEFAULT"
3947
+ },
3948
+ "insights_enabled": {
3949
+ "state": "off",
3950
+ "value": false,
3951
+ "reason": "KILL_SWITCH"
3952
+ },
3953
+ "commerce_enabled": {
3954
+ "state": "not_loaded",
3955
+ "value": false,
3956
+ "reason": null
3957
+ },
3958
+ "purchases": {
3959
+ "state": "not_loaded",
3960
+ "value": true,
3961
+ "reason": null
3962
+ },
3963
+ "gates": {
3964
+ "state": "loaded",
3965
+ "value": "sensor",
3966
+ "reason": "TARGETING_MATCH"
3967
+ },
3968
+ "homeHero": {
3969
+ "state": "loaded",
3970
+ "value": "savings",
3971
+ "reason": "SPLIT"
3972
+ }
3973
+ }
3974
+ }
3975
+ },
3976
+ {
3977
+ "raw": "{\"flags\":[{\"key\":\"homeHero\",\"value\":\"\\ud83d\\ude00\",\"reason\":\"SPLIT\",\"variant\":\"\\ud83d\\ude00\"}],\"metadata\":{\"version\":\"v2\"}}",
3978
+ "expected": {
3979
+ "accepted": true,
3980
+ "version": "v2",
3981
+ "reads": {
3982
+ "chat_enabled": {
3983
+ "state": "not_loaded",
3984
+ "value": false,
3985
+ "reason": null
3986
+ },
3987
+ "insights_enabled": {
3988
+ "state": "not_loaded",
3989
+ "value": false,
3990
+ "reason": null
3991
+ },
3992
+ "commerce_enabled": {
3993
+ "state": "not_loaded",
3994
+ "value": false,
3995
+ "reason": null
3996
+ },
3997
+ "purchases": {
3998
+ "state": "not_loaded",
3999
+ "value": true,
4000
+ "reason": null
4001
+ },
4002
+ "gates": {
4003
+ "state": "not_loaded",
4004
+ "value": "off",
4005
+ "reason": null
4006
+ },
4007
+ "homeHero": {
4008
+ "state": "loaded",
4009
+ "value": "😀",
4010
+ "reason": "SPLIT"
4011
+ }
4012
+ }
4013
+ }
4014
+ }
4015
+ ]
1903
4016
  }
1904
4017
  ]
1905
4018
  }