posthog-ruby 3.7.0 → 3.8.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/posthog/feature_flags.rb +40 -5
- 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: a21b0cf7196c00dff9b6ad23c7ee12e54b9984b9e2e7639d0f4371f419de80c2
|
|
4
|
+
data.tar.gz: 643244ae98a7d9879e64c905133aafba69e0e5e710e49766bdd38db24f28032d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f3e4329938912befad0b58c463dd5e82ff606e381c4f306e4a1d2e509963a613cff41acc5af853cd7a4f01033af283ee7a5f77324dd31e58c605b3f84a4d9d1b
|
|
7
|
+
data.tar.gz: e331c6d025c837c2c2764d4dcccbf61dd0c33e53f55dc9a5fbaf6a2628852c86f290dbf5c8c6c375e178d13ba839126e5c472e3bce1769e118d27b28f8410f17
|
|
@@ -892,7 +892,8 @@ module PostHog
|
|
|
892
892
|
|
|
893
893
|
aggregation_group_type_index = flag_filters[:aggregation_group_type_index]
|
|
894
894
|
if aggregation_group_type_index.nil?
|
|
895
|
-
return match_feature_flag_properties(flag, distinct_id, person_properties, evaluation_cache, @cohorts
|
|
895
|
+
return match_feature_flag_properties(flag, distinct_id, person_properties, evaluation_cache, @cohorts,
|
|
896
|
+
groups: groups, group_properties: group_properties)
|
|
896
897
|
end
|
|
897
898
|
|
|
898
899
|
group_name = @group_type_mapping[aggregation_group_type_index.to_s.to_sym]
|
|
@@ -916,7 +917,7 @@ module PostHog
|
|
|
916
917
|
|
|
917
918
|
focused_group_properties = group_properties[group_name_symbol]
|
|
918
919
|
match_feature_flag_properties(flag, groups[group_name_symbol], focused_group_properties, evaluation_cache,
|
|
919
|
-
@cohorts)
|
|
920
|
+
@cohorts, groups: groups, group_properties: group_properties)
|
|
920
921
|
end
|
|
921
922
|
|
|
922
923
|
def _compute_flag_payload_locally(key, match_value)
|
|
@@ -931,23 +932,57 @@ module PostHog
|
|
|
931
932
|
response
|
|
932
933
|
end
|
|
933
934
|
|
|
934
|
-
def match_feature_flag_properties(flag, distinct_id, properties, evaluation_cache, cohort_properties = {}
|
|
935
|
+
def match_feature_flag_properties(flag, distinct_id, properties, evaluation_cache, cohort_properties = {},
|
|
936
|
+
groups: {}, group_properties: {})
|
|
935
937
|
flag_filters = flag[:filters] || {}
|
|
936
938
|
|
|
937
939
|
flag_conditions = flag_filters[:groups] || []
|
|
940
|
+
flag_aggregation = flag_filters[:aggregation_group_type_index]
|
|
938
941
|
is_inconclusive = false
|
|
939
942
|
result = nil
|
|
940
943
|
|
|
941
944
|
# NOTE: This NEEDS to be `each` because `each_key` breaks
|
|
942
945
|
flag_conditions.each do |condition|
|
|
943
|
-
|
|
946
|
+
# Per-condition aggregation overrides only when the condition explicitly
|
|
947
|
+
# sets its own aggregation_group_type_index (mixed targeting). When absent,
|
|
948
|
+
# use the properties/bucketing already resolved by the caller.
|
|
949
|
+
condition_aggregation = condition.fetch(:aggregation_group_type_index, flag_aggregation)
|
|
950
|
+
|
|
951
|
+
effective_properties = properties
|
|
952
|
+
effective_bucketing = distinct_id
|
|
953
|
+
|
|
954
|
+
# Mixed-override path: condition-level aggregation differs from flag-level.
|
|
955
|
+
# This assumes flag-level aggregation is nil for mixed flags.
|
|
956
|
+
if condition_aggregation != flag_aggregation
|
|
957
|
+
if condition_aggregation.nil?
|
|
958
|
+
# Person condition under a mixed flag — caller already passed person props/bucketing.
|
|
959
|
+
else
|
|
960
|
+
group_name = @group_type_mapping[condition_aggregation.to_s.to_sym]
|
|
961
|
+
if group_name.nil? || !groups.key?(group_name.to_sym)
|
|
962
|
+
logger.debug do
|
|
963
|
+
"[FEATURE FLAGS] Skipping group condition for flag '#{flag[:key]}': " \
|
|
964
|
+
"group type index #{condition_aggregation} not available"
|
|
965
|
+
end
|
|
966
|
+
next
|
|
967
|
+
end
|
|
968
|
+
unless group_properties.key?(group_name.to_sym)
|
|
969
|
+
is_inconclusive = true
|
|
970
|
+
next
|
|
971
|
+
end
|
|
972
|
+
effective_properties = group_properties[group_name.to_sym]
|
|
973
|
+
effective_bucketing = groups[group_name.to_sym]
|
|
974
|
+
end
|
|
975
|
+
end
|
|
976
|
+
|
|
977
|
+
if condition_match(flag, effective_bucketing, condition, effective_properties, evaluation_cache,
|
|
978
|
+
cohort_properties)
|
|
944
979
|
variant_override = condition[:variant]
|
|
945
980
|
flag_multivariate = flag_filters[:multivariate] || {}
|
|
946
981
|
flag_variants = flag_multivariate[:variants] || []
|
|
947
982
|
variant = if flag_variants.map { |variant| variant[:key] }.include?(condition[:variant])
|
|
948
983
|
variant_override
|
|
949
984
|
else
|
|
950
|
-
get_matching_variant(flag,
|
|
985
|
+
get_matching_variant(flag, effective_bucketing)
|
|
951
986
|
end
|
|
952
987
|
result = variant || true
|
|
953
988
|
break
|
data/lib/posthog/version.rb
CHANGED