Repository navigation
fix(flags): evaluate person enrollment before group context - #1194
dustinbyrne wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Approved.
Contained local-evaluation fix with focused regression coverage and no open substantive concerns. The trusted context also reports a current-head independent review with no findings.
- Author wrote 0% of the modified lines and has 12 merged PRs in these paths (familiarity MODERATE).
- PostHog Review (Standard) reviewed the current head: no findings.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 24L, 2F substantive, 147L/4F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1c-medium (147L, 4F, two-areas, fix) |
| stamphog 2.7.0 | .stamphog/policy.yml @ ac15918 · reviewed head ac15918 |
posthog-python Compliance ReportDate: 2026-11-05T22:24:13.751403+00:00 ✅ All Tests Passed!121/121 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Capture_Ai Tests✅ 5/5 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
SDK performance: posthog-pythonBenchmarks completed. No changes flagged for review. Flags require at least a 5% change in the median and all six pairs agreeing on direction. This is a noise filter, not proof of a performance change or a CI gate. View all results
Values are medians of paired measurements. Not flagged does not mean unchanged. Unavailable means a measurement could not be provided, not zero. Estimated allocation measurements retain their instrumentation uncertainty. RSS measures the whole process, not just SDK allocations; observed peaks are sampled checkpoints. Paired ranges in the diagnostics describe variability, not confidence intervals. Each shard uses its own runner; compare Before PR against With PR within a row, not across shards. Compared 102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in |
💡 Motivation and Context
Group-aggregated enrollment flags can return
Falselocally when no group key is supplied, even when the person has explicitly enrolled. With group context supplied, they unnecessarily fall back to remote evaluation.Evaluate person enrollment before requiring group context, matching the flags service. Missing enrollment remains inconclusive and eligible for remote fallback. Inactive flags remain false, and experience-continuity flags continue to defer.
The early-access creation API rejects group-based flags; this defensively handles downloaded definitions carrying that combination. Nested group-enrollment dependencies retain their existing conservative fallback.
No public API or wire-format changes. Includes a patch changeset. Related specification: PostHog/sdk-specs#178.
💚 How did you test it?
📝 Checklist
If releasing new changes
pypi/posthog.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with pi. The builtin reviewer agent performed a comprehensive review and an independent adversarial pass. Human review is still required.