quonfig-openfeature 2.3.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43b628f81214e3ced11ab61bcce6a2a84d9dfe8abd1aaec2f90590466c8b5b5c
4
- data.tar.gz: 53464b81651916ed49c83ed88a95a94829e278ccbff56bfaa5236c4e89ab56a0
3
+ metadata.gz: 0cbd3b3c0fe2daefa00726f6192c6a11b3e8ff1297ccc6e6e1cabc10f8faacae
4
+ data.tar.gz: '00795bd93837094e1aa80f7a7cbf7a8d3df0e3b5147e1a1a7f9cedfef79e0d4f'
5
5
  SHA512:
6
- metadata.gz: 2db151d762fa6ae6be9c4197790153deba4b3a083b66101d24524de19c19952fbe6ba247dbf70a3504137c7c9c66243d3f6a144e6a6f8e97ef015352dea484b8
7
- data.tar.gz: f8434a2390cfd3d55848383562b874d2fd81e1353247df49c35262a76bed642e09d2adcca9c0fe5daf859fed4b3bd5c3c55321e661f9c997a2f19784feddc7f7
6
+ metadata.gz: e5a0f308f9e75a58769dc0b7afa1ae8d0439158ee227b974536e241378dfbbbaf15f1e2ce20ca41ab1abd0f3c23867171f8157440e2838cd412e63dd154ece7b
7
+ data.tar.gz: f3a2683ba8cc8bea44c05083b026f9a37e659526b76ae1866986b65ae3c9cde69f82325007e456d84114b524a58f522f15e3c4994f8fed21e081f9ce893b59a9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.0 - 2026-11-12
4
+
5
+ Requires quonfig (sdk-ruby) 2.2.0 or newer; the floor was `>= 2.1.0` (qfg-ln7d). sdk-ruby 2.2.0 is
6
+ the first release whose `*_details` and `evaluate_details` report a value that cannot be parsed as
7
+ `PARSE_ERROR` (qfg-wg1n), so the provider now maps the SDK's error code as-is:
8
+
9
+ - A malformed stored or ENV_VAR value comes back as OpenFeature `PARSE_ERROR` from the SDK in one
10
+ read, as before: your default, reason `ERROR`, and the SDK's message, variant and flag metadata.
11
+ - The workaround for older SDKs is gone. On a `TYPE_MISMATCH` the provider no longer checks the
12
+ stored `valueType` and reads the config a second time to tell a malformed value from a wrong-type
13
+ read. An SDK `TYPE_MISMATCH` is now always OpenFeature `TYPE_MISMATCH`.
14
+
15
+ What you get for each case is unchanged from 2.3.0 on sdk-ruby 2.2.0, and a `TYPE_MISMATCH` read is one SDK call
16
+ instead of two. This is a minor release because a runtime dependency floor moved.
17
+
18
+ The gem now requires Ruby 3.2 or newer (`required_ruby_version >= 3.2`; it was `>= 3.0`). Ruby 3.0
19
+ could not install it anyway, because `openfeature-sdk` needs Ruby 3.1 or newer. Ruby 3.1 reached end
20
+ of life in March 2025, and CI tests on 3.2. Raising the floor also lets Dependabot resolve this
21
+ repo's lockfile, since it resolves under the lowest Ruby the gemspec allows.
22
+
3
23
  ## 2.3.0 - 2026-10-29
4
24
 
5
25
  When sdk-ruby reports error code `PARSE_ERROR` for a value that did not parse (qfg-wg1n), the
data/README.md CHANGED
@@ -168,7 +168,7 @@ layout the integration test suite uses. No network or SDK key is required.
168
168
  ```ruby
169
169
  provider = Quonfig::OpenFeature::Provider.new(
170
170
  datadir: '/path/to/workspace',
171
- environment: 'Production',
171
+ environment: 'production',
172
172
  enable_sse: false
173
173
  )
174
174
  ```
@@ -180,6 +180,7 @@ bundle install
180
180
  bundle exec rake test
