featureflip 2.12.0 → 2.13.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/lib/featureflip/evaluation/canonical_number.rb +6 -3
- data/lib/featureflip/shared_core.rb +30 -6
- data/lib/featureflip/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c41498d43abe3f592e70ef93178a39bbabfc481072cf1862b3a18399ad3972db
|
|
4
|
+
data.tar.gz: 00b9495f23ece99027e3c03c647616cd240a11338f8376511ac4bbd2ce46e826
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c397937ed703003e47e5999a9ffd0cd6004ce0ee02e0b216ba6c99c06dec2b03a37ceb9163b8fba36cc413747782fc13ccd84ed7218e307cd21f92ded5566da
|
|
7
|
+
data.tar.gz: ca65db25d697572ceae8f048bb5672407639fd9aeebf0bc3e0f691cfd08e3993983d78c80f80ad9997852725ebd319ca0b19c069c455fde3b8b43c4c54f73e41
|
|
@@ -5,11 +5,14 @@ module Featureflip
|
|
|
5
5
|
# BucketValueFormatter.CanonicalNumber, so every SDK hashes one number to one
|
|
6
6
|
# bucket. Used only on the bucket path; condition evaluation is unaffected.
|
|
7
7
|
module CanonicalNumber
|
|
8
|
-
# A BigDecimal with no fractional part keeps its exact integer digits (like
|
|
9
|
-
# engine's raw integer text); anything else goes through Float (#4236).
|
|
8
|
+
# A BigDecimal below 1e21 with no fractional part keeps its exact integer digits (like
|
|
9
|
+
# the engine's raw integer text); anything else goes through Float (#4236). The 1e21
|
|
10
|
+
# cap is where ECMAScript spelling turns exponential, and stops BigDecimal("1E+999999999")
|
|
11
|
+
# expanding to a billion digits per evaluation (#4246). BigDecimal#exponent is n in
|
|
12
|
+
# 0.ddd * 10**n, so |d| < 1e21 is exponent <= 21.
|
|
10
13
|
def self.format_big_decimal(d)
|
|
11
14
|
return format(d.to_f) unless d.finite?
|
|
12
|
-
return d.to_i.to_s if d.frac.zero?
|
|
15
|
+
return d.to_i.to_s if d.exponent <= 21 && d.frac.zero?
|
|
13
16
|
|
|
14
17
|
format(d.to_f)
|
|
15
18
|
end
|
|
@@ -185,7 +185,7 @@ module Featureflip
|
|
|
185
185
|
|
|
186
186
|
flag = @store.get_flag(key)
|
|
187
187
|
unless flag
|
|
188
|
-
record_evaluation(key, context, nil)
|
|
188
|
+
record_evaluation(key, context, nil, reason: "FlagNotFound")
|
|
189
189
|
notify_inspectors(key, context, default_value, reason: "FlagNotFound")
|
|
190
190
|
return Models::EvaluationDetail.new(value: default_value, reason: "FlagNotFound")
|
|
191
191
|
end
|
|
@@ -224,7 +224,10 @@ module Featureflip
|
|
|
224
224
|
reason = "Error"
|
|
225
225
|
end
|
|
226
226
|
|
|
227
|
-
record_evaluation(
|
|
227
|
+
record_evaluation(
|
|
228
|
+
key, context, result.variation_key,
|
|
229
|
+
reason: reason, rule_id: result.rule_id, prerequisite_key: result.prerequisite_key
|
|
230
|
+
)
|
|
228
231
|
notify_inspectors(
|
|
229
232
|
key, context, value,
|
|
230
233
|
reason: reason,
|
|
@@ -244,6 +247,7 @@ module Featureflip
|
|
|
244
247
|
# Prerequisite-resolution failures return PrerequisiteFailed cleanly through
|
|
245
248
|
# the evaluator; this rescue only fires on unexpected exceptions (malformed
|
|
246
249
|
# config, programming errors), so prerequisite_key has no defined value.
|
|
250
|
+
record_evaluation(key, context, nil, reason: "Error")
|
|
247
251
|
notify_inspectors(key, context, default_value, reason: "Error")
|
|
248
252
|
Models::EvaluationDetail.new(value: default_value, reason: "Error", prerequisite_key: nil)
|
|
249
253
|
end
|
|
@@ -521,16 +525,36 @@ module Featureflip
|
|
|
521
525
|
event
|
|
522
526
|
end
|
|
523
527
|
|
|
524
|
-
|
|
528
|
+
# The kebab-case reason categories the Evaluation event carries (#4268), so
|
|
529
|
+
# the source of traffic reads the same whichever SDK reported it. The
|
|
530
|
+
# PascalCase names stay the public EvaluationDetail API; only the event is
|
|
531
|
+
# translated.
|
|
532
|
+
WIRE_REASONS = {
|
|
533
|
+
"RuleMatch" => "rule-match",
|
|
534
|
+
"Fallthrough" => "fallthrough",
|
|
535
|
+
"FlagDisabled" => "flag-disabled",
|
|
536
|
+
"FlagNotFound" => "flag-not-found",
|
|
537
|
+
"PrerequisiteFailed" => "prerequisite-failed",
|
|
538
|
+
"Error" => "error"
|
|
539
|
+
}.freeze
|
|
540
|
+
|
|
541
|
+
# +ruleId+ rides only on a rule match: an Error read can still carry the rule
|
|
542
|
+
# that selected a malformed variation, and that rule did not serve the
|
|
543
|
+
# traffic. Absent optionals are compacted away so they are omitted, never null.
|
|
544
|
+
def record_evaluation(key, context, variation_key, reason:, rule_id: nil, prerequisite_key: nil)
|
|
525
545
|
return unless @event_processor
|
|
526
546
|
|
|
527
|
-
|
|
547
|
+
event = {
|
|
528
548
|
type: "Evaluation",
|
|
529
549
|
flagKey: key,
|
|
530
550
|
userId: resolve_event_user_id(context),
|
|
531
551
|
variation: variation_key,
|
|
532
|
-
timestamp: Time.now.utc.iso8601
|
|
533
|
-
|
|
552
|
+
timestamp: Time.now.utc.iso8601,
|
|
553
|
+
prerequisiteKey: prerequisite_key,
|
|
554
|
+
reason: WIRE_REASONS[reason],
|
|
555
|
+
ruleId: reason == "RuleMatch" ? rule_id : nil
|
|
556
|
+
}
|
|
557
|
+
@event_processor.queue_event(event.compact)
|
|
534
558
|
end
|
|
535
559
|
|
|
536
560
|
# Fire the registered evaluation inspectors. Called once per variation call
|
data/lib/featureflip/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: featureflip
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.13.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
|
+
date: 2026-10-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: logger
|