openfeature-sdk 0.5.1 → 0.6.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 +4 -4
- data/.release-please-manifest.json +1 -1
- data/.ruby-version +1 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +11 -0
- data/CLAUDE.md +26 -47
- data/Gemfile.lock +58 -43
- data/README.md +4 -5
- data/lib/open_feature/sdk/client_metadata.rb +2 -0
- data/lib/open_feature/sdk/evaluation_context.rb +2 -0
- data/lib/open_feature/sdk/evaluation_context_builder.rb +2 -0
- data/lib/open_feature/sdk/evaluation_details.rb +2 -0
- data/lib/open_feature/sdk/provider/error_code.rb +2 -0
- data/lib/open_feature/sdk/provider/in_memory_provider.rb +2 -0
- data/lib/open_feature/sdk/provider/provider_metadata.rb +2 -0
- data/lib/open_feature/sdk/provider/reason.rb +2 -0
- data/lib/open_feature/sdk/provider/resolution_details.rb +2 -0
- data/lib/open_feature/sdk/provider.rb +2 -0
- data/lib/open_feature/sdk/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af657f35506e7f76184269c57877bbe87cb75f03a2e697e228e9b48f0b2bb17c
|
|
4
|
+
data.tar.gz: 57944d4c3a74838e73a1f55b4f06e9b82ec4b5186c76ad000577504b30d72d88
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8dc359e5bb318d79e2fcb48bc0c393c055578cf0a331b02bc61f82910b3da973eaf487457db80d9cd73f12303b15a77cbef9062481933c3d7b4c305de0ed1cc2
|
|
7
|
+
data.tar.gz: c733ce2f12dbd64ad9fd4e42a5c6cd17c805aa0ab746408c222aee42e6af5ba385ff92baf6cffbf79e4e949dbd7e6b5b2c67937694717ef5b41396353b9f9391
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.1
|
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby
|
|
1
|
+
ruby 4.0.1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.6.0](https://github.com/open-feature/ruby-sdk/compare/v0.5.1...v0.6.0) (2026-03-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* add Ruby 4.0 support, require minimum Ruby 3.4 ([#217](https://github.com/open-feature/ruby-sdk/issues/217))
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add Ruby 4.0 support, require minimum Ruby 3.4 ([#217](https://github.com/open-feature/ruby-sdk/issues/217)) ([f38ba40](https://github.com/open-feature/ruby-sdk/commit/f38ba40b31beb650ba475c631947fc7969e476fa))
|
|
13
|
+
|
|
3
14
|
## [0.5.1](https://github.com/open-feature/ruby-sdk/compare/v0.5.0...v0.5.1) (2026-03-04)
|
|
4
15
|
|
|
5
16
|
|
data/CLAUDE.md
CHANGED
|
@@ -2,71 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
6
|
|
|
7
|
-
OpenFeature Ruby
|
|
7
|
+
This is the official OpenFeature SDK for Ruby — an implementation of the [OpenFeature specification](https://openfeature.dev) providing a vendor-agnostic API for feature flag evaluation. Published as the `openfeature-sdk` gem. Requires Ruby >= 3.1.
|
|
8
8
|
|
|
9
9
|
## Commands
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
bundle
|
|
11
|
+
- **Run all tests:** `bundle exec rspec`
|
|
12
|
+
- **Run a single test file:** `bundle exec rspec spec/open_feature/sdk/client_spec.rb`
|
|
13
|
+
- **Run a specific test by line:** `bundle exec rspec spec/open_feature/sdk/client_spec.rb:43`
|
|
14
|
+
- **Lint:** `bundle exec standardrb`
|
|
15
|
+
- **Lint with autofix:** `bundle exec standardrb --fix`
|
|
16
|
+
- **Default rake (tests + lint):** `bundle exec rake`
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
bundle exec rake
|
|
18
|
+
Note: Linting uses [Standard Ruby](https://github.com/standardrb/standard) (configured via the `standard` gem), which enforces double-quoted strings and its own opinionated style. There is no `.rubocop.yml` — Standard manages RuboCop configuration internally. Do not use `bundle exec rubocop` directly as a stale RuboCop server may apply different rules; always use `bundle exec standardrb`.
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
bundle exec rspec
|
|
20
|
-
|
|
21
|
-
# Run a single test file
|
|
22
|
-
bundle exec rspec spec/open_feature/sdk/client_spec.rb
|
|
23
|
-
|
|
24
|
-
# Run a specific test by line number
|
|
25
|
-
bundle exec rspec spec/open_feature/sdk/client_spec.rb:40
|
|
26
|
-
|
|
27
|
-
# Lint (StandardRB with performance plugin)
|
|
28
|
-
bundle exec rake standard
|
|
20
|
+
## Architecture
|
|
29
21
|
|
|
30
|
-
|
|
31
|
-
bundle exec standardrb --fix
|
|
32
|
-
```
|
|
22
|
+
### Entry point and API singleton
|
|
33
23
|
|
|
34
|
-
|
|
24
|
+
`OpenFeature::SDK` (in `lib/open_feature/sdk.rb`) delegates all method calls to `API.instance` via `method_missing`. `API` is a Singleton that holds a `Configuration` object and builds `Client` instances.
|
|
35
25
|
|
|
36
|
-
|
|
26
|
+
### Provider duck type
|
|
37
27
|
|
|
38
|
-
|
|
28
|
+
Providers are not subclasses — they follow a duck type interface. Any object implementing `fetch_boolean_value`, `fetch_string_value`, `fetch_number_value`, `fetch_integer_value`, `fetch_float_value`, and `fetch_object_value` (all accepting `flag_key:`, `default_value:`, `evaluation_context:`) works as a provider. Each method must return a `ResolutionDetails` struct. Two built-in providers exist: `NoOpProvider` (default) and `InMemoryProvider` (for testing). Providers may optionally implement `init(evaluation_context)`, `shutdown`, and `metadata`.
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
- **Configuration** (`lib/open_feature/sdk/configuration.rb`) — Thread-safe provider storage. Handles provider lifecycle (init/shutdown), domain-scoped provider mapping, and event dispatching. Uses Mutex for all shared state.
|
|
42
|
-
- **Client** (`lib/open_feature/sdk/client.rb`) — Flag evaluation interface. Uses `class_eval` metaprogramming to generate 12 typed methods: `fetch_{boolean,string,number,integer,float,object}_value` and `fetch_*_details` variants. Merges evaluation contexts (API + client + invocation).
|
|
43
|
-
- **EvaluationContext** (`lib/open_feature/sdk/evaluation_context.rb`) — Key-value targeting data with a special `targeting_key`. Supports merging with precedence: invocation > client > API.
|
|
30
|
+
### Client dynamic method generation
|
|
44
31
|
|
|
45
|
-
|
|
32
|
+
`Client` uses `class_eval` to metaprogram `fetch_<type>_value` and `fetch_<type>_details` methods from `RESULT_TYPE` and `SUFFIXES` arrays. This generates 12 public methods (6 types × 2 suffixes).
|
|
46
33
|
|
|
47
|
-
|
|
48
|
-
- **EventEmitter** (`lib/open_feature/sdk/provider/event_emitter.rb`) — Mixin that providers include to emit lifecycle events.
|
|
49
|
-
- **Built-in providers**: `NoOpProvider` (default), `InMemoryProvider` (testing/examples).
|
|
50
|
-
- **Provider states**: `NOT_READY → READY`, with `ERROR`, `FATAL`, `STALE` transitions. Tracked per-instance via `ProviderStateRegistry` using `object_id`.
|
|
51
|
-
- **Initialization modes**: `set_provider` (async, background thread) or `set_provider_and_wait` (sync, raises `ProviderInitializationError` on failure).
|
|
34
|
+
### Evaluation context merging
|
|
52
35
|
|
|
53
|
-
|
|
36
|
+
`EvaluationContextBuilder` merges three layers of context with this precedence: invocation > client > API (global). Context is a hash-like object with a special `targeting_key` field.
|
|
54
37
|
|
|
55
|
-
|
|
56
|
-
- **ProviderEvent** constants: `PROVIDER_READY`, `PROVIDER_ERROR`, `PROVIDER_STALE`, `PROVIDER_CONFIGURATION_CHANGED`.
|
|
38
|
+
### Provider eventing
|
|
57
39
|
|
|
58
|
-
|
|
40
|
+
`Configuration` manages provider lifecycle events (READY, ERROR, STALE, CONFIGURATION_CHANGED). Providers can emit spontaneous events by including `Provider::EventEmitter`. Event handlers can be registered at API level (global) or client level (domain-scoped). `ProviderStateRegistry` tracks provider states; `EventDispatcher` manages handler registration and invocation.
|
|
59
41
|
|
|
60
|
-
|
|
61
|
-
- `spec/specification/` — OpenFeature spec compliance tests, organized by requirement number (e.g., "Requirement 1.1.1")
|
|
62
|
-
- `spec/open_feature/` — Unit tests for individual components
|
|
42
|
+
### Domain-based provider binding
|
|
63
43
|
|
|
64
|
-
|
|
44
|
+
Providers can be registered for specific domains. `Configuration#provider(domain:)` resolves domain-specific providers, falling back to the default (nil-domain) provider. Clients are built with an optional `domain:` that binds them to a specific provider.
|
|
65
45
|
|
|
66
46
|
## Conventions
|
|
67
47
|
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
- **Structs for DTOs**: `EvaluationDetails`, `ResolutionDetails`, `ClientMetadata`, `ProviderMetadata` are `Struct`-based
|
|
48
|
+
- All `.rb` files must have `# frozen_string_literal: true` as the first line.
|
|
49
|
+
- Tests live under `spec/` and mirror the `lib/` structure. `spec/specification/` contains tests mapped to OpenFeature spec requirements.
|
|
50
|
+
- Always sign git commits using the `-S` flag.
|
|
51
|
+
- Always include DCO sign-off in commits using the `-s` flag (i.e., `git commit -s -S`). This adds a `Signed-off-by` trailer required by the project's CI.
|
data/Gemfile.lock
CHANGED
|
@@ -1,41 +1,51 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
openfeature-sdk (0.
|
|
4
|
+
openfeature-sdk (0.6.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
ast (2.4.
|
|
10
|
-
|
|
9
|
+
ast (2.4.3)
|
|
10
|
+
date (3.5.1)
|
|
11
|
+
debug (1.11.1)
|
|
11
12
|
irb (~> 1.10)
|
|
12
13
|
reline (>= 0.3.8)
|
|
13
|
-
diff-lcs (1.
|
|
14
|
-
docile (1.4.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
diff-lcs (1.6.2)
|
|
15
|
+
docile (1.4.1)
|
|
16
|
+
erb (6.0.2)
|
|
17
|
+
io-console (0.8.2)
|
|
18
|
+
irb (1.17.0)
|
|
19
|
+
pp (>= 0.6.0)
|
|
20
|
+
prism (>= 1.3.0)
|
|
21
|
+
rdoc (>= 4.0.0)
|
|
18
22
|
reline (>= 0.4.2)
|
|
19
|
-
json (2.
|
|
20
|
-
language_server-protocol (3.17.0.
|
|
23
|
+
json (2.18.1)
|
|
24
|
+
language_server-protocol (3.17.0.5)
|
|
21
25
|
lint_roller (1.1.0)
|
|
22
|
-
markly (0.
|
|
23
|
-
parallel (1.
|
|
24
|
-
parser (3.3.
|
|
26
|
+
markly (0.15.2)
|
|
27
|
+
parallel (1.27.0)
|
|
28
|
+
parser (3.3.10.2)
|
|
25
29
|
ast (~> 2.4.1)
|
|
26
30
|
racc
|
|
27
|
-
|
|
31
|
+
pp (0.6.3)
|
|
32
|
+
prettyprint
|
|
33
|
+
prettyprint (0.2.0)
|
|
34
|
+
prism (1.9.0)
|
|
35
|
+
psych (5.3.1)
|
|
36
|
+
date
|
|
28
37
|
stringio
|
|
29
|
-
racc (1.
|
|
38
|
+
racc (1.8.1)
|
|
30
39
|
rainbow (3.1.1)
|
|
31
|
-
rake (13.1
|
|
32
|
-
rdoc (
|
|
40
|
+
rake (13.3.1)
|
|
41
|
+
rdoc (7.2.0)
|
|
42
|
+
erb
|
|
33
43
|
psych (>= 4.0.0)
|
|
34
|
-
|
|
35
|
-
|
|
44
|
+
tsort
|
|
45
|
+
regexp_parser (2.11.3)
|
|
46
|
+
reline (0.6.3)
|
|
36
47
|
io-console (~> 0.5)
|
|
37
|
-
rexml (3.
|
|
38
|
-
strscan
|
|
48
|
+
rexml (3.4.4)
|
|
39
49
|
rspec (3.12.0)
|
|
40
50
|
rspec-core (~> 3.12.0)
|
|
41
51
|
rspec-expectations (~> 3.12.0)
|
|
@@ -49,54 +59,59 @@ GEM
|
|
|
49
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
50
60
|
rspec-support (~> 3.12.0)
|
|
51
61
|
rspec-support (3.12.2)
|
|
52
|
-
rubocop (1.
|
|
62
|
+
rubocop (1.84.2)
|
|
53
63
|
json (~> 2.3)
|
|
54
|
-
language_server-protocol (
|
|
64
|
+
language_server-protocol (~> 3.17.0.2)
|
|
65
|
+
lint_roller (~> 1.1.0)
|
|
55
66
|
parallel (~> 1.10)
|
|
56
67
|
parser (>= 3.3.0.2)
|
|
57
68
|
rainbow (>= 2.2.2, < 4.0)
|
|
58
|
-
regexp_parser (>=
|
|
59
|
-
|
|
60
|
-
rubocop-ast (>= 1.31.1, < 2.0)
|
|
69
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
70
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
61
71
|
ruby-progressbar (~> 1.7)
|
|
62
|
-
unicode-display_width (>= 2.4.0, <
|
|
63
|
-
rubocop-ast (1.
|
|
64
|
-
parser (>= 3.3.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
73
|
+
rubocop-ast (1.49.0)
|
|
74
|
+
parser (>= 3.3.7.2)
|
|
75
|
+
prism (~> 1.7)
|
|
76
|
+
rubocop-performance (1.26.1)
|
|
77
|
+
lint_roller (~> 1.1)
|
|
78
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
79
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
68
80
|
ruby-progressbar (1.13.0)
|
|
69
81
|
simplecov (0.22.0)
|
|
70
82
|
docile (~> 1.1)
|
|
71
83
|
simplecov-html (~> 0.11)
|
|
72
84
|
simplecov_json_formatter (~> 0.1)
|
|
73
|
-
simplecov-cobertura (
|
|
85
|
+
simplecov-cobertura (3.1.0)
|
|
74
86
|
rexml
|
|
75
87
|
simplecov (~> 0.19)
|
|
76
|
-
simplecov-html (0.
|
|
88
|
+
simplecov-html (0.13.2)
|
|
77
89
|
simplecov_json_formatter (0.1.4)
|
|
78
|
-
standard (1.
|
|
90
|
+
standard (1.54.0)
|
|
79
91
|
language_server-protocol (~> 3.17.0.2)
|
|
80
92
|
lint_roller (~> 1.0)
|
|
81
|
-
rubocop (~> 1.
|
|
93
|
+
rubocop (~> 1.84.0)
|
|
82
94
|
standard-custom (~> 1.0.0)
|
|
83
|
-
standard-performance (~> 1.
|
|
95
|
+
standard-performance (~> 1.8)
|
|
84
96
|
standard-custom (1.0.2)
|
|
85
97
|
lint_roller (~> 1.0)
|
|
86
98
|
rubocop (~> 1.50)
|
|
87
|
-
standard-performance (1.
|
|
99
|
+
standard-performance (1.9.0)
|
|
88
100
|
lint_roller (~> 1.1)
|
|
89
|
-
rubocop-performance (~> 1.
|
|
90
|
-
stringio (3.
|
|
91
|
-
strscan (3.1.0)
|
|
101
|
+
rubocop-performance (~> 1.26.0)
|
|
102
|
+
stringio (3.2.0)
|
|
92
103
|
timecop (0.9.10)
|
|
93
|
-
|
|
104
|
+
tsort (0.2.0)
|
|
105
|
+
unicode-display_width (3.2.0)
|
|
106
|
+
unicode-emoji (~> 4.1)
|
|
107
|
+
unicode-emoji (4.2.0)
|
|
94
108
|
|
|
95
109
|
PLATFORMS
|
|
96
110
|
arm64-darwin-21
|
|
97
111
|
arm64-darwin-22
|
|
98
112
|
arm64-darwin-23
|
|
99
113
|
arm64-darwin-24
|
|
114
|
+
arm64-darwin-25
|
|
100
115
|
x64-mingw-ucrt
|
|
101
116
|
x64-mingw32
|
|
102
117
|
x86_64-darwin-19
|
|
@@ -111,7 +126,7 @@ DEPENDENCIES
|
|
|
111
126
|
rake (~> 13.0)
|
|
112
127
|
rspec (~> 3.12.0)
|
|
113
128
|
simplecov (~> 0.22.0)
|
|
114
|
-
simplecov-cobertura (~>
|
|
129
|
+
simplecov-cobertura (~> 3.0)
|
|
115
130
|
standard
|
|
116
131
|
standard-performance
|
|
117
132
|
timecop (~> 0.9.10)
|
data/README.md
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
</a>
|
|
18
18
|
<!-- x-release-please-start-version -->
|
|
19
19
|
|
|
20
|
-
<a href="https://github.com/open-feature/ruby-sdk/releases/tag/v0.
|
|
21
|
-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.
|
|
20
|
+
<a href="https://github.com/open-feature/ruby-sdk/releases/tag/v0.6.0">
|
|
21
|
+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.6.0&color=blue&style=for-the-badge" />
|
|
22
22
|
</a>
|
|
23
23
|
|
|
24
24
|
<!-- x-release-please-end -->
|
|
@@ -38,9 +38,8 @@
|
|
|
38
38
|
|
|
39
39
|
| Supported Ruby Version | OS |
|
|
40
40
|
| ------------ | --------------------- |
|
|
41
|
-
| Ruby 3.
|
|
42
|
-
| Ruby
|
|
43
|
-
| Ruby 3.3.0 | Windows, MacOS, Linux |
|
|
41
|
+
| Ruby 3.4.x | Windows, MacOS, Linux |
|
|
42
|
+
| Ruby 4.0.x | Windows, MacOS, Linux |
|
|
44
43
|
|
|
45
44
|
### Install
|
|
46
45
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openfeature-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenFeature Authors
|
|
@@ -113,14 +113,14 @@ dependencies:
|
|
|
113
113
|
requirements:
|
|
114
114
|
- - "~>"
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
|
-
version:
|
|
116
|
+
version: '3.0'
|
|
117
117
|
type: :development
|
|
118
118
|
prerelease: false
|
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
120
|
requirements:
|
|
121
121
|
- - "~>"
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
|
-
version:
|
|
123
|
+
version: '3.0'
|
|
124
124
|
- !ruby/object:Gem::Dependency
|
|
125
125
|
name: timecop
|
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -204,14 +204,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
204
204
|
requirements:
|
|
205
205
|
- - ">="
|
|
206
206
|
- !ruby/object:Gem::Version
|
|
207
|
-
version: '3.
|
|
207
|
+
version: '3.4'
|
|
208
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
requirements:
|
|
210
210
|
- - ">="
|
|
211
211
|
- !ruby/object:Gem::Version
|
|
212
212
|
version: '0'
|
|
213
213
|
requirements: []
|
|
214
|
-
rubygems_version:
|
|
214
|
+
rubygems_version: 4.0.3
|
|
215
215
|
specification_version: 4
|
|
216
216
|
summary: OpenFeature SDK for Ruby
|
|
217
217
|
test_files: []
|