181
181
  ```
182
182
 
183
- The development `Gemfile` references the sibling `../sdk-ruby/` checkout via a
184
- `path:` reference; downstream consumers depend on the `quonfig` gem from
185
- RubyGems.
183
+ By default the `Gemfile` resolves the `quonfig` gem from RubyGems. To build
184
+ against a local sdk-ruby checkout, as CI does, set `QUONFIG_SDK_RUBY_PATH`
185
+ (for example `QUONFIG_SDK_RUBY_PATH=../sdk-ruby bundle install`), and don't
186
+ commit the `Gemfile.lock` that produces.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.4.0
@@ -56,37 +56,6 @@ module Quonfig
56
56
  ErrorCode = ::OpenFeature::SDK::Provider::ErrorCode
57
57
  ProviderMetadata = ::OpenFeature::SDK::Provider::ProviderMetadata
58
58
 
59
- # The stored +valueType+s each fetch method can read: its own type plus
60
- # the ones it converts exactly (int <-> double, duration -> ISO string).
61
- # A TYPE_MISMATCH on a config of one of these types means the value
62
- # did not parse, so it is reported as PARSE_ERROR (qfg-9xsl).
63
- READABLE_VALUE_TYPES = {
64
- boolean: %w[bool],
65
- string: %w[string log_level duration],
66
- integer: %w[int double],
67
- float: %w[double int],
68
- number: %w[int double],
69
- object: %w[string_list json]
70
- }.freeze
71
-
72
- # The native details getter that reads each stored +valueType+ as itself.
73
- NATIVE_DETAILS_GETTER = {
74
- 'bool' => :get_bool_details,
75
- 'string' => :get_string_details,
76
- 'log_level' => :get_string_details,
77
- 'duration' => :get_duration_details,
78
- 'int' => :get_int_details,
79
- 'double' => :get_float_details,
80
- 'string_list' => :get_string_list_details,
81
- 'json' => :get_json_details
82
- }.freeze
83
- # sdk-ruby's error code for a value that did not parse (a malformed
84
- # stored value or ENV_VAR value, qfg-wg1n). Matched as a string: the
85
- # quonfig floor (2.1.0) defines no constant for it and never emits it,
86
- # so with that SDK the TYPE_MISMATCH re-read in #malformed? still applies.
87
- SDK_PARSE_ERROR = 'PARSE_ERROR'
88
- private_constant :READABLE_VALUE_TYPES, :NATIVE_DETAILS_GETTER, :SDK_PARSE_ERROR
89
-
90
59
  attr_reader :metadata, :targeting_key_mapping
91
60
 
92
61
  # @param sdk_key [String, nil] SDK key for the live delivery service.
@@ -149,7 +118,7 @@ module Quonfig
149
118
  def fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil)
150
119
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
151
120
  details = client.get_bool_details(flag_key, context: mapped_ctx)
152
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :boolean, details))
121
+ to_resolution(details, default_value)
153
122
  end
154
123
  end
155
124
 
@@ -160,7 +129,7 @@ module Quonfig
160
129
  next duration_iso_resolution(client, flag_key, mapped_ctx, default_value) if stored_value_type(client, flag_key) == 'duration'
161
130
 
162
131
  details = client.get_string_details(flag_key, context: mapped_ctx)
163
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :string, details))
132
+ to_resolution(details, default_value)
164
133
  end
165
134
  end
166
135
 
@@ -171,21 +140,21 @@ module Quonfig
171
140
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
172
141
  details = client.get_int_details(flag_key, context: mapped_ctx)
173
142
  details = client.get_float_details(flag_key, context: mapped_ctx) if details.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
174
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :number, details))
143
+ to_resolution(details, default_value)
175
144
  end
176
145
  end
177
146
 
178
147
  def fetch_integer_value(flag_key:, default_value:, evaluation_context: nil)
179
148
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
180
149
  details = client.get_int_details(flag_key, context: mapped_ctx)
181
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :integer, details))
150
+ to_resolution(details, default_value)
182
151
  end
183
152
  end
184
153
 
185
154
  def fetch_float_value(flag_key:, default_value:, evaluation_context: nil)
186
155
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
187
156
  details = client.get_float_details(flag_key, context: mapped_ctx)
188
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :float, details))
157
+ to_resolution(details, default_value)
189
158
  end
190
159
  end
191
160
 
@@ -196,7 +165,7 @@ module Quonfig
196
165
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
197
166
  details = client.get_string_list_details(flag_key, context: mapped_ctx)
198
167
  details = client.get_json_details(flag_key, context: mapped_ctx) if details.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
199
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :object, details))
168
+ to_resolution(details, default_value)
200
169
  end
201
170
  end
202
171
 
@@ -237,25 +206,6 @@ module Quonfig
237
206
  end
238
207
  end
239
208
 
240
- # True when +details+ is a TYPE_MISMATCH for a config whose value has a
241
- # type +kind+ can read but did not parse: a stored int "twelve", an int
242
- # ENV_VAR set to "twelve", a duration "30s" (qfg-9xsl). sdk-ruby's
243
- # *_details report a malformed value and a wrong-type read alike as
244
- # TYPE_MISMATCH, so this checks the stored +valueType+ and reads the
245
- # config with the getter for that type: if that read fails too, the
246
- # value is malformed. A config of a type +kind+ cannot read stays
247
- # TYPE_MISMATCH, and so does a value that parsed but does not convert
248
- # exactly (fetch_integer_value on a 3.9 double).
249
- def malformed?(client, flag_key, mapped_ctx, kind, details)
250
- return false unless details.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
251
-
252
- value_type = stored_value_type(client, flag_key)
253
- return false unless READABLE_VALUE_TYPES.fetch(kind).include?(value_type)
254
-
255
- native = client.public_send(NATIVE_DETAILS_GETTER.fetch(value_type), flag_key, context: mapped_ctx)
256
- native.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
257
- end
258
-
259
209
  # Read a duration config as its ISO 8601 text with one evaluation:
260
210
  # sdk-ruby's evaluate_details (quonfig >= 2.1.0) returns the resolved
261
211
  # value in stored form, so the text is the stored text, or an ENV_VAR's
@@ -266,18 +216,13 @@ module Quonfig
266
216
  # * valid text: the text, with the evaluation's reason, variant and
267
217
  # flag_metadata.
268
218
  # * malformed stored text ("30s"): the default with PARSE_ERROR.
269
- # * malformed ENV_VAR: evaluate_details reports ERROR / TYPE_MISMATCH,
270
- # which on a duration config can only mean a value that did not
271
- # parse, so it is PARSE_ERROR too.
219
+ # * an evaluation error, such as a malformed ENV_VAR (PARSE_ERROR from
220
+ # quonfig >= 2.2.0): the SDK's error code, mapped as-is.
272
221
  # * the structured { seconds, nanos } shape has no ISO text: the
273
222
  # default with TYPE_MISMATCH.
274
223
  def duration_iso_resolution(client, flag_key, mapped_ctx, default_value)
275
224
  details = client.evaluate_details(flag_key, context: mapped_ctx)
276
- if details.reason == ::Quonfig::EvaluationDetails::REASON_ERROR
277
- parse_error = details.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
278
- return to_resolution(details, default_value, parse_error: parse_error)
279
- end
280
- return to_resolution(details, default_value) if details.reason == ::Quonfig::EvaluationDetails::REASON_DEFAULT
225
+ return to_resolution(details, default_value) if [::Quonfig::EvaluationDetails::REASON_ERROR, ::Quonfig::EvaluationDetails::REASON_DEFAULT].include?(details.reason)
281
226
 
282
227
  value = details.value
283
228
  return to_resolution(details, default_value) if value.is_a?(String) && ::Quonfig::Duration.valid?(value)
@@ -297,10 +242,9 @@ module Quonfig
297
242
 
298
243
  # Map a Quonfig::EvaluationDetails to the OpenFeature ResolutionDetails
299
244
  # the SDK consumes. The Quonfig SDK's *_details methods don't raise, so
300
- # this is a pure mapping layer. +parse_error+ reports an ERROR as
301
- # PARSE_ERROR (see #malformed?); an SDK PARSE_ERROR passes straight
302
- # through in #map_error_code.
303
- def to_resolution(details, default_value, parse_error: false)
245
+ # this is a pure mapping layer: the SDK's error code is mapped as-is, so
246
+ # an SDK PARSE_ERROR (quonfig >= 2.2.0) passes straight through.
247
+ def to_resolution(details, default_value)
304
248
  variant = details.variant
305
249
  flag_metadata = details.flag_metadata || {}
306
250
  case details.reason
@@ -320,7 +264,7 @@ module Quonfig
320
264
  ResolutionDetails.new(
321
265
  value: default_value,
322
266
  reason: Reason::ERROR,
323
- error_code: parse_error ? ErrorCode::PARSE_ERROR : map_error_code(details.error_code),
267
+ error_code: map_error_code(details.error_code),
324
268
  error_message: details.error_message,
325
269
  variant: variant,
326
270
  flag_metadata: flag_metadata
@@ -344,7 +288,7 @@ module Quonfig
344
288
  when ::Quonfig::EvaluationDetails::ERROR_FLAG_NOT_FOUND then ErrorCode::FLAG_NOT_FOUND
345
289
  when ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH then ErrorCode::TYPE_MISMATCH
346
290
  when ::Quonfig::EvaluationDetails::ERROR_PROVIDER_NOT_READY then ErrorCode::PROVIDER_NOT_READY
347
- when SDK_PARSE_ERROR then ErrorCode::PARSE_ERROR
291
+ when ::Quonfig::EvaluationDetails::ERROR_PARSE_ERROR then ErrorCode::PARSE_ERROR
348
292
  else ErrorCode::GENERAL
349
293
  end
350
294
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quonfig-openfeature
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dwyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-29 00:00:00.000000000 Z
11
+ date: 2026-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: openfeature-sdk
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.1.0
33
+ version: 2.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 2.1.0
40
+ version: 2.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
- version: '3.0'
113
+ version: '3.2'
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - ">="