quonfig-openfeature 2.2.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: d4a4af7330ac53ebeb637ed61d4c7cd0530bcfe62db92b845e5233d105496a3b
4
- data.tar.gz: 7761829a3596aace1dad718f622b1156656079fd9ffe15123fcf0114c06e9837
3
+ metadata.gz: 0cbd3b3c0fe2daefa00726f6192c6a11b3e8ff1297ccc6e6e1cabc10f8faacae
4
+ data.tar.gz: '00795bd93837094e1aa80f7a7cbf7a8d3df0e3b5147e1a1a7f9cedfef79e0d4f'
5
5
  SHA512:
6
- metadata.gz: 1de71990148d10403dcc3559f5a2d07d16a73a3c6c920e1fc38bdd282a8ba2fbd2d6e9e10524c1b8f04195c337918757f51d94365ec8368824aaccc52da17e8e
7
- data.tar.gz: 80802c8ddb10fada30d464bbbaf55a9b45e45d05a819980dd555d601568c01003b2d8de9aa5c3f970727e39a4e0d5bcfe5c370d29b82bd11db4b33de987d5ae0
6
+ metadata.gz: e5a0f308f9e75a58769dc0b7afa1ae8d0439158ee227b974536e241378dfbbbaf15f1e2ce20ca41ab1abd0f3c23867171f8157440e2838cd412e63dd154ece7b
7
+ data.tar.gz: f3a2683ba8cc8bea44c05083b026f9a37e659526b76ae1866986b65ae3c9cde69f82325007e456d84114b524a58f522f15e3c4994f8fed21e081f9ce893b59a9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
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
+
23
+ ## 2.3.0 - 2026-10-29
24
+
25
+ When sdk-ruby reports error code `PARSE_ERROR` for a value that did not parse (qfg-wg1n), the
26
+ provider now returns it as OpenFeature `PARSE_ERROR` in one read: your default, reason `ERROR`, and
27
+ the SDK's message, variant and flag metadata. Before, an SDK `PARSE_ERROR` came back as `GENERAL`.
28
+
29
+ Nothing changes with the sdk-ruby you run today. sdk-ruby 2.1.0 reports a malformed value as
30
+ `TYPE_MISMATCH`, and the provider still tells the two apart as in 2.1.0: it checks the stored
31
+ `valueType` and reads the config again with the getter for that type. The `quonfig` floor stays
32
+ `>= 2.1.0`.
33
+
3
34
  ## 2.2.0 - 2026-10-29
4
35
 
5
36
  `fetch_string_value` on a `duration` config returns its stored ISO 8601 text again (reason
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.2.0
1
+ 2.4.0
@@ -56,32 +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
- private_constant :READABLE_VALUE_TYPES, :NATIVE_DETAILS_GETTER
84
-
85
59
  attr_reader :metadata, :targeting_key_mapping
86
60
 
87
61
  # @param sdk_key [String, nil] SDK key for the live delivery service.
@@ -144,7 +118,7 @@ module Quonfig
144
118
  def fetch_boolean_value(flag_key:, default_value:, evaluation_context: nil)
145
119
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
146
120
  details = client.get_bool_details(flag_key, context: mapped_ctx)
147
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :boolean, details))
121
+ to_resolution(details, default_value)
148
122
  end
149
123
  end
150
124
 
@@ -155,7 +129,7 @@ module Quonfig
155
129
  next duration_iso_resolution(client, flag_key, mapped_ctx, default_value) if stored_value_type(client, flag_key) == 'duration'
156
130
 
157
131
  details = client.get_string_details(flag_key, context: mapped_ctx)
158
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :string, details))
132
+ to_resolution(details, default_value)
159
133
  end
160
134
  end
161
135
 
@@ -166,21 +140,21 @@ module Quonfig
166
140
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
167
141
  details = client.get_int_details(flag_key, context: mapped_ctx)
168
142
  details = client.get_float_details(flag_key, context: mapped_ctx) if details.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
169
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :number, details))
143
+ to_resolution(details, default_value)
170
144
  end
171
145
  end
172
146
 
173
147
  def fetch_integer_value(flag_key:, default_value:, evaluation_context: nil)
174
148
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
175
149
  details = client.get_int_details(flag_key, context: mapped_ctx)
176
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :integer, details))
150
+ to_resolution(details, default_value)
177
151
  end
178
152
  end
179
153
 
180
154
  def fetch_float_value(flag_key:, default_value:, evaluation_context: nil)
181
155
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
182
156
  details = client.get_float_details(flag_key, context: mapped_ctx)
183
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :float, details))
157
+ to_resolution(details, default_value)
184
158
  end
185
159
  end
186
160
 
@@ -191,7 +165,7 @@ module Quonfig
191
165
  evaluate(flag_key, default_value, evaluation_context) do |client, mapped_ctx|
