flipper 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/workflows/ci.yml +7 -3
  4. data/.github/workflows/examples.yml +27 -5
  5. data/Changelog.md +326 -272
  6. data/Gemfile +4 -4
  7. data/README.md +13 -11
  8. data/benchmark/typecast_ips.rb +8 -0
  9. data/docs/images/flipper_cloud.png +0 -0
  10. data/examples/cloud/backoff_policy.rb +13 -0
  11. data/examples/cloud/cloud_setup.rb +16 -0
  12. data/examples/cloud/forked.rb +7 -2
  13. data/examples/cloud/threaded.rb +15 -18
  14. data/examples/expressions.rb +213 -0
  15. data/examples/strict.rb +18 -0
  16. data/flipper.gemspec +1 -2
  17. data/lib/flipper/actor.rb +6 -3
  18. data/lib/flipper/adapter.rb +10 -0
  19. data/lib/flipper/adapter_builder.rb +44 -0
  20. data/lib/flipper/adapters/dual_write.rb +1 -3
  21. data/lib/flipper/adapters/failover.rb +0 -4
  22. data/lib/flipper/adapters/failsafe.rb +0 -4
  23. data/lib/flipper/adapters/http/client.rb +26 -7
  24. data/lib/flipper/adapters/http/error.rb +1 -1
  25. data/lib/flipper/adapters/http.rb +18 -13
  26. data/lib/flipper/adapters/instrumented.rb +0 -4
  27. data/lib/flipper/adapters/memoizable.rb +14 -19
  28. data/lib/flipper/adapters/memory.rb +4 -6
  29. data/lib/flipper/adapters/operation_logger.rb +0 -4
  30. data/lib/flipper/adapters/poll.rb +1 -3
  31. data/lib/flipper/adapters/pstore.rb +17 -11
  32. data/lib/flipper/adapters/read_only.rb +4 -4
  33. data/lib/flipper/adapters/strict.rb +47 -0
  34. data/lib/flipper/adapters/sync/feature_synchronizer.rb +10 -1
  35. data/lib/flipper/adapters/sync.rb +0 -4
  36. data/lib/flipper/cloud/configuration.rb +121 -52
  37. data/lib/flipper/cloud/telemetry/backoff_policy.rb +93 -0
  38. data/lib/flipper/cloud/telemetry/instrumenter.rb +26 -0
  39. data/lib/flipper/cloud/telemetry/metric.rb +39 -0
  40. data/lib/flipper/cloud/telemetry/metric_storage.rb +30 -0
  41. data/lib/flipper/cloud/telemetry/submitter.rb +98 -0
  42. data/lib/flipper/cloud/telemetry.rb +183 -0
  43. data/lib/flipper/configuration.rb +25 -4
  44. data/lib/flipper/dsl.rb +51 -0
  45. data/lib/flipper/engine.rb +27 -3
  46. data/lib/flipper/exporters/json/export.rb +1 -1
  47. data/lib/flipper/exporters/json/v1.rb +1 -1
  48. data/lib/flipper/expression/builder.rb +73 -0
  49. data/lib/flipper/expression/constant.rb +25 -0
  50. data/lib/flipper/expression.rb +71 -0
  51. data/lib/flipper/expressions/all.rb +11 -0
  52. data/lib/flipper/expressions/any.rb +9 -0
  53. data/lib/flipper/expressions/boolean.rb +9 -0
  54. data/lib/flipper/expressions/comparable.rb +13 -0
  55. data/lib/flipper/expressions/duration.rb +28 -0
  56. data/lib/flipper/expressions/equal.rb +9 -0
  57. data/lib/flipper/expressions/greater_than.rb +9 -0
  58. data/lib/flipper/expressions/greater_than_or_equal_to.rb +9 -0
  59. data/lib/flipper/expressions/less_than.rb +9 -0
  60. data/lib/flipper/expressions/less_than_or_equal_to.rb +9 -0
  61. data/lib/flipper/expressions/not_equal.rb +9 -0
  62. data/lib/flipper/expressions/now.rb +9 -0
  63. data/lib/flipper/expressions/number.rb +9 -0
  64. data/lib/flipper/expressions/percentage.rb +9 -0
  65. data/lib/flipper/expressions/percentage_of_actors.rb +12 -0
  66. data/lib/flipper/expressions/property.rb +9 -0
  67. data/lib/flipper/expressions/random.rb +9 -0
  68. data/lib/flipper/expressions/string.rb +9 -0
  69. data/lib/flipper/expressions/time.rb +9 -0
  70. data/lib/flipper/feature.rb +55 -0
  71. data/lib/flipper/gate.rb +1 -0
  72. data/lib/flipper/gate_values.rb +5 -2
  73. data/lib/flipper/gates/expression.rb +75 -0
  74. data/lib/flipper/instrumentation/statsd_subscriber.rb +2 -4
  75. data/lib/flipper/middleware/memoizer.rb +29 -13
  76. data/lib/flipper/model/active_record.rb +23 -0
  77. data/lib/flipper/poller.rb +1 -1
  78. data/lib/flipper/serializers/gzip.rb +24 -0
  79. data/lib/flipper/serializers/json.rb +19 -0
  80. data/lib/flipper/spec/shared_adapter_specs.rb +29 -11
  81. data/lib/flipper/test/shared_adapter_test.rb +24 -5
  82. data/lib/flipper/typecast.rb +34 -6
  83. data/lib/flipper/types/percentage.rb +1 -1
  84. data/lib/flipper/version.rb +1 -1
  85. data/lib/flipper.rb +38 -1
  86. data/spec/flipper/adapter_builder_spec.rb +73 -0
  87. data/spec/flipper/adapter_spec.rb +1 -0
  88. data/spec/flipper/adapters/http_spec.rb +39 -5
  89. data/spec/flipper/adapters/memoizable_spec.rb +15 -15
  90. data/spec/flipper/adapters/read_only_spec.rb +26 -11
  91. data/spec/flipper/adapters/strict_spec.rb +62 -0
  92. data/spec/flipper/adapters/sync/feature_synchronizer_spec.rb +27 -0
  93. data/spec/flipper/cloud/configuration_spec.rb +6 -23
  94. data/spec/flipper/cloud/telemetry/backoff_policy_spec.rb +108 -0
  95. data/spec/flipper/cloud/telemetry/metric_spec.rb +87 -0
  96. data/spec/flipper/cloud/telemetry/metric_storage_spec.rb +58 -0
  97. data/spec/flipper/cloud/telemetry/submitter_spec.rb +145 -0
  98. data/spec/flipper/cloud/telemetry_spec.rb +156 -0
  99. data/spec/flipper/cloud_spec.rb +12 -12
  100. data/spec/flipper/configuration_spec.rb +17 -0
  101. data/spec/flipper/dsl_spec.rb +39 -0
  102. data/spec/flipper/engine_spec.rb +108 -7
  103. data/spec/flipper/exporters/json/v1_spec.rb +3 -3
  104. data/spec/flipper/expression/builder_spec.rb +248 -0
  105. data/spec/flipper/expression_spec.rb +188 -0
  106. data/spec/flipper/expressions/all_spec.rb +15 -0
  107. data/spec/flipper/expressions/any_spec.rb +15 -0
  108. data/spec/flipper/expressions/boolean_spec.rb +15 -0
  109. data/spec/flipper/expressions/duration_spec.rb +43 -0
  110. data/spec/flipper/expressions/equal_spec.rb +24 -0
  111. data/spec/flipper/expressions/greater_than_or_equal_to_spec.rb +28 -0
  112. data/spec/flipper/expressions/greater_than_spec.rb +28 -0
  113. data/spec/flipper/expressions/less_than_or_equal_to_spec.rb +28 -0
  114. data/spec/flipper/expressions/less_than_spec.rb +32 -0
  115. data/spec/flipper/expressions/not_equal_spec.rb +15 -0
  116. data/spec/flipper/expressions/now_spec.rb +11 -0
  117. data/spec/flipper/expressions/number_spec.rb +21 -0
  118. data/spec/flipper/expressions/percentage_of_actors_spec.rb +20 -0
  119. data/spec/flipper/expressions/percentage_spec.rb +15 -0
  120. data/spec/flipper/expressions/property_spec.rb +13 -0
  121. data/spec/flipper/expressions/random_spec.rb +9 -0
  122. data/spec/flipper/expressions/string_spec.rb +11 -0
  123. data/spec/flipper/expressions/time_spec.rb +13 -0
  124. data/spec/flipper/feature_spec.rb +360 -1
  125. data/spec/flipper/gate_values_spec.rb +2 -2
  126. data/spec/flipper/gates/expression_spec.rb +108 -0
  127. data/spec/flipper/identifier_spec.rb +4 -5
  128. data/spec/flipper/instrumentation/statsd_subscriber_spec.rb +15 -1
  129. data/spec/flipper/middleware/memoizer_spec.rb +67 -0
  130. data/spec/flipper/model/active_record_spec.rb +61 -0
  131. data/spec/flipper/serializers/gzip_spec.rb +13 -0
  132. data/spec/flipper/serializers/json_spec.rb +13 -0
  133. data/spec/flipper/typecast_spec.rb +43 -7
  134. data/spec/flipper/types/actor_spec.rb +18 -1
  135. data/spec/flipper_integration_spec.rb +102 -4
  136. data/spec/flipper_spec.rb +89 -1
  137. data/spec/spec_helper.rb +5 -0
  138. data/spec/support/actor_names.yml +1 -0
  139. data/spec/support/fake_backoff_policy.rb +15 -0
  140. data/spec/support/spec_helpers.rb +11 -3
  141. metadata +107 -18
  142. data/lib/flipper/cloud/instrumenter.rb +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bef9ba1845ca9f8186c9af57816c94309cdbc138e1e666a0dccbef5fba669682
