Skip to content

Commit 2ec98c6

Browse files
authored
fix(ruby): correct spelling of evaluationDetails (#268)
* fix(ruby): correct spelling of evaluationDetails * docs(ruby): add documentation comments for public methods
1 parent a22e1ca commit 2ec98c6

File tree

9 files changed

+203
-8
lines changed

9 files changed

+203
-8
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"eppo_core": minor
3+
"ruby-sdk": minor
4+
---
5+
6+
Fix casing of `evaluationDetails`.
7+
8+
In Ruby SDK v3.4.0, the name of `evaluationDetails` was inadvertently changed to `evaluation_details`. This was a bug that caused backward incompatibility in a minor release.
9+
10+
This release fixes the casing back to `evaluationDetails`.

eppo_core/src/eval/eval_details.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ mod magnus_impl {
282282
let _ = hash.aset(handle.sym_new("variation"), self.variation);
283283
let _ = hash.aset(handle.sym_new("action"), self.action);
284284
let _ = hash.aset(
285-
handle.sym_new("evaluation_details"),
285+
handle.sym_new("evaluationDetails"),
286286
self.evaluation_details.as_ref(),
287287
);
288288
hash.as_value()

python-sdk/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ impl EppoClient {
452452
config.is_some()
453453
}
454454

455-
/// Wait for configuration to get fetches.
455+
/// Wait for configuration to get fetched.
456456
///
457457
/// This method releases GIL, so other Python thread can make progress.
458458
fn wait_for_initialization(&self, py: Python) -> PyResult<()> {

ruby-sdk/CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
- [#247](https://github.com/Eppo-exp/eppo-multiplatform/pull/247) [`2e3bf09`](https://github.com/Eppo-exp/eppo-multiplatform/commit/2e3bf093d23a2b63f55f3e5336662489ed689a09) Thanks [@rasendubi](https://github.com/rasendubi)! - Add `wait_for_initialization()` method.
88

9+
### Known Issues
10+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.
11+
912
## 3.5.1
1013

1114
### Patch Changes
@@ -16,12 +19,18 @@
1619

1720
- [#223](https://github.com/Eppo-exp/eppo-multiplatform/pull/223) [`9504e92`](https://github.com/Eppo-exp/eppo-multiplatform/commit/9504e928c37f82147e65fe25aab558cad3bbac2a) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore(deps): bump rb_sys from 0.9.110 to 0.9.111
1821

22+
### Known Issues
23+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.
24+
1925
## 3.5.0
2026

2127
### Minor Changes
2228

2329
- [#197](https://github.com/Eppo-exp/eppo-multiplatform/pull/197) [`a4da91f`](https://github.com/Eppo-exp/eppo-multiplatform/commit/a4da91f1a962708924063f3f076d3064441c2f76) Thanks [@rasendubi](https://github.com/rasendubi)! - Change TLS implementation from openssl to rustls.
2430

31+
### Known Issues
32+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.
33+
2534
## 3.4.6
2635

2736
### Patch Changes
@@ -32,18 +41,27 @@
3241

3342
- [#213](https://github.com/Eppo-exp/eppo-multiplatform/pull/213) [`9ea7865`](https://github.com/Eppo-exp/eppo-multiplatform/commit/9ea78657dbbfe8fb733dd67fb71357872db9f8b2) Thanks [@rasendubi](https://github.com/rasendubi)! - Bump Minimum Supported Rust Version (MSRV) to 1.80.0.
3443

44+
### Known Issues
45+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.
46+
3547
## 3.4.5
3648

3749
### Patch Changes
3850

3951
- [#201](https://github.com/Eppo-exp/eppo-multiplatform/pull/201) [`1d310c7`](https://github.com/Eppo-exp/eppo-multiplatform/commit/1d310c7019dde1aa5a965e064eab15187b064d96) Thanks [@felipecsl](https://github.com/felipecsl)! - [Unstable] Event Ingestion: Fix JSON serialization of Event timestamp field
4052

53+
### Known Issues
54+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.
55+
4156
## 3.4.4
4257

4358
### Patch Changes
4459

4560
- [#198](https://github.com/Eppo-exp/eppo-multiplatform/pull/198) [`9c6990e`](https://github.com/Eppo-exp/eppo-multiplatform/commit/9c6990ec77dc3ffe8f1b6384f92fcc24db94916f) Thanks [@felipecsl](https://github.com/felipecsl)! - [unstable] Event Ingestion: Fix JSON serialization of Event type field
4661

62+
### Known Issues
63+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.
64+
4765
## 3.4.3
4866

4967
### Patch Changes
@@ -56,20 +74,29 @@
5674

5775
This changes API of the core but should be invisible for SDKs. The only noticeable difference is that client should be more responsive to graceful shutdown requests.
5876

77+
### Known Issues
78+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.
79+
5980
## 3.4.2
6081

6182
### Patch Changes
6283

6384
- Updated dependencies [[`aa0ca89`](https://github.com/Eppo-exp/eppo-multiplatform/commit/aa0ca8912bab269613d3da25c06f81b1f19ffb36)]:
6485
6586

87+
### Known Issues
88+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.
89+
6690
## 3.4.1
6791

6892
### Patch Changes
6993

7094
- Updated dependencies [[`82d05ae`](https://github.com/Eppo-exp/eppo-multiplatform/commit/82d05aea0263639be56ba5667500f6940b4832ab)]:
7195
7296

97+
### Known Issues
98+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.
99+
73100
## 3.4.0
74101

75102
### Minor Changes
@@ -115,3 +142,6 @@
115142

116143
- Updated dependencies [[`3a18f95`](https://github.com/Eppo-exp/eppo-multiplatform/commit/3a18f95f0aa25030aeba6676b76e20862a5fcead)]:
117144
145+
146+
### Known Issues
147+
- Starting with v3.4.0, in result of evaluation details methods, the name of `evaluationDetails` key is spelled as `evaluation_details`. This is fixed in 3.7.0.

ruby-sdk/Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ruby-sdk/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
eppo-server-sdk (3.5.0)
4+
eppo-server-sdk (3.6.0)
55
rb_sys (~> 0.9.102)
66

77
GEM

ruby-sdk/lib/eppo_client.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
# EppoClient is the main module for initializing the Eppo client.
77
# It provides a method to initialize the client with a given configuration.
88
module EppoClient
9+
##
10+
# Initializes the Eppo client singleton.
11+
#
12+
# @note The client returned by this method may still be in the process of initializing.
13+
# Use the `#wait_for_initialization` method to wait for the client to be ready.
14+
#
15+
# @param config [EppoClient::Config] The configuration for the client.
16+
# @return [EppoClient::Client] The client.
917
def init(config)
1018
client = EppoClient::Client.instance
1119
client.init(config)

ruby-sdk/lib/eppo_client/client.rb

Lines changed: 148 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,69 +40,201 @@ def init(config)
4040
#
4141
# Note: this method returns immediately if configuration poller
4242
# has been disabled.
43+
#
44+
# @param timeout [Numeric] Maximum time to wait in seconds
45+
# @return [nil]
4346
def wait_for_initialization(timeout=1)
4447
return unless @core
4548
@core.wait_for_initialization(timeout)
4649
end
4750

51+
##
52+
# Returns the currently active configuration.
4853
def configuration
4954
@core.configuration
5055
end
5156

57+
##
58+
# Sets the currently active configuration.
5259
def configuration=(configuration)
5360
@core.configuration = configuration
5461
end
5562

63+
##
64+
# Prepare the client for shutdown.
65+
#
66+
# This method stops the configuration poller and any other background threads.
67+
#
68+
# @return [nil]
5669
def shutdown
5770
@core.shutdown
5871
end
5972

60-
# Unstable
61-
# Enqueues an arbitrary event. Events must have a type and a payload
73+
##
74+
# Tracks an arbitrary event. Events must have a type and a payload.
75+
#
76+
# @note This method is considered unstable and may change in future versions.
77+
#
78+
# @param event_type [String] The type of the event to track.
79+
# @param payload [Hash] The payload of the event to track.
6280
def unstable_track(event_type, payload)
6381
@core.track(event_type, payload)
6482
end
6583

84+
##
85+
# Returns a string assignment for the given flag key and subject.
86+
#
87+
# @param flag_key [String] The key of the flag to get an assignment for.
88+
# @param subject_key [String] The key of the subject to get an assignment for.
89+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
90+
# @param default_value [String] The default value to return if the flag is not found or no assignment can be made.
91+
# @return [String] The assignment for the given flag key and subject.
6692
def get_string_assignment(flag_key, subject_key, subject_attributes, default_value)
6793
get_assignment_inner(flag_key, subject_key, subject_attributes, "STRING", default_value)
6894
end
6995

96+
##
97+
# Returns a numeric assignment for the given flag key and subject.
98+
#
99+
# @param flag_key [String] The key of the flag to get an assignment for.
100+
# @param subject_key [String] The key of the subject to get an assignment for.
101+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
102+
# @param default_value [Numeric] The default value to return if the flag is not found or no assignment can be made.
103+
# @return [Numeric] The assignment for the given flag key and subject.
70104
def get_numeric_assignment(flag_key, subject_key, subject_attributes, default_value)
71105
get_assignment_inner(flag_key, subject_key, subject_attributes, "NUMERIC", default_value)
72106
end
73107

108+
##
109+
# Returns an integer assignment for the given flag key and subject.
110+
#
111+
# @param flag_key [String] The key of the flag to get an assignment for.
112+
# @param subject_key [String] The key of the subject to get an assignment for.
113+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
114+
# @param default_value [Integer] The default value to return if the flag is not found or no assignment can be made.
115+
# @return [Integer] The assignment for the given flag key and subject.
74116
def get_integer_assignment(flag_key, subject_key, subject_attributes, default_value)
75117
get_assignment_inner(flag_key, subject_key, subject_attributes, "INTEGER", default_value)
76118
end
77119

120+
##
121+
# Returns a boolean assignment for the given flag key and subject.
122+
#
123+
# @param flag_key [String] The key of the flag to get an assignment for.
124+
# @param subject_key [String] The key of the subject to get an assignment for.
125+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
126+
# @param default_value [Boolean] The default value to return if the flag is not found or no assignment can be made.
127+
# @return [Boolean] The assignment for the given flag key and subject.
78128
def get_boolean_assignment(flag_key, subject_key, subject_attributes, default_value)
79129
get_assignment_inner(flag_key, subject_key, subject_attributes, "BOOLEAN", default_value)
80130
end
81131

132+
##
133+
# Returns a JSON assignment for the given flag key and subject.
134+
#
135+
# @param flag_key [String] The key of the flag to get an assignment for.
136+
# @param subject_key [String] The key of the subject to get an assignment for.
137+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
138+
# @param default_value [Hash] The default value to return if the flag is not found or no assignment can be made.
139+
# @return [Hash] The assignment for the given flag key and subject.
82140
def get_json_assignment(flag_key, subject_key, subject_attributes, default_value)
83141
get_assignment_inner(flag_key, subject_key, subject_attributes, "JSON", default_value)
84142
end
85143

144+
##
145+
# Returns detailed information about a string assignment for the given flag key and subject.
146+
#
147+
# @note This method is intended for debugging purposes and is discouraged from use in
148+
# production. It is a couple of times slower than the non-detail methods. The evaluation
149+
# details format is primarily designed for human consumption (debugging) and is therefore
150+
# unstable and may change between SDK versions.
151+
#
152+
# @param flag_key [String] The key of the flag to get an assignment for.
153+
# @param subject_key [String] The key of the subject to get an assignment for.
154+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
155+
# @param default_value [String] The default value to return if the flag is not found or no assignment can be made.
156+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
86157
def get_string_assignment_details(flag_key, subject_key, subject_attributes, default_value)
87158
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "STRING", default_value)
88159
end
89160

161+
##
162+
# Returns detailed information about a numeric assignment for the given flag key and subject.
163+
#
164+
# @note This method is intended for debugging purposes and is discouraged from use in
165+
# production. It is a couple of times slower than the non-detail methods. The evaluation
166+
# details format is primarily designed for human consumption (debugging) and is therefore
167+
# unstable.
168+
#
169+
# @param flag_key [String] The key of the flag to get an assignment for.
170+
# @param subject_key [String] The key of the subject to get an assignment for.
171+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
172+
# @param default_value [Numeric] The default value to return if the flag is not found or no assignment can be made.
173+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
90174
def get_numeric_assignment_details(flag_key, subject_key, subject_attributes, default_value)
91175
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "NUMERIC", default_value)
92176
end
93177

178+
##
179+
# Returns detailed information about an integer assignment for the given flag key and subject.
180+
#
181+
# @note This method is intended for debugging purposes and is discouraged from use in
182+
# production. It is a couple of times slower than the non-detail methods. The evaluation
183+
# details format is primarily designed for human consumption (debugging) and is therefore
184+
# unstable and may change between SDK versions.
185+
#
186+
# @param flag_key [String] The key of the flag to get an assignment for.
187+
# @param subject_key [String] The key of the subject to get an assignment for.
188+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
189+
# @param default_value [Integer] The default value to return if the flag is not found or no assignment can be made.
190+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
94191
def get_integer_assignment_details(flag_key, subject_key, subject_attributes, default_value)
95192
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "INTEGER", default_value)
96193
end
97194

195+
##
196+
# Returns detailed information about a boolean assignment for the given flag key and subject.
197+
#
198+
# @note This method is intended for debugging purposes and is discouraged from use in
199+
# production. It is a couple of times slower than the non-detail methods. The evaluation
200+
# details format is primarily designed for human consumption (debugging) and is therefore
201+
# unstable and may change between SDK versions.
202+
#
203+
# @param flag_key [String] The key of the flag to get an assignment for.
204+
# @param subject_key [String] The key of the subject to get an assignment for.
205+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
206+
# @param default_value [Boolean] The default value to return if the flag is not found or no assignment can be made.
207+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
98208
def get_boolean_assignment_details(flag_key, subject_key, subject_attributes, default_value)
99209
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "BOOLEAN", default_value)
100210
end
101211

212+
##
213+
# Returns detailed information about a JSON assignment for the given flag key and subject.
214+
#
215+
# @note This method is intended for debugging purposes and is discouraged from use in
216+
# production. It is a couple of times slower than the non-detail methods. The evaluation
217+
# details format is primarily designed for human consumption (debugging) and is therefore
218+
# unstable and may change between SDK versions.
219+
#
220+
# @param flag_key [String] The key of the flag to get an assignment for.
221+
# @param subject_key [String] The key of the subject to get an assignment for.
222+
# @param subject_attributes [Hash] The attributes of the subject to get an assignment for.
223+
# @param default_value [Hash] The default value to return if the flag is not found or no assignment can be made.
224+
# @return [Hash] A hash containing {:variation => assigned_value, :action => nil, :evaluationDetails => {detailed_evaluation_info}}
102225
def get_json_assignment_details(flag_key, subject_key, subject_attributes, default_value)
103226
get_assignment_details_inner(flag_key, subject_key, subject_attributes, "JSON", default_value)
104227
end
105228

229+
##
230+
# Returns a bandit action based on the flag key, subject, and available actions.
231+
#
232+
# @param flag_key [String] The key of the flag to get an action for.
233+
# @param subject_key [String] The key of the subject to get an action for.
234+
# @param subject_attributes [Hash] The attributes of the subject.
235+
# @param actions [Hash] A map of available actions and their attributes.
236+
# @param default_variation [String] The default variation to return if no assignment can be made.
237+
# @return [Hash] A hash containing the assigned variation and action.
106238
def get_bandit_action(flag_key, subject_key, subject_attributes, actions, default_variation)
107239
attributes = coerce_context_attributes(subject_attributes)
108240
actions = actions.to_h { |action, attributes| [action, coerce_context_attributes(attributes)] }
@@ -117,6 +249,20 @@ def get_bandit_action(flag_key, subject_key, subject_attributes, actions, defaul
117249
}
118250
end
119251

252+
##
253+
# Returns detailed information about a bandit action based on the flag key, subject, and available actions.
254+
#
255+
# @note This method is intended for debugging purposes and is discouraged from use in
256+
# production. It is a couple of times slower than the non-detail methods. The evaluation
257+
# details format is primarily designed for human consumption (debugging) and is therefore
258+
# unstable and may change between SDK versions.
259+
#
260+
# @param flag_key [String] The key of the flag to get an action for.
261+
# @param subject_key [String] The key of the subject to get an action for.
262+
# @param subject_attributes [Hash] The attributes of the subject.
263+
# @param actions [Hash] A map of available actions and their attributes.
264+
# @param default_variation [String] The default variation to return if no assignment can be made.
265+
# @return [Hash] A hash containing {:variation => assigned_variation, :action => assigned_action, :evaluationDetails => {detailed_evaluation_info}}
120266
def get_bandit_action_details(flag_key, subject_key, subject_attributes, actions, default_variation)
121267
attributes = coerce_context_attributes(subject_attributes)
122268
actions = actions.to_h { |action, attributes| [action, coerce_context_attributes(attributes)] }
@@ -134,7 +280,6 @@ def get_bandit_action_details(flag_key, subject_key, subject_attributes, actions
134280

135281
private
136282

137-
# rubocop:disable Metrics/MethodLength
138283
def get_assignment_inner(flag_key, subject_key, subject_attributes, expected_type, default_value)
139284
logger = Logger.new($stdout)
140285
begin

0 commit comments

Comments
 (0)