featureflip-openfeature 0.1.0 → 0.2.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: f6fa5f7d072f5f820620ac950eda71f01af344681916c8fd152229a881a0f142
4
- data.tar.gz: bc9efccb44950cc991d5aabf9594f245075fb205ecc3a0c48f8ba34de2198f87
3
+ metadata.gz: 60a16a735d2bf5e3244e1514bfc21449a29b858bae3913c18b9bfdb207976e6a
4
+ data.tar.gz: 900c8ac04388a49d1373f30f3259ae2d094be802919a3ab1adcbb8d3d1a8a8f5
5
5
  SHA512:
6
- metadata.gz: 7dda6c5cf1cb568b1632b8d8d4fe4af625ccf917236cb0f3ce4cdd4040c01f6ea5ebf07d0670d6ce8170484429eeb3984176cfdab6d701f66f6c9e5a97ae9e83
7
- data.tar.gz: 754d476ea0e98b5421f21b4e786ce10efaf2acf8664dfce812fdb849e8811e6e593f04d198ebe6758a19ae2ff688b3bc140fe01316988b5ffd0bf66a18576532
6
+ metadata.gz: a6ceab1d48a085aa47653b74573ab0a18f52f828269816e40b378026a2955e5aa7b6d1e49a63ee345167fab47cfba82c5c90516c8763fa51fe2f315484b6e82f
7
+ data.tar.gz: 772885e6e9f044e5a141397b0ffebbb997c0aad42d119e279330a8bdd8c28f2399686b9e148ba0db382914a2b35047f2160371b7a8a9a2500427f2280d5d158b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 — 2026-10-20
4
+
5
+ ### Added
6
+
7
+ - Requests made through the provider now identify it: `User-Agent: featureflip-ruby/<version> featureflip-openfeature-ruby/<version>`, so Featureflip can count OpenFeature usage apart from direct SDK use. This applies when the provider builds its own client from `sdk_key:`; it works on a copy of your `Featureflip::Config`, so the config you passed is unchanged. A `client:` you pass in was built before the provider saw it, so its requests are unchanged, and a `wrapper_name:` already set on your config is kept. (#4154)
8
+
9
+ ### Changed
10
+
11
+ - Requires `featureflip` `~> 2.11`, the release that added `wrapper_name:`.
12
+
3
13
  ## 0.1.0 — 2026-10-10
4
14
 
5
15
  ### Added
data/README.md CHANGED
@@ -59,6 +59,12 @@ fork leaves each worker with dead polling and streaming threads, so it serves
59
59
  the boot snapshot and never emits `PROVIDER_CONFIGURATION_CHANGED`. If you pass
60
60
  your own `client:`, call `client.restart` in that hook instead.
61
61
 
62
+ The SDK keeps one client core per SDK key in each process. So if your app also
63
+ builds a client for the same key before the fork, say with
64
+ `Featureflip.configure` in a Rails initializer, the provider registered after
65
+ the fork picks up that inherited core, dead threads and all. Call
66
+ `Featureflip.restart` in the same hook to bring it back to life.
67
+
62
68
  Full documentation: https://featureflip.io/docs/integrations/openfeature/#ruby
63
69
 
64
70
  ## License
@@ -60,7 +60,7 @@ module Featureflip
60
60
  generation = @state_mutex.synchronize { @shut_down ? nil : @generation }
61
61
  return nil if generation.nil?
62
62
 
63
- @client ||= Featureflip::Client.get(@sdk_key, config: @config)
63
+ @client ||= Featureflip::Client.get(@sdk_key, config: identified_config)
64
64
  # Subscribed after the client is ready, so the initial load is never a
65
65
  # "change" (OpenFeature signals it with PROVIDER_READY). Guarded because
66
66
  # OpenFeature may initialize a provider more than once. The listener can
@@ -118,7 +118,8 @@ module Featureflip
118
118
  resolve(:object, flag_key, default_value, evaluation_context)
119
119
  end
120
120
 
121
- # Called by openfeature-sdk 0.6.1+; 0.5 has no tracking API and never calls it.
121
+ # Called by openfeature-sdk 0.6.1+, the release that added the tracking API.
122
+ # Earlier versions never call it.
122
123
  def track(tracking_event_name, evaluation_context: nil, tracking_event_details: nil)
123
124
  client = @client
124
125
  return if client.nil?
@@ -133,6 +134,25 @@ module Featureflip
133
134
 
134
135
  private
135
136
 
137
+ WRAPPER_NAME = "featureflip-openfeature-ruby"
138
+
139
+ # The caller's config (or a default one) naming this provider as the SDK's
140
+ # wrapper, so requests read "featureflip-ruby/<v> featureflip-openfeature-ruby/<v>"
141
+ # (#4154). A copy, so a config the caller reuses for direct SDK clients is not
142
+ # relabelled, with the SDK's memoized user agent cleared so the copy does not
143
+ # inherit the caller's. A wrapper the caller already set is kept: the SDK
144
+ # carries one, and theirs is the more specific. Only the sdk_key: form gets
145
+ # here; a borrowed client was built before the provider saw it.
146
+ def identified_config
147
+ return @config if @config&.wrapper_name
148
+
149
+ copy = @config ? @config.dup : Featureflip::Config.new
150
+ copy.remove_instance_variable(:@user_agent) if copy.instance_variable_defined?(:@user_agent)
151
+ copy.wrapper_name = WRAPPER_NAME
152
+ copy.wrapper_version = VERSION
153
+ copy
154
+ end
155
+
136
156
  # Reads UNTYPED via variation_detail and applies the type guard here. The
137
157
  # SDK's typed accessors report a wrong-typed value as reason "Error", the
138
158
  # same reason a real failure carries, so TYPE_MISMATCH could not be told
@@ -2,6 +2,6 @@ module Featureflip
2
2
  module OpenFeature
3
3
  # Rewritten from the release tag at publish time; the committed value is
4
4
  # convention, the tag is what ships.
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featureflip-openfeature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Featureflip
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-11 00:00:00.000000000 Z
11
+ date: 2026-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: featureflip
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.10'
19
+ version: '2.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.10'
26
+ version: '2.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: openfeature-sdk
29
29
  requirement: !ruby/object:Gem::Requirement