4
- data.tar.gz: fbb79ccee4bdfd08e44c7eafe8052076dfd85c59959dd6c812473960bde0b95c
3
+ metadata.gz: a399f5f1ee9a91cdc05d7d47ac2b5a337e1f27ed076dbd39ff7ce952f445d80c
4
+ data.tar.gz: 129babef74f77cae24886e92078af369ee31652a3b41e14b5921d55a236e41ec
5
5
  SHA512:
6
- metadata.gz: 36693111d186b9581ce3b959b951c19db36f1f34dd220aebd1667adcfbf4916382983ccca63a44cdd9db9c0518aea53e6178a09e199db7dd25eee7ee796c07c0
7
- data.tar.gz: e9b95b9588f7b08ff3ed91db8583877bd087e28b5d5dd7c5ab9b09cd6c9f09b5632b2d6dace06d5d9a209f61b2b86a1f0aa775adea44b42c768294050c7149bd
6
+ metadata.gz: 0c5d6b3f364e5f50ff7e7df4642c3a31659be1f56bcb5a313b976fcfc677271536202454c890ef9e6b17be69cdaf750eeb73e02217122b986f23fb77694d4229
7
+ data.tar.gz: 0bce7c2195a3759034d3b46666bef74c3c808835a0dc27f8d8ab6cc2f99182f0a2751a9c0dd6d6c0522bd8f40754bfe2f36a001989311d9b62341c8dafcad4ff
@@ -0,0 +1 @@
1
+ github: flippercloud
@@ -16,10 +16,14 @@ jobs:
16
16
  strategy:
