unleash 4.6.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f7e5c9cc285cd8b5d030f115babe035a65540a63aea7f2c0500d845afe74af1
4
- data.tar.gz: ec93948ce1eed18fc20ac93e8a9bb944ae6080a1740f58910d6689305d1cc72e
3
+ metadata.gz: 46123d78efc7bf615f2ccf84d20087a6680b7999fed0e4b4e22014b044b7d455
4
+ data.tar.gz: 9992d9a6da906ab49b7ab5cfb9b8521c3f8bdd849ac76099153157debe3a989b
5
5
  SHA512:
6
- metadata.gz: cabaff808990418367c85b739b5994f3d0010ee61415b5d9e6dfcea9e3b808b3b9d9e6bd05d07a0fd9bacc9423d909e52393e1a42ea671a95acfa7e45b4c80f4
7
- data.tar.gz: fdb3553cb10738d0db2be4a8f1bbd01181eb32abcb790420cbd6961c7f0df76841e7abfa88a29a829554d0baa3374db2f46fe87e068f380187bdbcc94d77fc03
6
+ metadata.gz: 49a49172df9366a14e26ae3d5486347fd9bf0cab8b154139bceb642a5f586ac2e01b617c4756c8e64a48a96d7f93605e686d98092ba86cd1db5bcb4e24142641
7
+ data.tar.gz: eb53f5f237afe96847ac14cc9af19a4d517c63e874cc829c957bf729e80cdf05f5d251393d918e36ccedc1e15ad0e8933923b5561674126c518a6322ea0956ad
@@ -50,7 +50,7 @@ jobs:
50
50
  - name: Install dependencies
51
51
  run: bundle install
52
52
  - name: Download test cases
53
- run: git clone --depth 5 --branch v4.5.1 https://github.com/Unleash/client-specification.git client-specification
53
+ run: git clone --depth 5 --branch v5.0.2 https://github.com/Unleash/client-specification.git client-specification
54
54
  - name: Run tests
55
55
  run: bundle exec rake
56
56
  env:
