standard_flags 0.2.2 → 0.3.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +158 -0
  3. data/README.md +566 -35
  4. data/conformance/README.md +166 -0
  5. data/conformance/bucket_vectors.json +46 -0
  6. data/conformance/guards_and_errors.json +35 -0
  7. data/conformance/legacy_env.json +38 -0
  8. data/conformance/legacy_exact.json +90 -0
  9. data/conformance/operations/write_path.json +723 -0
  10. data/conformance/permanent_flags.json +38 -0
  11. data/conformance/resolution.json +68 -0
  12. data/conformance/runtime/client.json +1431 -0
  13. data/conformance/runtime/rules.json +1305 -0
  14. data/conformance/schema/fixture.schema.json +1340 -0
  15. data/conformance/versions/legacy_ranges.json +183 -0
  16. data/conformance/versions/version_ranges.json +503 -0
  17. data/conformance/wire/client_state.json +1905 -0
  18. data/conformance/wire/delivery.json +1541 -0
  19. data/lib/standard_flags/audience.rb +49 -0
  20. data/lib/standard_flags/client.rb +157 -0
  21. data/lib/standard_flags/config.rb +21 -0
  22. data/lib/standard_flags/context.rb +70 -17
  23. data/lib/standard_flags/controller.rb +92 -10
  24. data/lib/standard_flags/definition.rb +71 -8
  25. data/lib/standard_flags/delivery.rb +195 -0
  26. data/lib/standard_flags/errors.rb +33 -0
  27. data/lib/standard_flags/job.rb +12 -1
  28. data/lib/standard_flags/mcp/flags.rb +3 -3
  29. data/lib/standard_flags/mcp/gating.rb +151 -0
  30. data/lib/standard_flags/mcp.rb +64 -5
  31. data/lib/standard_flags/notifiers/logger.rb +4 -0
  32. data/lib/standard_flags/ofrep/controller.rb +211 -0
  33. data/lib/standard_flags/ofrep.rb +115 -0
  34. data/lib/standard_flags/open_feature/provider.rb +1 -1
  35. data/lib/standard_flags/operations/rules.rb +17 -4
  36. data/lib/standard_flags/operations/validation.rb +25 -4
  37. data/lib/standard_flags/operations.rb +0 -2
  38. data/lib/standard_flags/payload.rb +8 -3
  39. data/lib/standard_flags/registry.rb +157 -12
  40. data/lib/standard_flags/runtime/cache.rb +1 -0
  41. data/lib/standard_flags/runtime/resolver.rb +26 -17
  42. data/lib/standard_flags/runtime/values.rb +8 -1
  43. data/lib/standard_flags/runtime.rb +42 -1
  44. data/lib/standard_flags/semantic_version.rb +141 -0
  45. data/lib/standard_flags/subscribers.rb +3 -0
  46. data/lib/standard_flags/testing.rb +4 -2
  47. data/lib/standard_flags/tooling.rb +25 -3
  48. data/lib/standard_flags/version.rb +1 -1
  49. data/lib/standard_flags/version_range.rb +309 -0
  50. data/lib/standard_flags.rb +38 -4
  51. metadata +24 -1
