posthog-ruby 3.35.1 → 3.35.2
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 +26 -3
- data/lib/posthog/unresolved_flag_reason.rb +1 -1
- data/lib/posthog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb2187d8e83284c2141a23c6d303dca23cf6a1db04e2224314a225e101bc12cc
|
|
4
|
+
data.tar.gz: 2459aa316cd0e2888e272eb43497d42a45e28d12a7134d4dcb24cfda753fd0d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 15711d84f77965e1df866202700a77e5f46b91905e69b9b270b9887eafaeb8eef2be1da11e0da03a36e636876862c97e5763f7f2a4d6c9deb947928376fed0ad
|
|
7
|
+
data.tar.gz: cc108fc3d9841c6e86ea85037b3adc50b89fd54595edab8ac8e575df595e34082ef94382b773fb82e68c68d148ce12cc2e2ea65b0a8d1e56fad2bad56ad5e727
|
|
@@ -767,6 +767,8 @@ module PostHog
|
|
|
767
767
|
property_matching_version: property_matching_version)
|
|
768
768
|
end
|
|
769
769
|
|
|
770
|
+
assert_property_filter_type_supported(property)
|
|
771
|
+
|
|
770
772
|
begin
|
|
771
773
|
match_property_value(property, property_values, property_matching_version)
|
|
772
774
|
rescue InconclusiveMatchError => e
|
|
@@ -866,6 +868,25 @@ module PostHog
|
|
|
866
868
|
end
|
|
867
869
|
private_class_method :match_property_value
|
|
868
870
|
|
|
871
|
+
# Filter types matched against the person or group properties the call passes. A missing, null, or empty
|
|
872
|
+
# type is a person filter. Cohort and flag filters have their own matching. Any other type, such as
|
|
873
|
+
# person_metadata (a value the flags service reads from the persons table, not from person properties),
|
|
874
|
+
# can't be evaluated locally: matching it against a caller property with the same key could disagree
|
|
875
|
+
# with the flags service.
|
|
876
|
+
PROPERTY_FILTER_TYPES = [nil, '', 'person', 'group'].freeze
|
|
877
|
+
private_constant :PROPERTY_FILTER_TYPES
|
|
878
|
+
|
|
879
|
+
def self.assert_property_filter_type_supported(property)
|
|
880
|
+
type = extract_value(property, :type)
|
|
881
|
+
# A cohort group checks a flag filter as an ordinary property, so it keeps that matching here.
|
|
882
|
+
return if PROPERTY_FILTER_TYPES.include?(type) || type == 'flag'
|
|
883
|
+
|
|
884
|
+
raise InconclusiveMatchError.new(
|
|
885
|
+
"Can't evaluate a '#{type}' filter on '#{extract_value(property, :key)}' locally",
|
|
886
|
+
reason: UnresolvedFlagReason::UNSUPPORTED_DEFINITION
|
|
887
|
+
)
|
|
888
|
+
end
|
|
889
|
+
|
|
869
890
|
# Raises an unsupported_definition error when local evaluation cannot use the filter, whatever
|
|
870
891
|
# the call passes: an unknown operator, or a filter value that the operator cannot parse.
|
|
871
892
|
def self.assert_filter_supported(property)
|
|
@@ -1366,6 +1387,7 @@ module PostHog
|
|
|
1366
1387
|
end
|
|
1367
1388
|
|
|
1368
1389
|
def self.unsupported_filter?(property)
|
|
1390
|
+
assert_property_filter_type_supported(property)
|
|
1369
1391
|
assert_filter_supported(property)
|
|
1370
1392
|
false
|
|
1371
1393
|
rescue InconclusiveMatchError
|
|
@@ -1373,7 +1395,8 @@ module PostHog
|
|
|
1373
1395
|
end
|
|
1374
1396
|
|
|
1375
1397
|
private_class_method :extract_value, :find_cohort_property, :nested_property_group?,
|
|
1376
|
-
:property_group_items_match?, :
|
|
1398
|
+
:property_group_items_match?, :assert_property_filter_type_supported,
|
|
1399
|
+
:assert_filter_supported,
|
|
1377
1400
|
:unsupported_property?, :unsupported_property_group?, :unsupported_filter?
|
|
1378
1401
|
|
|
1379
1402
|
# Publish/capture all matching state together so a poll cannot switch semantics
|
|
@@ -1867,8 +1890,8 @@ module PostHog
|
|
|
1867
1890
|
|
|
1868
1891
|
logger.warn(
|
|
1869
1892
|
"[FEATURE FLAGS] #{unsupported_definition_keys.length} flag(s) use something local evaluation doesn't " \
|
|
1870
|
-
'support, such as a static cohort, an unknown operator, a malformed value, or a missing or
|
|
1871
|
-
"dependency (reason: #{UnresolvedFlagReason::UNSUPPORTED_DEFINITION}): " \
|
|
1893
|
+
'support, such as a static cohort, an unknown operator or filter type, a malformed value, or a missing or ' \
|
|
1894
|
+
"circular flag dependency (reason: #{UnresolvedFlagReason::UNSUPPORTED_DEFINITION}): " \
|
|
1872
1895
|
"#{unsupported_definition_keys.join(', ')}. Evaluating them makes a remote request when evaluation " \
|
|
1873
1896
|
'reaches that part, or leaves them unresolved with only_evaluate_locally: true. To evaluate them ' \
|
|
1874
1897
|
'locally, change these flags in PostHog or upgrade posthog-ruby.'
|
|
@@ -7,7 +7,7 @@ module PostHog
|
|
|
7
7
|
# Reason values:
|
|
8
8
|
# EXPERIENCE_CONTINUITY: The flag has experience continuity enabled, which local evaluation never resolves
|
|
9
9
|
# UNSUPPORTED_DEFINITION: The flag uses something local evaluation does not support, such as a static
|
|
10
|
-
# cohort, an unknown operator, a malformed value, or a missing or circular flag dependency
|
|
10
|
+
# cohort, an unknown operator or filter type, a malformed value, or a missing or circular flag dependency
|
|
11
11
|
# UNRESOLVED_DEPENDENCY: A flag this flag depends on has a loaded definition but was unresolved
|
|
12
12
|
# MISSING_CONTEXT: The call did not pass a property or group property the flag needs, or passed it in a
|
|
13
13
|
# form local evaluation cannot use
|
data/lib/posthog/version.rb
CHANGED