data/CHANGELOG.md CHANGED
@@ -13,6 +13,12 @@ Note: These changes are not considered notable:
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [5.0.0] - 2023-10-30
17
+ ### Added
18
+ - change seed for variantutils to ensure fair distribution (#160)
19
+ - client specification is [here](https://github.com/Unleash/client-specification/tree/v5.0.2/specifications)
20
+ - A new seed is introduced to ensure a fair distribution for variants, addressing the issue of skewed variant distribution due to using the same hash string for both gradual rollout and variant allocation.
21
+
16
22
  ## [4.6.0] - 2023-10-16
17
23
  ### Added
18
24
  - dependant toggles (#155)
data/README.md CHANGED
@@ -25,7 +25,7 @@ Leverage the [Unleash Server](https://github.com/Unleash/unleash) for powerful f
25
25
  Add this line to your application's Gemfile:
26
26
 
27
27
  ```ruby
28
- gem 'unleash', '~> 4.6.0'
28
+ gem 'unleash', '~> 5.0.0'
29
29
  ```
30
30
 
31
31
  And then execute:
@@ -528,7 +528,7 @@ You can also run `bin/console` for an interactive prompt that will allow you to
528
528
  This SDK is also built against the Unleash Client Specification tests.
529
529
  To run the Ruby SDK against this test suite, you'll need to have a copy on your machine, you can clone the repository directly using:
530
530
 
531
- `git clone --depth 5 --branch v4.5.1 https://github.com/Unleash/client-specification.git client-specification`
531
+ `git clone --depth 5 --branch v5.0.2 https://github.com/Unleash/client-specification.git client-specification`
532
532
 
533
533
  After doing this, `rake spec` will also run the client specification tests.
534
534
 
@@ -555,3 +555,5 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/unleas
555
555
  Be sure to run both `bundle exec rspec` and `bundle exec rubocop` in your branch before creating a pull request.
556
556
 
557
557
  Please include tests with any pull requests, to avoid regressions.
558
+
559
+ Check out our guide for more information on how to build and scale [feature flag systems](https://docs.getunleash.io/topics/feature-flags/feature-flag-best-practices)
@@ -53,7 +53,7 @@ module Unleash
53
53
  {
54
54
  'UNLEASH-INSTANCEID' => self.instance_id,
55
55
  'UNLEASH-APPNAME' => self.app_name,
56
- 'Unleash-Client-Spec' => '4.5.1'
56
+ 'Unleash-Client-Spec' => '5.0.2'
57
57
  }.merge!(generate_custom_http_headers)
58
58
  end
59
59
 
@@ -107,7 +107,7 @@ module Unleash
107
107
  context_value = context.get_by_name(self.context_name)
108
108
 
109
109
  v.map!(&:upcase) if self.case_insensitive
110
- context_value.upcase! if self.case_insensitive
110
+ context_value = context_value.upcase if self.case_insensitive
111
111
 
112
112
  OPERATORS[self.operator].call(context_value, v)
113
113
  end
@@ -163,6 +163,7 @@ module Unleash
163
163
  variant_weight = Unleash::Strategy::Util.get_normalized_number(
164
164
  variant_salt(context, stickiness),
165
165
  group_id,
166
+ Unleash::Strategy::Util::VARIANT_NORMALIZER_SEED,
166
167
  sum_variant_defs_weights(variant_definitions)
167
168
  )
168
169
  prev_weights = 0
@@ -24,7 +24,7 @@ module Unleash
24
24
  end
25
25
 
26
26
  group_id = params.fetch('groupId', '')
27
- normalized_number = Util.get_normalized_number(stickiness_id, group_id)
27
+ normalized_number = Util.get_normalized_number(stickiness_id, group_id, 0)
28
28
 
29
29
  return false if stickiness_id.nil?
30
30
 
@@ -14,7 +14,7 @@ module Unleash
14
14
  return false if context.session_id.nil? || context.session_id.empty?
15
15
 
16
16
  percentage = Integer(params['percentage'] || 0)
17
- (percentage.positive? && Util.get_normalized_number(context.session_id, params['groupId'] || "") <= percentage)
17
+ (percentage.positive? && Util.get_normalized_number(context.session_id, params['groupId'] || "", 0) <= percentage)
18
18
  end
19
19
  end
20
20
  end
@@ -14,7 +14,7 @@ module Unleash
14
14
  return false if context.user_id.nil? || context.user_id.empty?
15
15
 
16
16
  percentage = Integer(params['percentage'] || 0)
17
- (percentage.positive? && Util.get_normalized_number(context.user_id, params['groupId'] || "") <= percentage)
17
+ (percentage.positive? && Util.get_normalized_number(context.user_id, params['groupId'] || "", 0) <= percentage)
18
18
  end
19
19
  end
20
20
  end
@@ -6,10 +6,11 @@ module Unleash
6
6
  module_function
7
7
 
8
8
  NORMALIZER = 100
9
+ VARIANT_NORMALIZER_SEED = 86_028_157
9
10
 
10
11
  # convert the two strings () into a number between 1 and base (100 by default)
11
- def get_normalized_number(identifier, group_id, base = NORMALIZER)
12
- MurmurHash3::V32.str_hash("#{group_id}:#{identifier}") % base + 1
12
+ def get_normalized_number(identifier, group_id, seed, base = NORMALIZER)
13
+ MurmurHash3::V32.str_hash("#{group_id}:#{identifier}", seed) % base + 1
13
14
  end
14
15
  end
15
16
  end
@@ -1,3 +1,3 @@
1
1
  module Unleash
2
- VERSION = "4.6.0".freeze
2
+ VERSION = "5.0.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unleash
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renato Arruda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-16 00:00:00.000000000 Z
11
+ date: 2023-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: murmurhash3