posthog-ruby 3.3.2 → 3.3.3
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/posthog/feature_flags.rb +22 -4
- data/lib/posthog/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a8d4402eef3a161a1c76c7e7e2349356741011cc6ead4acde7bd31ef437e568
|
|
4
|
+
data.tar.gz: b9ad05adb1b5e3aea9849bf0bbceceef0d22f9724561e8f3a4a3e39f4ed104e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 055501a8e3ea62cfd321adee64297023338deb455ed59746632c0051179e3b3f6e733f1f7126eb612e5c381aa8bf8653b51ae2d15a1be938d80d05f8e0b06e3f
|
|
7
|
+
data.tar.gz: c4dd9ae85bafbec60209c8aff9329f79585b99deb8ffe1624397df73d930d54c40ab5fefaac2de9b75adee80c242f98d26428b61f4155206ce7632517303241b
|
|
@@ -12,6 +12,13 @@ module PostHog
|
|
|
12
12
|
class InconclusiveMatchError < StandardError
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
# RequiresServerEvaluation is raised when feature flag evaluation requires
|
|
16
|
+
# server-side data that is not available locally (e.g., static cohorts,
|
|
17
|
+
# experience continuity). This error should propagate immediately to trigger
|
|
18
|
+
# API fallback, unlike InconclusiveMatchError which allows trying other conditions.
|
|
19
|
+
class RequiresServerEvaluation < StandardError
|
|
20
|
+
end
|
|
21
|
+
|
|
15
22
|
class FeatureFlagsPoller
|
|
16
23
|
include PostHog::Logging
|
|
17
24
|
include PostHog::Utils
|
|
@@ -173,7 +180,7 @@ module PostHog
|
|
|
173
180
|
begin
|
|
174
181
|
response = _compute_flag_locally(feature_flag, distinct_id, groups, person_properties, group_properties)
|
|
175
182
|
logger.debug "Successfully computed flag locally: #{key} -> #{response}"
|
|
176
|
-
rescue InconclusiveMatchError => e
|
|
183
|
+
rescue RequiresServerEvaluation, InconclusiveMatchError => e
|
|
177
184
|
logger.debug "Failed to compute flag #{key} locally: #{e}"
|
|
178
185
|
rescue StandardError => e
|
|
179
186
|
@on_error.call(-1, "Error computing flag locally: #{e}. #{e.backtrace.join("\n")}")
|
|
@@ -251,7 +258,7 @@ module PostHog
|
|
|
251
258
|
flags[flag[:key]] = match_value
|
|
252
259
|
match_payload = _compute_flag_payload_locally(flag[:key], match_value)
|
|
253
260
|
payloads[flag[:key]] = match_payload if match_payload
|
|
254
|
-
rescue InconclusiveMatchError
|
|
261
|
+
rescue RequiresServerEvaluation, InconclusiveMatchError
|
|
255
262
|
fallback_to_server = true
|
|
256
263
|
rescue StandardError => e
|
|
257
264
|
@on_error.call(-1, "Error computing flag locally: #{e}. #{e.backtrace.join("\n")} ")
|
|
@@ -461,7 +468,10 @@ module PostHog
|
|
|
461
468
|
cohort_id = extract_value(property, :value).to_s
|
|
462
469
|
property_group = find_cohort_property(cohort_properties, cohort_id)
|
|
463
470
|
|
|
464
|
-
|
|
471
|
+
unless property_group
|
|
472
|
+
raise RequiresServerEvaluation,
|
|
473
|
+
"cohort #{cohort_id} not found in local cohorts - likely a static cohort that requires server evaluation"
|
|
474
|
+
end
|
|
465
475
|
|
|
466
476
|
match_property_group(property_group, property_values, cohort_properties)
|
|
467
477
|
end
|
|
@@ -539,6 +549,9 @@ module PostHog
|
|
|
539
549
|
elsif final_result # group_type == 'OR'
|
|
540
550
|
return true
|
|
541
551
|
end
|
|
552
|
+
rescue RequiresServerEvaluation
|
|
553
|
+
# Immediately propagate - this condition requires server-side data
|
|
554
|
+
raise
|
|
542
555
|
rescue InconclusiveMatchError => e
|
|
543
556
|
PostHog::Logging.logger&.debug("Failed to compute property #{prop} locally: #{e}")
|
|
544
557
|
error_matching_locally = true
|
|
@@ -676,7 +689,7 @@ module PostHog
|
|
|
676
689
|
:match_nested_property_group, :match_regular_property_group
|
|
677
690
|
|
|
678
691
|
def _compute_flag_locally(flag, distinct_id, groups = {}, person_properties = {}, group_properties = {})
|
|
679
|
-
raise
|
|
692
|
+
raise RequiresServerEvaluation, 'Flag has experience continuity enabled' if flag[:ensure_experience_continuity]
|
|
680
693
|
|
|
681
694
|
return false unless flag[:active]
|
|
682
695
|
|
|
@@ -747,7 +760,12 @@ module PostHog
|
|
|
747
760
|
result = variant || true
|
|
748
761
|
break
|
|
749
762
|
end
|
|
763
|
+
rescue RequiresServerEvaluation
|
|
764
|
+
# Static cohort or other missing server-side data - must fallback to API
|
|
765
|
+
raise
|
|
750
766
|
rescue InconclusiveMatchError
|
|
767
|
+
# Evaluation error (bad regex, invalid date, missing property, etc.)
|
|
768
|
+
# Track that we had an inconclusive match, but try other conditions
|
|
751
769
|
is_inconclusive = true
|
|
752
770
|
end
|
|
753
771
|
|
data/lib/posthog/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: posthog-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.3.
|
|
4
|
+
version: 3.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ''
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
10
|
+
date: 2025-10-22 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: concurrent-ruby
|
|
@@ -57,7 +56,6 @@ licenses:
|
|
|
57
56
|
- MIT
|
|
58
57
|
metadata:
|
|
59
58
|
rubygems_mfa_required: 'true'
|
|
60
|
-
post_install_message:
|
|
61
59
|
rdoc_options: []
|
|
62
60
|
require_paths:
|
|
63
61
|
- lib
|
|
@@ -72,8 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
70
|
- !ruby/object:Gem::Version
|
|
73
71
|
version: '0'
|
|
74
72
|
requirements: []
|
|
75
|
-
rubygems_version: 3.
|
|
76
|
-
signing_key:
|
|
73
|
+
rubygems_version: 3.6.6
|
|
77
74
|
specification_version: 4
|
|
78
75
|
summary: PostHog library
|
|
79
76
|
test_files: []
|