fino 1.10.0 → 1.11.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/README.md +9 -1
- data/lib/fino/library/ab_testing_analysis_support.rb +1 -2
- data/lib/fino/settings/select.rb +1 -1
- data/lib/fino/solid/adapter.rb +30 -0
- data/lib/fino/solid/conversion.rb +9 -0
- data/lib/fino/solid/generators/install/install_generator.rb +3 -1
- data/lib/fino/solid.rb +1 -0
- data/lib/fino/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cb7f2431777711dad3fa9367500d529a5e6a29b01b074383005d88949684bed
|
|
4
|
+
data.tar.gz: 8ecbaa90f45361302c662d5a01f17eb9deaa1d1ea4a5e4b5c25541637a52dabc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1377a99cc4ac6c9c8591194b513ce8aed0113eaf3b7b5a3af15f8242a8b1ec8ad34f2117d4c074b2bad080bcae98d5a772452a429c26ecfa6c49a4a27410f78f
|
|
7
|
+
data.tar.gz: bdaffc316faf4d827e86d569fc90acbc239c558b2aebc4ce0849ad9ca67ced23eacb8194161f5d41934aff986d14cf0819570a91ff684bf4b9d79b79946c091b
|
data/README.md
CHANGED
|
@@ -238,7 +238,7 @@ Fino.value(:model, at: :openai, for: "user_2") #=> "gpt-5"
|
|
|
238
238
|
|
|
239
239
|
#### Experiment analysis
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
Fino adapters might support A/B testing analysis, both built-in `solid` and `redis` adapters do
|
|
242
242
|
|
|
243
243
|
When you run an A/B test for a setting, fino automatically calculates variant based on a stable identifier you pass as
|
|
244
244
|
a `for` option
|
|
@@ -416,6 +416,14 @@ end
|
|
|
416
416
|
end
|
|
417
417
|
```
|
|
418
418
|
|
|
419
|
+
## Development
|
|
420
|
+
|
|
421
|
+
To create and mugrate dummy app db to test solid adapter, do
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
cd spec/dummy && bin/rails db:create db:migrate
|
|
425
|
+
```
|
|
426
|
+
|
|
419
427
|
## Releasing
|
|
420
428
|
|
|
421
429
|
`rake release`
|
|
@@ -11,9 +11,8 @@ module Fino::Library::AbTestingAnalysisSupport
|
|
|
11
11
|
|
|
12
12
|
setting_instance = fetch_ab_testable_setting(setting_name, at: at)
|
|
13
13
|
variant = setting_instance.experiment.variant(for: scope)
|
|
14
|
-
timestamp_ms = (time.to_f * 1000).to_i
|
|
15
14
|
|
|
16
|
-
adapter.record_ab_testing_conversion(setting_instance.definition, variant, scope,
|
|
15
|
+
adapter.record_ab_testing_conversion(setting_instance.definition, variant, scope, time)
|
|
17
16
|
end
|
|
18
17
|
|
|
19
18
|
def convert(setting_name, at: nil, time: Time.now, **context)
|
data/lib/fino/settings/select.rb
CHANGED
|
@@ -62,7 +62,7 @@ class Fino::Settings::Select
|
|
|
62
62
|
def resolve(path, force: false)
|
|
63
63
|
string_path = path.compact.map(&:to_s)
|
|
64
64
|
|
|
65
|
-
return if !force && @options.dig(*string_path)
|
|
65
|
+
return if !force && @options.dig(*string_path).present?
|
|
66
66
|
|
|
67
67
|
builder = @builders.dig(*string_path)
|
|
68
68
|
options = builder.respond_to?(:call) ? builder.call(refresh: force) : builder
|
data/lib/fino/solid/adapter.rb
CHANGED
|
@@ -62,6 +62,36 @@ module Fino
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
def record_ab_testing_conversion(setting_definition, variant, scope, time)
|
|
66
|
+
Fino::Solid::Conversion.insert(
|
|
67
|
+
{
|
|
68
|
+
setting_key: setting_definition.key,
|
|
69
|
+
variant_id: variant.id,
|
|
70
|
+
scope: scope.to_s,
|
|
71
|
+
converted_at: time
|
|
72
|
+
},
|
|
73
|
+
unique_by: :idx_fino_conversions_unique
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def read_ab_testing_conversions(setting_definition, variants)
|
|
78
|
+
rows =
|
|
79
|
+
Fino::Solid::Conversion
|
|
80
|
+
.where(setting_key: setting_definition.key, variant_id: variants.map(&:id))
|
|
81
|
+
.pluck(:variant_id, :scope, :converted_at)
|
|
82
|
+
|
|
83
|
+
grouped = rows.group_by(&:first)
|
|
84
|
+
|
|
85
|
+
variants.each_with_object({}) do |variant, memo|
|
|
86
|
+
entries = grouped.fetch(variant.id, [])
|
|
87
|
+
memo[variant] = entries.map { |_vid, scope, converted_at| [scope, (converted_at.to_f * 1000).to_i] }
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def clear_ab_testing_conversions(setting_key)
|
|
92
|
+
Fino::Solid::Conversion.where(setting_key: setting_key).delete_all
|
|
93
|
+
end
|
|
94
|
+
|
|
65
95
|
def fetch_raw_variants_from(raw_adapter_data)
|
|
66
96
|
raw_adapter_data.each_with_object([]) do |(key, value), memo|
|
|
67
97
|
next unless key.start_with?("#{VARIANT_PREFIX}/")
|
|
@@ -11,8 +11,10 @@ module Fino
|
|
|
11
11
|
|
|
12
12
|
source_root File.expand_path("templates", __dir__)
|
|
13
13
|
|
|
14
|
-
def
|
|
14
|
+
def copy_migrations
|
|
15
15
|
migration_template "create_fino_settings.rb.tt", File.join(db_migrate_path, "create_fino_settings.rb")
|
|
16
|
+
migration_template "create_fino_ab_testing_conversions.rb.tt",
|
|
17
|
+
File.join(db_migrate_path, "create_fino_ab_testing_conversions.rb")
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
private
|
data/lib/fino/solid.rb
CHANGED
data/lib/fino/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fino
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Egor Iskrenkov
|
|
@@ -67,6 +67,7 @@ files:
|
|
|
67
67
|
- lib/fino/settings/string.rb
|
|
68
68
|
- lib/fino/solid.rb
|
|
69
69
|
- lib/fino/solid/adapter.rb
|
|
70
|
+
- lib/fino/solid/conversion.rb
|
|
70
71
|
- lib/fino/solid/generators/install/install_generator.rb
|
|
71
72
|
- lib/fino/solid/railtie.rb
|
|
72
73
|
- lib/fino/solid/record.rb
|
|
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
93
94
|
- !ruby/object:Gem::Version
|
|
94
95
|
version: '0'
|
|
95
96
|
requirements: []
|
|
96
|
-
rubygems_version:
|
|
97
|
+
rubygems_version: 4.0.3
|
|
97
98
|
specification_version: 4
|
|
98
99
|
summary: Plug & play distributed settings engine for Ruby and Rails
|
|
99
100
|
test_files: []
|