diff --git a/.sampo/changesets/group-and-mixed-targeting-local-eval.md b/.sampo/changesets/group-and-mixed-targeting-local-eval.md new file mode 100644 index 0000000..14b2ed8 --- /dev/null +++ b/.sampo/changesets/group-and-mixed-targeting-local-eval.md @@ -0,0 +1,7 @@ +--- +cargo/posthog-rs: minor +--- + +feat(flags): support group-targeted and mixed-targeting feature flags in local evaluation + +Adds local evaluation support for pure group flags (where `aggregation_group_type_index` is set at the flag level) and mixed-targeting flags (where individual conditions can override the aggregation per condition). `LocalEvaluator::evaluate_flag`, `evaluate_flag_simple`, and `evaluate_all_flags` now take `groups` and `group_properties` parameters; `match_feature_flag` and `match_feature_flag_with_context` have updated signatures. Backwards-incompatible at the public-API level — see PR description for migration notes. diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e5de1c..4d8a39e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,5 @@ # posthog-rs -## 0.7.0 — 2026-05-05 - -### Minor changes - -- [e976393](https://github.com/posthog/posthog-rs/commit/e976393182c5bfe1527cc180e732ce51482c87e0) feat(flags): support group-targeted and mixed-targeting feature flags in local evaluation - - Adds local evaluation support for pure group flags (where `aggregation_group_type_index` is set at the flag level) and mixed-targeting flags (where individual conditions can override the aggregation per condition). `LocalEvaluator::evaluate_flag`, `evaluate_flag_simple`, and `evaluate_all_flags` now take `groups` and `group_properties` parameters; `match_feature_flag` and `match_feature_flag_with_context` have updated signatures. Backwards-incompatible at the public-API level — see PR description for migration notes. — Thanks @patricio-posthog! - ## 0.6.0 — 2026-05-01 ### Minor changes diff --git a/Cargo.lock b/Cargo.lock index 198b6bb..01a2679 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1637,7 +1637,7 @@ dependencies = [ [[package]] name = "posthog-rs" -version = "0.7.0" +version = "0.6.0" dependencies = [ "chrono", "ctor", diff --git a/Cargo.toml b/Cargo.toml index f93d613..f8ca595 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "posthog-rs" license = "MIT" -version = "0.7.0" +version = "0.6.0" authors = ["PostHog "] description = "The official Rust client for Posthog (https://posthog.com/)." repository = "https://github.com/posthog/posthog-rs" diff --git a/src/client/async_client.rs b/src/client/async_client.rs index d2a7a26..7301082 100644 --- a/src/client/async_client.rs +++ b/src/client/async_client.rs @@ -570,7 +570,14 @@ impl Client { if let Some(evaluator) = &self.local_evaluator { let person_props_owned = options.person_properties.clone().unwrap_or_default(); - let local_results = evaluator.evaluate_all_flags(&distinct_id, &person_props_owned); + let groups_owned = options.groups.clone().unwrap_or_default(); + let group_props_owned = options.group_properties.clone().unwrap_or_default(); + let local_results = evaluator.evaluate_all_flags( + &distinct_id, + &person_props_owned, + &groups_owned, + &group_props_owned, + ); for (key, result) in local_results { if let Some(filter) = &options.flag_keys { if !filter.iter().any(|k| k == &key) { diff --git a/src/client/blocking.rs b/src/client/blocking.rs index 2dafb9a..67c1a49 100644 --- a/src/client/blocking.rs +++ b/src/client/blocking.rs @@ -546,7 +546,14 @@ impl Client { if let Some(evaluator) = &self.local_evaluator { let person_props_owned = options.person_properties.clone().unwrap_or_default(); - let local_results = evaluator.evaluate_all_flags(&distinct_id, &person_props_owned); + let groups_owned = options.groups.clone().unwrap_or_default(); + let group_props_owned = options.group_properties.clone().unwrap_or_default(); + let local_results = evaluator.evaluate_all_flags( + &distinct_id, + &person_props_owned, + &groups_owned, + &group_props_owned, + ); for (key, result) in local_results { if let Some(filter) = &options.flag_keys { if !filter.iter().any(|k| k == &key) {