192
166
  details = client.get_string_list_details(flag_key, context: mapped_ctx)
193
167
  details = client.get_json_details(flag_key, context: mapped_ctx) if details.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
194
- to_resolution(details, default_value, parse_error: malformed?(client, flag_key, mapped_ctx, :object, details))
168
+ to_resolution(details, default_value)
195
169
  end
196
170
  end
197
171
 
@@ -232,25 +206,6 @@ module Quonfig
232
206
  end
233
207
  end
234
208
 
235
- # True when +details+ is a TYPE_MISMATCH for a config whose value has a
236
- # type +kind+ can read but did not parse: a stored int "twelve", an int
237
- # ENV_VAR set to "twelve", a duration "30s" (qfg-9xsl). sdk-ruby's
238
- # *_details report a malformed value and a wrong-type read alike as
239
- # TYPE_MISMATCH, so this checks the stored +valueType+ and reads the
240
- # config with the getter for that type: if that read fails too, the
241
- # value is malformed. A config of a type +kind+ cannot read stays
242
- # TYPE_MISMATCH, and so does a value that parsed but does not convert
243
- # exactly (fetch_integer_value on a 3.9 double).
244
- def malformed?(client, flag_key, mapped_ctx, kind, details)
245
- return false unless details.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
246
-
247
- value_type = stored_value_type(client, flag_key)
248
- return false unless READABLE_VALUE_TYPES.fetch(kind).include?(value_type)
249
-
250
- native = client.public_send(NATIVE_DETAILS_GETTER.fetch(value_type), flag_key, context: mapped_ctx)
251
- native.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
252
- end
253
-
254
209
  # Read a duration config as its ISO 8601 text with one evaluation:
255
210
  # sdk-ruby's evaluate_details (quonfig >= 2.1.0) returns the resolved
256
211
  # value in stored form, so the text is the stored text, or an ENV_VAR's
@@ -261,18 +216,13 @@ module Quonfig
261
216
  # * valid text: the text, with the evaluation's reason, variant and
262
217
  # flag_metadata.
263
218
  # * malformed stored text ("30s"): the default with PARSE_ERROR.
264
- # * malformed ENV_VAR: evaluate_details reports ERROR / TYPE_MISMATCH,
265
- # which on a duration config can only mean a value that did not
266
- # 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.
267
221
  # * the structured { seconds, nanos } shape has no ISO text: the
268
222
  # default with TYPE_MISMATCH.
269
223
  def duration_iso_resolution(client, flag_key, mapped_ctx, default_value)
270
224
  details = client.evaluate_details(flag_key, context: mapped_ctx)
271
- if details.reason == ::Quonfig::EvaluationDetails::REASON_ERROR
272
- parse_error = details.error_code == ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH
273
- return to_resolution(details, default_value, parse_error: parse_error)
274
- end
275
- 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)
276
226
 
277
227
  value = details.value
278
228
  return to_resolution(details, default_value) if value.is_a?(String) && ::Quonfig::Duration.valid?(value)
@@ -292,9 +242,9 @@ module Quonfig
292
242
 
293
243
  # Map a Quonfig::EvaluationDetails to the OpenFeature ResolutionDetails
294
244
  # the SDK consumes. The Quonfig SDK's *_details methods don't raise, so
295
- # this is a pure mapping layer. +parse_error+ reports an ERROR as
296
- # PARSE_ERROR (see #malformed?).
297
- 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)
298
248
  variant = details.variant
299
249
  flag_metadata = details.flag_metadata || {}
300
250
  case details.reason
@@ -314,7 +264,7 @@ module Quonfig
314
264
  ResolutionDetails.new(
315
265
  value: default_value,
316
266
  reason: Reason::ERROR,
317
- error_code: parse_error ? ErrorCode::PARSE_ERROR : map_error_code(details.error_code),
267
+ error_code: map_error_code(details.error_code),
318
268
  error_message: details.error_message,
319
269
  variant: variant,
320
270
  flag_metadata: flag_metadata
@@ -338,6 +288,7 @@ module Quonfig
338
288
  when ::Quonfig::EvaluationDetails::ERROR_FLAG_NOT_FOUND then ErrorCode::FLAG_NOT_FOUND
339
289
  when ::Quonfig::EvaluationDetails::ERROR_TYPE_MISMATCH then ErrorCode::TYPE_MISMATCH
340
290
  when ::Quonfig::EvaluationDetails::ERROR_PROVIDER_NOT_READY then ErrorCode::PROVIDER_NOT_READY
291
+ when ::Quonfig::EvaluationDetails::ERROR_PARSE_ERROR then ErrorCode::PARSE_ERROR
341
292
  else ErrorCode::GENERAL
342
293
  end
343
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.2.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
  - - ">="