17
17
  matrix:
18
18
  ruby: ['2.6', '2.7', '3.0', '3.1', '3.2']
19
- rails: ['5.2', '6.0.0', '6.1.0', '7.0.0']
19
+ rails: ['5.2', '6.0.0', '6.1.0', '7.0.0', '7.1.0']
20
20
  exclude:
21
+ - ruby: "2.6"
22
+ rails: "7.1.0"
21
23
  - ruby: "2.6"
22
24
  rails: "7.0.0"
25
+ - ruby: "2.7"
26
+ rails: "7.1.0"
23
27
  - ruby: "3.0"
24
28
  rails: "5.2"
25
29
  - ruby: "3.1"
@@ -41,11 +45,11 @@ jobs:
41
45
  - name: Setup memcached
42
46
  uses: KeisukeYamashita/memcached-actions@v1
43
47
  - name: Start MongoDB
44
- uses: supercharge/mongodb-github-action@1.9.0
48
+ uses: supercharge/mongodb-github-action@v1.10.0
45
49
  with:
46
50
  mongodb-version: 4.0
47
51
  - name: Check out repository code
48
- uses: actions/checkout@v3
52
+ uses: actions/checkout@v4
49
53
  - name: Do some action caching
50
54
  uses: actions/cache@v3
51
55
  with:
