Skip to content

Update SDK local evaluation for per-condition-set aggregation #46301

Description

@dmarticus

Part of #46288

Context

SDKs with local evaluation need to support per-condition-set aggregation and mixed person + group property filters.

Requirements

  1. Read aggregation_group_type_index from each condition set (not flag-level)
  2. Evaluate group property filters against provided group_properties
  3. Use correct hash key based on condition set's aggregation:
    • None / not set → hash distinct_id
    • 0-4 → hash the corresponding group key from groups

Affected SDKs

All SDKs with local evaluation support:

N/A

Example (Python)

def evaluate_flag(flag, distinct_id, person_properties, groups, group_properties):
    for condition_set in flag['filters']['groups']:
        if not matches_properties(condition_set['properties'], person_properties, group_properties):
            continue
            
        agg_index = condition_set.get('aggregation_group_type_index')
        if agg_index is None:
            hash_key = distinct_id
        else:
            group_type = get_group_type_name(agg_index)
            hash_key = groups.get(group_type, '')
            if not hash_key:
                continue  # Can't evaluate without group context
                
        if hash_value(hash_key, flag['key']) < condition_set.get('rollout_percentage', 100):
            return True
            
    return False

Notes

  • SDKs already receive groups and group_properties in evaluation calls
  • Main change is reading aggregation per condition set and applying group property filters

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions