PostHog / PostHog/posthog

Implement per-condition-set aggregation in Rust flag evaluator

Open
#46,299 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Part of #46288

Context

The Rust flag evaluation service needs 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. Allow conditions to contain both person and group property filters
  3. Evaluate group properties against provided group_properties context
  4. Use correct hash key based on condition set's aggregation:
    • None → hash distinct_id
    • 0-4 → hash groups[index]

Evaluation Logic

for condition_set in flag.conditions {
    if !matches_filters(&condition_set.properties, &person_props, &group_props) {
        continue;
    }
    
    let hash_key = match condition_set.aggregation_group_type_index {
        None => distinct_id.clone(),
        Some(idx) => groups.get(idx).cloned().unwrap_or_default(),
    };
    
    if hash_percentage(&hash_key, &flag.key) < condition_set.rollout_percentage {
        return true;
    }
}
return false;

Edge Cases

  • If condition set has group filters but group context not provided → return false for that condition set (strict mode)
  • If condition set aggregates on a group type but that group key not provided → skip to next condition set

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the Rust flag evaluation service and locate the condition-set evaluation path. Verify per-condition-set aggregation, mixed person and group filters, group_properties handling, and the specified missing-context edge cases; done means each requirement and edge case behaves as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.