Repository navigation
fix(flags): defer an index-less group filter in a person condition - #413
Conversation
A group property filter without group_type_index in a person-aggregated condition is now inconclusive with unsupported_definition, also when its key is listed as known absent, so the flag falls back to /flags. It was matched against person properties, which could contradict the flags service. Follows PostHog/sdk-specs#265.
posthog-dotnet Compliance ReportDate: 2026-12-02T09:45:14.905824+00:00 ✅ All Tests Passed!47/47 tests passed Capture Tests✅ 30/30 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
SDK performance: posthog-dotnetBenchmarks 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. Compared 108 metric rows; 108 rows shown in all results. Omitted or shortened data remain in |
dustinbyrne
left a comment
There was a problem hiding this comment.
The core evaluation fix in EvaluateConditionMatch accurately aligns local evaluation and remote fallback with PostHog/sdk-specs#265 and rust/feature-flags, and the unit tests and PostHog / PostHog.AspNetCore changesets are clean.
One concern inline: leaving GetDefinitionUnresolvedReason without the corresponding per-condition check introduces condition-order-dependent UnresolvedFlagReason precedence when paired with a RequiresServerEvaluationException dependency (evaluate-flags SHALL) and skips the load-time unsupported_definition warning.
Out-of-scope follow-up: PostHog/posthog-php (lib/FeatureFlag.php:1866,2470-2482) has the same omission in conditionsDefinitionReason and is worth aligning separately.
AI-assisted review.
…n the definition reason
There was a problem hiding this comment.
Approved.
Contained evaluation fix with regression coverage and no outstanding substantive concerns. The current code addresses @dustinbyrne’s older concern by applying the condition-aware definition check used for unresolved-reason precedence.
- Author wrote 50% of the modified lines and has 39 merged PRs in these paths (familiarity MODERATE).
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| every_file_attested | ✓ | not a bot PR |
| size | ✓ | 23L, 1F substantive, 191L/5F incl. size-exempt files — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (191L, 5F, cross-cutting, fix) |
| stamphog 2.11.0 | .stamphog/policy.yml @ dd4072d · reviewed head dd4072d |
💡 Motivation and Context
Follows PostHog/sdk-specs#265. In a person-aggregated condition, a
type: "group"property filter withoutgroup_type_indexhas no group type to read. The flags service matches it against no properties:PropertyFilter::group_filter_indexreturnsNone, andPropertyContext::resolve_for_filterreturns an empty map. This SDK matched the filter against person properties instead. When the caller supplied a person property with the same key, the SDK returned a local result that/flagscontradicts. For example, person propertytierset toenterprisemadeexact "enterprise"match locally, while the flags service returns no match.The filter is now inconclusive with the
unsupported_definitionreason, also when its key is listed as known absent. The flag falls back to/flags, or stays unresolved in local-only mode. This is how posthog-php handles it since PostHog/posthog-php#328.EvaluateConditionMatchchecks the filter before it resolves the filter context or known-absent keys.A group filter without an index in a group-aggregated condition still reads the condition's group type. The definition check behind the load-time warning and reason precedence also reports the filter as
unsupported_definitionin a person-aggregated condition, so the reason does not depend on condition order. posthog-php doesn't check this at load time yet.💚 How did you test it?
Added unit tests that go through the public
EvaluateFlagsAsync. They cover a person flag with the condition aggregation omitted and a group flag whose condition sets it tonull,exactandis_not_set, and the key either set as both a person and a group property or listed known absent for both. Local-only mode leaves the flag unresolved, and otherwise it falls back to/flagswith one request. Group conditions still read their own group. Precedence cases cover the filter alongside a dependency on a static-cohort flag in either condition order, and the definition reason is checked for person and group conditions. Locally, all 2,248 unit tests pass on net10.0, and the net8.0 build anddotnet formatare clean.The new person-condition tests fail without the fix.
📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Pi (Claude). The spec defers to
/flagsinstead of copying the flags service's empty-map result, because that result comes from the missing index, not a chosen rule, and the PostHog app always setsgroup_type_index. I checked the flags service behavior againstrust/feature-flagsin PostHog/posthog.