@@ -0,0 +1,1431 @@
1
+ {
2
+ "description": "Client conditions in runtime rules: version ranges in the neutral syntax (space-separated comparators, all of which must hold, with || alternatives), SemVer prerelease ordering and shorthand versions, RubyGems ranges stored before the neutral syntax, and build-number ranges. Every rule rolls out to 100% with an off fallthrough, so a met condition reads SPLIT/percentage and an unmet one TARGETING_MATCH/fallthrough. context.client holds the platform, version and build as a client sends them. context.client.platform \"unknown\" means the client sent a platform the app does not recognise: it fails every platform-scoped condition (platform lists, version and build ranges), while a client with no platform fails platform lists but skips per-platform ranges. Cases with \"scope\": \"server\" exercise the RubyGems compatibility the Ruby server keeps for ranges stored by 0.2.x (and client versions passed outside SemVer); they are not part of the portable contract.",
3
+ "suite": "runtime",
4
+ "scope": "server",
5
+ "registry": {
6
+ "units": [
7
+ "account"
8
+ ],
9
+ "flags": [
10
+ {
11
+ "kind": "flag",
12
+ "key": "new_checkout",
13
+ "owner": "payments",
14
+ "remove_by": "2027-01-01",
15
+ "final": true,
16
+ "unit": "account"
17
+ }
18
+ ]
19
+ },
20
+ "cases": [
21
+ {
22
+ "name": "a neutral range is met",
23
+ "flag": "new_checkout",
24
+ "environment": "production",
25
+ "context": {
26
+ "units": {
27
+ "account": "acct_1"
28
+ },
29
+ "client": {
30
+ "platform": "android",
31
+ "version": "1.4.0"
32
+ }
33
+ },
34
+ "rules": [
35
+ {
36
+ "key": "new_checkout",
37
+ "status": "running",
38
+ "percentage_bps": 10000,
39
+ "fallthrough_value": "off",
40
+ "conditions": {
41
+ "versions": {
42
+ "android": ">=1.4.0 <2.0.0"
43
+ }
44
+ }
45
+ }
46
+ ],
47
+ "expected": {
48
+ "value": true,
49
+ "variant": "on",
50
+ "reason": "SPLIT",
51
+ "rule_id": "percentage",
52
+ "error_code": null
53
+ }
54
+ },
55
+ {
56
+ "name": "a neutral range takes whitespace after the operator",
57
+ "flag": "new_checkout",
58
+ "environment": "production",
59
+ "context": {
60
+ "units": {
61
+ "account": "acct_1"
62
+ },
63
+ "client": {
64
+ "platform": "android",
65
+ "version": "1.9.9"
66
+ }
67
+ },
68
+ "rules": [
69
+ {
70
+ "key": "new_checkout",
71
+ "status": "running",
72
+ "percentage_bps": 10000,
73
+ "fallthrough_value": "off",
74
+ "conditions": {
75
+ "versions": {
76
+ "android": ">= 1.4.0 < 2.0.0"
77
+ }
78
+ }
79
+ }
80
+ ],
81
+ "expected": {
82
+ "value": true,
83
+ "variant": "on",
84
+ "reason": "SPLIT",
85
+ "rule_id": "percentage",
86
+ "error_code": null
87
+ }
88
+ },
89
+ {
90
+ "name": "the upper bound of a neutral range is exclusive",
91
+ "flag": "new_checkout",
92
+ "environment": "production",
93
+ "context": {
94
+ "units": {
95
+ "account": "acct_1"
96
+ },
97
+ "client": {
98
+ "platform": "android",
99
+ "version": "2.0.0"
100
+ }
101
+ },
102
+ "rules": [
103
+ {
104
+ "key": "new_checkout",
105
+ "status": "running",
106
+ "percentage_bps": 10000,
107
+ "fallthrough_value": "off",
108
+ "conditions": {
109
+ "versions": {
110
+ "android": ">=1.4.0 <2.0.0"
111
+ }
112
+ }
113
+ }
114
+ ],
115
+ "expected": {
116
+ "value": false,
117
+ "variant": "off",
118
+ "reason": "TARGETING_MATCH",
119
+ "rule_id": "fallthrough",
120
+ "error_code": null
121
+ }
122
+ },
123
+ {
124
+ "name": "an || alternative is met by an exact prerelease",
125
+ "flag": "new_checkout",
126
+ "environment": "production",
127
+ "context": {
128
+ "units": {
129
+ "account": "acct_1"
130
+ },
131
+ "client": {
132
+ "platform": "android",
133
+ "version": "0.8.5-beta.1"
134
+ }
135
+ },
136
+ "rules": [
137
+ {
138
+ "key": "new_checkout",
139
+ "status": "running",
140
+ "percentage_bps": 10000,
141
+ "fallthrough_value": "off",
142
+ "conditions": {
143
+ "versions": {
144
+ "android": ">=0.9.0 || =0.8.5-beta.1"
145
+ }
146
+ }
147
+ }
148
+ ],
149
+ "expected": {
150
+ "value": true,
151
+ "variant": "on",
152
+ "reason": "SPLIT",
153
+ "rule_id": "percentage",
154
+ "error_code": null
155
+ }
156
+ },
157
+ {
158
+ "name": "no alternative is met",
159
+ "flag": "new_checkout",
160
+ "environment": "production",
161
+ "context": {
162
+ "units": {
163
+ "account": "acct_1"
164
+ },
165
+ "client": {
166
+ "platform": "android",
167
+ "version": "0.8.5"
168
+ }
169
+ },
170
+ "rules": [
171
+ {
172
+ "key": "new_checkout",
173
+ "status": "running",
174
+ "percentage_bps": 10000,
175
+ "fallthrough_value": "off",
176
+ "conditions": {
177
+ "versions": {
178
+ "android": ">=0.9.0 || =0.8.5-beta.1"
179
+ }
180
+ }
181
+ }
182
+ ],
183
+ "expected": {
184
+ "value": false,
185
+ "variant": "off",
186
+ "reason": "TARGETING_MATCH",
187
+ "rule_id": "fallthrough",
188
+ "error_code": null
189
+ }
190
+ },
191
+ {
192
+ "name": "a prerelease sorts before its release",
193
+ "flag": "new_checkout",
194
+ "environment": "production",
195
+ "context": {
196
+ "units": {
197
+ "account": "acct_1"
198
+ },
199
+ "client": {
200
+ "platform": "android",
201
+ "version": "2.0.0-rc.1"
202
+ }
203
+ },
204
+ "rules": [
205
+ {
206
+ "key": "new_checkout",
207
+ "status": "running",
208
+ "percentage_bps": 10000,
209
+ "fallthrough_value": "off",
210
+ "conditions": {
211
+ "versions": {
212
+ "android": ">=2.0.0"
213
+ }
214
+ }
215
+ }
216
+ ],
217
+ "expected": {
218
+ "value": false,
219
+ "variant": "off",
220
+ "reason": "TARGETING_MATCH",
221
+ "rule_id": "fallthrough",
222
+ "error_code": null
223
+ }
224
+ },
225
+ {
226
+ "name": "a prerelease of the next major is below it",
227
+ "flag": "new_checkout",
228
+ "environment": "production",
229
+ "context": {
230
+ "units": {
231
+ "account": "acct_1"
232
+ },
233
+ "client": {
234
+ "platform": "android",
235
+ "version": "2.0.0-beta.1"
236
+ }
237
+ },
238
+ "rules": [
239
+ {
240
+ "key": "new_checkout",
241
+ "status": "running",
242
+ "percentage_bps": 10000,
243
+ "fallthrough_value": "off",
244
+ "conditions": {
245
+ "versions": {
246
+ "android": "<2.0.0"
247
+ }
248
+ }
249
+ }
250
+ ],
251
+ "expected": {
252
+ "value": true,
253
+ "variant": "on",
254
+ "reason": "SPLIT",
255
+ "rule_id": "percentage",
256
+ "error_code": null
257
+ }
258
+ },
259
+ {
260
+ "name": "numeric prerelease identifiers compare by value",
261
+ "flag": "new_checkout",
262
+ "environment": "production",
263
+ "context": {
264
+ "units": {
265
+ "account": "acct_1"
266
+ },
267
+ "client": {
268
+ "platform": "android",
269
+ "version": "1.0.0-alpha.10"
270
+ }
271
+ },
272
+ "rules": [
273
+ {
274
+ "key": "new_checkout",
275
+ "status": "running",
276
+ "percentage_bps": 10000,
277
+ "fallthrough_value": "off",
278
+ "conditions": {
279
+ "versions": {
280
+ "android": ">1.0.0-alpha.2"
281
+ }
282
+ }
283
+ }
284
+ ],
285
+ "expected": {
286
+ "value": true,
287
+ "variant": "on",
288
+ "reason": "SPLIT",
289
+ "rule_id": "percentage",
290
+ "error_code": null
291
+ }
292
+ },
293
+ {
294
+ "name": "alphanumeric prerelease identifiers sort above numeric ones",
295
+ "flag": "new_checkout",
296
+ "environment": "production",
297
+ "context": {
298
+ "units": {
299
+ "account": "acct_1"
300
+ },
301
+ "client": {
302
+ "platform": "android",
303
+ "version": "1.0.0-alpha.beta"
304
+ }
305
+ },
306
+ "rules": [
307
+ {
308
+ "key": "new_checkout",
309
+ "status": "running",
310
+ "percentage_bps": 10000,
311
+ "fallthrough_value": "off",
312
+ "conditions": {
313
+ "versions": {
314
+ "android": ">1.0.0-alpha.99"
315
+ }
316
+ }
317
+ }
318
+ ],
319
+ "expected": {
320
+ "value": true,
321
+ "variant": "on",
322
+ "reason": "SPLIT",
323
+ "rule_id": "percentage",
324
+ "error_code": null
325
+ }
326
+ },
327
+ {
328
+ "name": "a shorthand client version has zero for its missing parts",
329
+ "flag": "new_checkout",
330
+ "environment": "production",
331
+ "context": {
332
+ "units": {
333
+ "account": "acct_1"
334
+ },
335
+ "client": {
336
+ "platform": "android",
337
+ "version": "2"
338
+ }
339
+ },
340
+ "rules": [
341
+ {
342
+ "key": "new_checkout",
343
+ "status": "running",
344
+ "percentage_bps": 10000,
345
+ "fallthrough_value": "off",
346
+ "conditions": {
347
+ "versions": {
348
+ "android": "=2.0.0"
349
+ }
350
+ }
351
+ }
352
+ ],
353
+ "expected": {
354
+ "value": true,
355
+ "variant": "on",
356
+ "reason": "SPLIT",
357
+ "rule_id": "percentage",
358
+ "error_code": null
359
+ }
360
+ },
361
+ {
362
+ "name": "a shorthand range version has zero for its missing parts",
363
+ "flag": "new_checkout",
364
+ "environment": "production",
365
+ "context": {
366
+ "units": {
367
+ "account": "acct_1"
368
+ },
369
+ "client": {
370
+ "platform": "android",
371
+ "version": "1.4.0"
372
+ }
373
+ },
374
+ "rules": [
375
+ {
376
+ "key": "new_checkout",
377
+ "status": "running",
378
+ "percentage_bps": 10000,
379
+ "fallthrough_value": "off",
380
+ "conditions": {
381
+ "versions": {
382
+ "android": ">=1.4 <2"
383
+ }
384
+ }
385
+ }
386
+ ],
387
+ "expected": {
388
+ "value": true,
389
+ "variant": "on",
390
+ "reason": "SPLIT",
391
+ "rule_id": "percentage",
392
+ "error_code": null
393
+ }
394
+ },
395
+ {
396
+ "name": "build metadata is ignored",
397
+ "flag": "new_checkout",
398
+ "environment": "production",
399
+ "context": {
400
+ "units": {
401
+ "account": "acct_1"
402
+ },
403
+ "client": {
404
+ "platform": "android",
405
+ "version": "1.4.0+381"
406
+ }
407
+ },
408
+ "rules": [
409
+ {
410
+ "key": "new_checkout",
411
+ "status": "running",
412
+ "percentage_bps": 10000,
413
+ "fallthrough_value": "off",
414
+ "conditions": {
415
+ "versions": {
416
+ "android": "=1.4.0"
417
+ }
418
+ }
419
+ }
420
+ ],
421
+ "expected": {
422
+ "value": true,
423
+ "variant": "on",
424
+ "reason": "SPLIT",
425
+ "rule_id": "percentage",
426
+ "error_code": null
427
+ }
428
+ },
429
+ {
430
+ "name": "a client version outside SemVer meets no range",
431
+ "flag": "new_checkout",
432
+ "environment": "production",
433
+ "context": {
434
+ "units": {
435
+ "account": "acct_1"
436
+ },
437
+ "client": {
438
+ "platform": "android",
439
+ "version": "1.4.0.1"
440
+ }
441
+ },
442
+ "rules": [
443
+ {
444
+ "key": "new_checkout",
445
+ "status": "running",
446
+ "percentage_bps": 10000,
447
+ "fallthrough_value": "off",
448
+ "conditions": {
449
+ "versions": {
450
+ "android": ">=1.0.0 <9.0.0"
451
+ }
452
+ }
453
+ }
454
+ ],
455
+ "expected": {
456
+ "value": false,
457
+ "variant": "off",
458
+ "reason": "TARGETING_MATCH",
459
+ "rule_id": "fallthrough",
460
+ "error_code": null
461
+ }
462
+ },
463
+ {
464
+ "scope": "server",
465
+ "name": "a RubyGems pessimistic range still reads",
466
+ "flag": "new_checkout",
467
+ "environment": "production",
468
+ "context": {
469
+ "units": {
470
+ "account": "acct_1"
471
+ },
472
+ "client": {
473
+ "platform": "android",
474
+ "version": "1.9.9"
475
+ }
476
+ },
477
+ "rules": [
478
+ {
479
+ "key": "new_checkout",
480
+ "status": "running",
481
+ "percentage_bps": 10000,
482
+ "fallthrough_value": "off",
483
+ "conditions": {
484
+ "versions": {
485
+ "android": "~> 1.4"
486
+ }
487
+ }
488
+ }
489
+ ],
490
+ "expected": {
491
+ "value": true,
492
+ "variant": "on",
493
+ "reason": "SPLIT",
494
+ "rule_id": "percentage",
495
+ "error_code": null
496
+ }
497
+ },
498
+ {
499
+ "scope": "server",
500
+ "name": "a RubyGems pessimistic range still excludes the next major",
501
+ "flag": "new_checkout",
502
+ "environment": "production",
503
+ "context": {
504
+ "units": {
505
+ "account": "acct_1"
506
+ },
507
+ "client": {
508
+ "platform": "android",
509
+ "version": "2.0.0"
510
+ }
511
+ },
512
+ "rules": [
513
+ {
514
+ "key": "new_checkout",
515
+ "status": "running",
516
+ "percentage_bps": 10000,
517
+ "fallthrough_value": "off",
518
+ "conditions": {
519
+ "versions": {
520
+ "android": "~> 1.4"
521
+ }
522
+ }
523
+ }
524
+ ],
525
+ "expected": {
526
+ "value": false,
527
+ "variant": "off",
528
+ "reason": "TARGETING_MATCH",
529
+ "rule_id": "fallthrough",
530
+ "error_code": null
531
+ }
532
+ },
533
+ {
534
+ "scope": "server",
535
+ "name": "a three-part RubyGems pessimistic range bounds the minor",
536
+ "flag": "new_checkout",
537
+ "environment": "production",
538
+ "context": {
539
+ "units": {
540
+ "account": "acct_1"
541
+ },
542
+ "client": {
543
+ "platform": "android",
544
+ "version": "1.5.0"
545
+ }
546
+ },
547
+ "rules": [
548
+ {
549
+ "key": "new_checkout",
550
+ "status": "running",
551
+ "percentage_bps": 10000,
552
+ "fallthrough_value": "off",
553
+ "conditions": {
554
+ "versions": {
555
+ "android": "~> 1.4.2"
556
+ }
557
+ }
558
+ }
559
+ ],
560
+ "expected": {
561
+ "value": false,
562
+ "variant": "off",
563
+ "reason": "TARGETING_MATCH",
564
+ "rule_id": "fallthrough",
565
+ "error_code": null
566
+ }
567
+ },
568
+ {
569
+ "scope": "server",
570
+ "name": "a comma-joined RubyGems range still reads",
571
+ "flag": "new_checkout",
572
+ "environment": "production",
573
+ "context": {
574
+ "units": {
575
+ "account": "acct_1"
576
+ },
577
+ "client": {
578
+ "platform": "android",
579
+ "version": "1.5.0"
580
+ }
581
+ },
582
+ "rules": [
583
+ {
584
+ "key": "new_checkout",
585
+ "status": "running",
586
+ "percentage_bps": 10000,
587
+ "fallthrough_value": "off",
588
+ "conditions": {
589
+ "versions": {
590
+ "android": ">= 1.4, < 2"
591
+ }
592
+ }
593
+ }
594
+ ],
595
+ "expected": {
596
+ "value": true,
597
+ "variant": "on",
598
+ "reason": "SPLIT",
599
+ "rule_id": "percentage",
600
+ "error_code": null
601
+ }
602
+ },
603
+ {
604
+ "name": "a malformed neutral range fails the flag",
605
+ "flag": "new_checkout",
606
+ "environment": "production",
607
+ "context": {
608
+ "units": {
609
+ "account": "acct_1"
610
+ },
611
+ "client": {
612
+ "platform": "android",
613
+ "version": "1.5.0"
614
+ }
615
+ },
616
+ "rules": [
617
+ {
618
+ "key": "new_checkout",
619
+ "status": "running",
620
+ "percentage_bps": 10000,
621
+ "fallthrough_value": "off",
622
+ "conditions": {
623
+ "versions": {
624
+ "android": ">=1.4.0 <"
625
+ }
626
+ }
627
+ }
628
+ ],
629
+ "expected": {
630
+ "value": false,
631
+ "variant": "off",
632
+ "reason": "ERROR",
633
+ "rule_id": null,
634
+ "error_code": "PARSE_ERROR"
635
+ }
636
+ },
637
+ {
638
+ "name": "a build range is met",
639
+ "flag": "new_checkout",
640
+ "environment": "production",
641
+ "context": {
642
+ "units": {
643
+ "account": "acct_1"
644
+ },
645
+ "client": {
646
+ "platform": "android",
647
+ "build": "150"
648
+ }
649
+ },
650
+ "rules": [
651
+ {
652
+ "key": "new_checkout",
653
+ "status": "running",
654
+ "percentage_bps": 10000,
655
+ "fallthrough_value": "off",
656
+ "conditions": {
657
+ "builds": {
658
+ "android": ">=120 <200"
659
+ }
660
+ }
661
+ }
662
+ ],
663
+ "expected": {
664
+ "value": true,
665
+ "variant": "on",
666
+ "reason": "SPLIT",
667
+ "rule_id": "percentage",
668
+ "error_code": null
669
+ }
670
+ },
671
+ {
672
+ "name": "a build below the range skips to the fallthrough",
673
+ "flag": "new_checkout",
674
+ "environment": "production",
675
+ "context": {
676
+ "units": {
677
+ "account": "acct_1"
678
+ },
679
+ "client": {
680
+ "platform": "android",
681
+ "build": "119"
682
+ }
683
+ },
684
+ "rules": [
685
+ {
686
+ "key": "new_checkout",
687
+ "status": "running",
688
+ "percentage_bps": 10000,
689
+ "fallthrough_value": "off",
690
+ "conditions": {
691
+ "builds": {
692
+ "android": ">=120 <200"
693
+ }
694
+ }
695
+ }
696
+ ],
697
+ "expected": {
698
+ "value": false,
699
+ "variant": "off",
700
+ "reason": "TARGETING_MATCH",
701
+ "rule_id": "fallthrough",
702
+ "error_code": null
703
+ }
704
+ },
705
+ {
706
+ "name": "a build range takes || alternatives",
707
+ "flag": "new_checkout",
708
+ "environment": "production",
709
+ "context": {
710
+ "units": {
711
+ "account": "acct_1"
712
+ },
713
+ "client": {
714
+ "platform": "android",
715
+ "build": "7"
716
+ }
717
+ },
718
+ "rules": [
719
+ {
720
+ "key": "new_checkout",
721
+ "status": "running",
722
+ "percentage_bps": 10000,
723
+ "fallthrough_value": "off",
724
+ "conditions": {
725
+ "builds": {
726
+ "android": "=7 || >=12"
727
+ }
728
+ }
729
+ }
730
+ ],
731
+ "expected": {
732
+ "value": true,
733
+ "variant": "on",
734
+ "reason": "SPLIT",
735
+ "rule_id": "percentage",
736
+ "error_code": null
737
+ }
738
+ },
739
+ {
740
+ "name": "a client with no build meets no build range",
741
+ "flag": "new_checkout",
742
+ "environment": "production",
743
+ "context": {
744
+ "units": {
745
+ "account": "acct_1"
746
+ },
747
+ "client": {
748
+ "platform": "android",
749
+ "version": "1.5.0"
750
+ }
751
+ },
752
+ "rules": [
753
+ {
754
+ "key": "new_checkout",
755
+ "status": "running",
756
+ "percentage_bps": 10000,
757
+ "fallthrough_value": "off",
758
+ "conditions": {
759
+ "builds": {
760
+ "android": ">=120"
761
+ }
762
+ }
763
+ }
764
+ ],
765
+ "expected": {
766
+ "value": false,
767
+ "variant": "off",
768
+ "reason": "TARGETING_MATCH",
769
+ "rule_id": "fallthrough",
770
+ "error_code": null
771
+ }
772
+ },
773
+ {
774
+ "name": "a non-numeric build meets no build range",
775
+ "flag": "new_checkout",
776
+ "environment": "production",
777
+ "context": {
778
+ "units": {
779
+ "account": "acct_1"
780
+ },
781
+ "client": {
782
+ "platform": "android",
783
+ "build": "12a"
784
+ }
785
+ },
786
+ "rules": [
787
+ {
788
+ "key": "new_checkout",
789
+ "status": "running",
790
+ "percentage_bps": 10000,
791
+ "fallthrough_value": "off",
792
+ "conditions": {
793
+ "builds": {
794
+ "android": ">=1"
795
+ }
796
+ }
797
+ }
798
+ ],
799
+ "expected": {
800
+ "value": false,
801
+ "variant": "off",
802
+ "reason": "TARGETING_MATCH",
803
+ "rule_id": "fallthrough",
804
+ "error_code": null
805
+ }
806
+ },
807
+ {
808
+ "name": "version and build ranges both hold",
809
+ "flag": "new_checkout",
810
+ "environment": "production",
811
+ "context": {
812
+ "units": {
813
+ "account": "acct_1"
814
+ },
815
+ "client": {
816
+ "platform": "android",
817
+ "version": "1.5.0",
818
+ "build": "150"
819
+ }
820
+ },
821
+ "rules": [
822
+ {
823
+ "key": "new_checkout",
824
+ "status": "running",
825
+ "percentage_bps": 10000,
826
+ "fallthrough_value": "off",
827
+ "conditions": {
828
+ "versions": {
829
+ "android": ">=1.4.0"
830
+ },
831
+ "builds": {
832
+ "android": ">=120"
833
+ }
834
+ }
835
+ }
836
+ ],
837
+ "expected": {
838
+ "value": true,
839
+ "variant": "on",
840
+ "reason": "SPLIT",
841
+ "rule_id": "percentage",
842
+ "error_code": null
843
+ }
844
+ },
845
+ {
846
+ "name": "a met version range with an unmet build range skips to the fallthrough",
847
+ "flag": "new_checkout",
848
+ "environment": "production",
849
+ "context": {
850
+ "units": {
851
+ "account": "acct_1"
852
+ },
853
+ "client": {
854
+ "platform": "android",
855
+ "version": "1.5.0",
856
+ "build": "100"
857
+ }
858
+ },
859
+ "rules": [
860
+ {
861
+ "key": "new_checkout",
862
+ "status": "running",
863
+ "percentage_bps": 10000,
864
+ "fallthrough_value": "off",
865
+ "conditions": {
866
+ "versions": {
867
+ "android": ">=1.4.0"
868
+ },
869
+ "builds": {
870
+ "android": ">=120"
871
+ }
872
+ }
873
+ }
874
+ ],
875
+ "expected": {
876
+ "value": false,
877
+ "variant": "off",
878
+ "reason": "TARGETING_MATCH",
879
+ "rule_id": "fallthrough",
880
+ "error_code": null
881
+ }
882
+ },
883
+ {
884
+ "name": "a met build range with an unmet version range skips to the fallthrough",
885
+ "flag": "new_checkout",
886
+ "environment": "production",
887
+ "context": {
888
+ "units": {
889
+ "account": "acct_1"
890
+ },
891
+ "client": {
892
+ "platform": "android",
893
+ "version": "1.3.0",
894
+ "build": "150"
895
+ }
896
+ },
897
+ "rules": [
898
+ {
899
+ "key": "new_checkout",
900
+ "status": "running",
901
+ "percentage_bps": 10000,
902
+ "fallthrough_value": "off",
903
+ "conditions": {
904
+ "versions": {
905
+ "android": ">=1.4.0"
906
+ },
907
+ "builds": {
908
+ "android": ">=120"
909
+ }
910
+ }
911
+ }
912
+ ],
913
+ "expected": {
914
+ "value": false,
915
+ "variant": "off",
916
+ "reason": "TARGETING_MATCH",
917
+ "rule_id": "fallthrough",
918
+ "error_code": null
919
+ }
920
+ },
921
+ {
922
+ "name": "build ranges apply per platform",
923
+ "flag": "new_checkout",
924
+ "environment": "production",
925
+ "context": {
926
+ "units": {
927
+ "account": "acct_1"
928
+ },
929
+ "client": {
930
+ "platform": "ios",
931
+ "build": "1"
932
+ }
933
+ },
934
+ "rules": [
935
+ {
936
+ "key": "new_checkout",
937
+ "status": "running",
938
+ "percentage_bps": 10000,
939
+ "fallthrough_value": "off",
940
+ "conditions": {
941
+ "builds": {
942
+ "android": ">=120"
943
+ }
944
+ }
945
+ }
946
+ ],
947
+ "expected": {
948
+ "value": true,
949
+ "variant": "on",
950
+ "reason": "SPLIT",
951
+ "rule_id": "percentage",
952
+ "error_code": null
953
+ }
954
+ },
955
+ {
956
+ "name": "a malformed build range fails the flag",
957
+ "flag": "new_checkout",
958
+ "environment": "production",
959
+ "context": {
960
+ "units": {
961
+ "account": "acct_1"
962
+ },
963
+ "client": {
964
+ "platform": "android",
965
+ "build": "150"
966
+ }
967
+ },
968
+ "rules": [
969
+ {
970
+ "key": "new_checkout",
971
+ "status": "running",
972
+ "percentage_bps": 10000,
973
+ "fallthrough_value": "off",
974
+ "conditions": {
975
+ "builds": {
976
+ "android": ">= 1.4.0"
977
+ }
978
+ }
979
+ }
980
+ ],
981
+ "expected": {
982
+ "value": false,
983
+ "variant": "off",
984
+ "reason": "ERROR",
985
+ "rule_id": null,
986
+ "error_code": "PARSE_ERROR"
987
+ }
988
+ },
989
+ {
990
+ "name": "build ranges stored as a string fail the flag",
991
+ "flag": "new_checkout",
992
+ "environment": "production",
993
+ "context": {
994
+ "units": {
995
+ "account": "acct_1"
996
+ },
997
+ "client": {
998
+ "platform": "android",
999
+ "build": "150"
1000
+ }
1001
+ },
1002
+ "rules": [
1003
+ {
1004
+ "key": "new_checkout",
1005
+ "status": "running",
1006
+ "percentage_bps": 10000,
1007
+ "fallthrough_value": "off",
1008
+ "conditions": {
1009
+ "builds": ">=120"
1010
+ }
1011
+ }
1012
+ ],
1013
+ "expected": {
1014
+ "value": false,
1015
+ "variant": "off",
1016
+ "reason": "ERROR",
1017
+ "rule_id": null,
1018
+ "error_code": "PARSE_ERROR"
1019
+ }
1020
+ },
1021
+ {
1022
+ "name": "a client with no platform skips per-platform version ranges",
1023
+ "flag": "new_checkout",
1024
+ "environment": "production",
1025
+ "context": {
1026
+ "units": {
1027
+ "account": "acct_1"
1028
+ },
1029
+ "client": {
1030
+ "version": "1.0.0"
1031
+ }
1032
+ },
1033
+ "rules": [
1034
+ {
1035
+ "key": "new_checkout",
1036
+ "status": "running",
1037
+ "percentage_bps": 10000,
1038
+ "fallthrough_value": "off",
1039
+ "conditions": {
1040
+ "versions": {
1041
+ "android": ">=9.0.0"
1042
+ }
1043
+ }
1044
+ }
1045
+ ],
1046
+ "expected": {
1047
+ "value": true,
1048
+ "variant": "on",
1049
+ "reason": "SPLIT",
1050
+ "rule_id": "percentage",
1051
+ "error_code": null
1052
+ }
1053
+ },
1054
+ {
1055
+ "name": "a client with no platform skips per-platform build ranges",
1056
+ "flag": "new_checkout",
1057
+ "environment": "production",
1058
+ "context": {
1059
+ "units": {
1060
+ "account": "acct_1"
1061
+ },
1062
+ "client": {}
1063
+ },
1064
+ "rules": [
1065
+ {
1066
+ "key": "new_checkout",
1067
+ "status": "running",
1068
+ "percentage_bps": 10000,
1069
+ "fallthrough_value": "off",
1070
+ "conditions": {
1071
+ "builds": {
1072
+ "android": ">=120"
1073
+ }
1074
+ }
1075
+ }
1076
+ ],
1077
+ "expected": {
1078
+ "value": true,
1079
+ "variant": "on",
1080
+ "reason": "SPLIT",
1081
+ "rule_id": "percentage",
1082
+ "error_code": null
1083
+ }
1084
+ },
1085
+ {
1086
+ "name": "a client with no platform fails a platform list",
1087
+ "flag": "new_checkout",
1088
+ "environment": "production",
1089
+ "context": {
1090
+ "units": {
1091
+ "account": "acct_1"
1092
+ },
1093
+ "client": {
1094
+ "version": "9.9.9"
1095
+ }
1096
+ },
1097
+ "rules": [
1098
+ {
1099
+ "key": "new_checkout",
1100
+ "status": "running",
1101
+ "percentage_bps": 10000,
1102
+ "fallthrough_value": "off",
1103
+ "conditions": {
1104
+ "platforms": [
1105
+ "android"
1106
+ ]
1107
+ }
1108
+ }
1109
+ ],
1110
+ "expected": {
1111
+ "value": false,
1112
+ "variant": "off",
1113
+ "reason": "TARGETING_MATCH",
1114
+ "rule_id": "fallthrough",
1115
+ "error_code": null
1116
+ }
1117
+ },
1118
+ {
1119
+ "name": "an unknown platform fails a per-platform version range",
1120
+ "flag": "new_checkout",
1121
+ "environment": "production",
1122
+ "context": {
1123
+ "units": {
1124
+ "account": "acct_1"
1125
+ },
1126
+ "client": {
1127
+ "platform": "unknown",
1128
+ "version": "10.0.0"
1129
+ }
1130
+ },
1131
+ "rules": [
1132
+ {
1133
+ "key": "new_checkout",
1134
+ "status": "running",
1135
+ "percentage_bps": 10000,
1136
+ "fallthrough_value": "off",
1137
+ "conditions": {
1138
+ "versions": {
1139
+ "android": ">=9.0.0"
1140
+ }
1141
+ }
1142
+ }
1143
+ ],
1144
+ "expected": {
1145
+ "value": false,
1146
+ "variant": "off",
1147
+ "reason": "TARGETING_MATCH",
1148
+ "rule_id": "fallthrough",
1149
+ "error_code": null
1150
+ }
1151
+ },
1152
+ {
1153
+ "name": "an unknown platform fails a per-platform build range",
1154
+ "flag": "new_checkout",
1155
+ "environment": "production",
1156
+ "context": {
1157
+ "units": {
1158
+ "account": "acct_1"
1159
+ },
1160
+ "client": {
1161
+ "platform": "unknown",
1162
+ "build": "500"
1163
+ }
1164
+ },
1165
+ "rules": [
1166
+ {
1167
+ "key": "new_checkout",
1168
+ "status": "running",
1169
+ "percentage_bps": 10000,
1170
+ "fallthrough_value": "off",
1171
+ "conditions": {
1172
+ "builds": {
1173
+ "android": ">=120"
1174
+ }
1175
+ }
1176
+ }
1177
+ ],
1178
+ "expected": {
1179
+ "value": false,
1180
+ "variant": "off",
1181
+ "reason": "TARGETING_MATCH",
1182
+ "rule_id": "fallthrough",
1183
+ "error_code": null
1184
+ }
1185
+ },
1186
+ {
1187
+ "name": "an unknown platform fails a platform list",
1188
+ "flag": "new_checkout",
1189
+ "environment": "production",
1190
+ "context": {
1191
+ "units": {
1192
+ "account": "acct_1"
1193
+ },
1194
+ "client": {
1195
+ "platform": "unknown"
1196
+ }
1197
+ },
1198
+ "rules": [
1199
+ {
1200
+ "key": "new_checkout",
1201
+ "status": "running",
1202
+ "percentage_bps": 10000,
1203
+ "fallthrough_value": "off",
1204
+ "conditions": {
1205
+ "platforms": [
1206
+ "android",
1207
+ "ios"
1208
+ ]
1209
+ }
1210
+ }
1211
+ ],
1212
+ "expected": {
1213
+ "value": false,
1214
+ "variant": "off",
1215
+ "reason": "TARGETING_MATCH",
1216
+ "rule_id": "fallthrough",
1217
+ "error_code": null
1218
+ }
1219
+ },
1220
+ {
1221
+ "scope": "server",
1222
+ "name": "RubyGems ~> excludes a prerelease of its upper bound",
1223
+ "flag": "new_checkout",
1224
+ "environment": "production",
1225
+ "context": {
1226
+ "units": {
1227
+ "account": "acct_1"
1228
+ },
1229
+ "client": {
1230
+ "platform": "android",
1231
+ "version": "2.0.0-beta.1"
1232
+ }
1233
+ },
1234
+ "rules": [
1235
+ {
1236
+ "key": "new_checkout",
1237
+ "status": "running",
1238
+ "percentage_bps": 10000,
1239
+ "fallthrough_value": "off",
1240
+ "conditions": {
1241
+ "versions": {
1242
+ "android": "~> 1.4"
1243
+ }
1244
+ }
1245
+ }
1246
+ ],
1247
+ "expected": {
1248
+ "value": false,
1249
+ "variant": "off",
1250
+ "reason": "TARGETING_MATCH",
1251
+ "rule_id": "fallthrough",
1252
+ "error_code": null
1253
+ }
1254
+ },
1255
+ {
1256
+ "scope": "server",
1257
+ "name": "RubyGems ~> admits a prerelease below its upper bound",
1258
+ "flag": "new_checkout",
1259
+ "environment": "production",
1260
+ "context": {
1261
+ "units": {
1262
+ "account": "acct_1"
1263
+ },
1264
+ "client": {
1265
+ "platform": "android",
1266
+ "version": "1.9.9-rc.1"
1267
+ }
1268
+ },
1269
+ "rules": [
1270
+ {
1271
+ "key": "new_checkout",
1272
+ "status": "running",
1273
+ "percentage_bps": 10000,
1274
+ "fallthrough_value": "off",
1275
+ "conditions": {
1276
+ "versions": {
1277
+ "android": "~> 1.4"
1278
+ }
1279
+ }
1280
+ }
1281
+ ],
1282
+ "expected": {
1283
+ "value": true,
1284
+ "variant": "on",
1285
+ "reason": "SPLIT",
1286
+ "rule_id": "percentage",
1287
+ "error_code": null
1288
+ }
1289
+ },
1290
+ {
1291
+ "scope": "server",
1292
+ "name": "a non-SemVer client version is read by RubyGems against a RubyGems-readable range",
1293
+ "flag": "new_checkout",
1294
+ "environment": "production",
1295
+ "context": {
1296
+ "units": {
1297
+ "account": "acct_1"
1298
+ },
1299
+ "client": {
1300
+ "platform": "android",
1301
+ "version": "1.4.0.1"
1302
+ }
1303
+ },
1304
+ "rules": [
1305
+ {
1306
+ "key": "new_checkout",
1307
+ "status": "running",
1308
+ "percentage_bps": 10000,
1309
+ "fallthrough_value": "off",
1310
+ "conditions": {
1311
+ "versions": {
1312
+ "android": ">= 1.4.0"
1313
+ }
1314
+ }
1315
+ }
1316
+ ],
1317
+ "expected": {
1318
+ "value": true,
1319
+ "variant": "on",
1320
+ "reason": "SPLIT",
1321
+ "rule_id": "percentage",
1322
+ "error_code": null
1323
+ }
1324
+ },
1325
+ {
1326
+ "scope": "server",
1327
+ "name": "a RubyGems-style prerelease client version is read by RubyGems",
1328
+ "flag": "new_checkout",
1329
+ "environment": "production",
1330
+ "context": {
1331
+ "units": {
1332
+ "account": "acct_1"
1333
+ },
1334
+ "client": {
1335
+ "platform": "android",
1336
+ "version": "1.4.0.beta"
1337
+ }
1338
+ },
1339
+ "rules": [
1340
+ {
1341
+ "key": "new_checkout",
1342
+ "status": "running",
1343
+ "percentage_bps": 10000,
1344
+ "fallthrough_value": "off",
1345
+ "conditions": {
1346
+ "versions": {
1347
+ "android": ">= 1.4.0"
1348
+ }
1349
+ }
1350
+ }
1351
+ ],
1352
+ "expected": {
1353
+ "value": false,
1354
+ "variant": "off",
1355
+ "reason": "TARGETING_MATCH",
1356
+ "rule_id": "fallthrough",
1357
+ "error_code": null
1358
+ }
1359
+ },
1360
+ {
1361
+ "scope": "server",
1362
+ "name": "a RubyGems range the neutral syntax can't hold still evaluates",
1363
+ "flag": "new_checkout",
1364
+ "environment": "production",
1365
+ "context": {
1366
+ "units": {
1367
+ "account": "acct_1"
1368
+ },
1369
+ "client": {
1370
+ "platform": "android",
1371
+ "version": "1.4.0.2"
1372
+ }
1373
+ },
1374
+ "rules": [
1375
+ {
1376
+ "key": "new_checkout",
1377
+ "status": "running",
1378
+ "percentage_bps": 10000,
1379
+ "fallthrough_value": "off",
1380
+ "conditions": {
1381
+ "versions": {
1382
+ "android": ">= 1.4.0.1"
1383
+ }
1384
+ }
1385
+ }
1386
+ ],
1387
+ "expected": {
1388
+ "value": true,
1389
+ "variant": "on",
1390
+ "reason": "SPLIT",
1391
+ "rule_id": "percentage",
1392
+ "error_code": null
1393
+ }
1394
+ },
1395
+ {
1396
+ "scope": "server",
1397
+ "name": "a RubyGems range the neutral syntax can't hold still excludes",
1398
+ "flag": "new_checkout",
1399
+ "environment": "production",
1400
+ "context": {
1401
+ "units": {
1402
+ "account": "acct_1"
1403
+ },
1404
+ "client": {
1405
+ "platform": "android",
1406
+ "version": "1.4.0"
1407
+ }
1408
+ },
1409
+ "rules": [
1410
+ {
1411
+ "key": "new_checkout",
1412
+ "status": "running",
1413
+ "percentage_bps": 10000,
1414
+ "fallthrough_value": "off",
1415
+ "conditions": {
1416
+ "versions": {
1417
+ "android": ">= 1.4.0.1"
1418
+ }
1419
+ }
1420
+ }
1421
+ ],
1422
+ "expected": {
1423
+ "value": false,
1424
+ "variant": "off",
1425
+ "reason": "TARGETING_MATCH",
1426
+ "rule_id": "fallthrough",
1427
+ "error_code": null
1428
+ }
1429
+ }
1430
+ ]
1431
+ }