@@ -16,18 +16,27 @@ jobs:
16
16
  --health-retries 5
17
17
  strategy:
18
18
  matrix:
19
- ruby: ['2.6', '2.7', '3.0', '3.1']
20
- rails: ['5.2', '6.0.0', '6.1.0', '7.0.0']
19
+ ruby: ['2.6', '2.7', '3.0', '3.1', '3.2']
20
+ rails: ['5.2', '6.0.0', '6.1.0', '7.0.0', '7.1.0']
21
21
  exclude:
22
+ - ruby: "2.6"
23
+ rails: "7.1.0"
22
24
  - ruby: "2.6"
23
25
  rails: "7.0.0"
26
+ - ruby: "2.7"
27
+ rails: "7.1.0"
24
28
  - ruby: "3.0"
25
29
  rails: "5.2"
26
30
  - ruby: "3.1"
27
31
  rails: "5.2"
28
32
  - ruby: "3.1"
29
33
  rails: "6.0.0"
30
-
34
+ - ruby: "3.2"
35
+ rails: "5.2"
36
+ - ruby: "3.2"
37
+ rails: "6.0.0"
38
+ - ruby: "3.2"
39
+ rails: "6.1.0"
31
40
  env:
32
41
  SQLITE3_VERSION: 1.4.1
33
42
  REDIS_URL: redis://localhost:6379/0
@@ -37,11 +46,11 @@ jobs:
37
46
  - name: Setup memcached
38
47
  uses: KeisukeYamashita/memcached-actions@v1
39
48
  - name: Start MongoDB
40
- uses: supercharge/mongodb-github-action@1.9.0
49
+ uses: supercharge/mongodb-github-action@v1.10.0
41
50
  with:
42
51
  mongodb-version: 4.0
43
52
  - name: Check out repository code
44
- uses: actions/checkout@v3
53
+ uses: actions/checkout@v4
45
54
  - name: Do some action caching
46
55
  uses: actions/cache@v3
47
56
  with:
@@ -59,4 +68,17 @@ jobs:
59
68
  - name: Run Examples with Rails ${{ matrix.rails }}
60
69
  env:
61
70
  FLIPPER_CLOUD_TOKEN: ${{ secrets.FLIPPER_CLOUD_TOKEN }}
71
+ FLIPPER_CLOUD_TOKEN_26_52: ${{ secrets.FLIPPER_CLOUD_TOKEN_26_52 }}
72
+ FLIPPER_CLOUD_TOKEN_26_60: ${{ secrets.FLIPPER_CLOUD_TOKEN_26_60 }}
73
+ FLIPPER_CLOUD_TOKEN_26_61: ${{ secrets.FLIPPER_CLOUD_TOKEN_26_61 }}
74
+ FLIPPER_CLOUD_TOKEN_27_52: ${{ secrets.FLIPPER_CLOUD_TOKEN_27_52 }}
75
+ FLIPPER_CLOUD_TOKEN_27_60: ${{ secrets.FLIPPER_CLOUD_TOKEN_27_60 }}
76
+ FLIPPER_CLOUD_TOKEN_27_61: ${{ secrets.FLIPPER_CLOUD_TOKEN_27_61 }}
77
+ FLIPPER_CLOUD_TOKEN_27_70: ${{ secrets.FLIPPER_CLOUD_TOKEN_27_70 }}
78
+ FLIPPER_CLOUD_TOKEN_30_60: ${{ secrets.FLIPPER_CLOUD_TOKEN_30_60 }}
79
+ FLIPPER_CLOUD_TOKEN_30_61: ${{ secrets.FLIPPER_CLOUD_TOKEN_30_61 }}
80
+ FLIPPER_CLOUD_TOKEN_30_70: ${{ secrets.FLIPPER_CLOUD_TOKEN_30_70 }}
81
+ FLIPPER_CLOUD_TOKEN_31_61: ${{ secrets.FLIPPER_CLOUD_TOKEN_31_61 }}
82
+ FLIPPER_CLOUD_TOKEN_31_70: ${{ secrets.FLIPPER_CLOUD_TOKEN_31_70 }}
83
+ RAILS_VERSION: ${{ matrix.rails }}
62
84
  run: script/examples