Repository navigation
fix(flags): treat unsupported property-filter types as inconclusive - #394
Conversation
Local evaluation matched any filter type other than cohort and flag against caller-supplied properties, so a cohort's person_metadata filter on first seen matched a created_at person property. Only person, group, and untyped filters now match caller properties; any other type is inconclusive with the unsupported_definition reason, including in the load-time definition check.
PR overviewNo security issues were found in this pull request. Reviews
|
There was a problem hiding this comment.
Approved.
Contained flag-evaluation correctness fix with focused regression coverage and no open substantive concerns. The trusted context reports a current-head review with no findings; the bot's scanning comment is not an in-flight reaction.
- Author wrote 0% of the modified lines and has 51 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 |
| every_file_attested | ✓ | not a bot PR |
| size | ✓ | 31L, 2F substantive, 222L/4F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (222L, 4F, cross-cutting, fix) |
| stamphog 2.9.1 | .stamphog/policy.yml @ bf7903e · reviewed head bf7903e |
posthog-ruby-sync Compliance ReportDate: 2026-11-26T11:28:34.415690+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
|
posthog-ruby-async Compliance ReportDate: 2026-11-26T11:28:34.484019+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-ruby2 changes worth reviewing: 2 observed regressions. 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 |
|
Agent-drafted and reviewed by Manoel. About the SDK performance comment: the "Evaluate a flag (no match)" slowdown is real but small, and we are accepting it.
No code change for this. |
Brings in "fix(flags): treat unsupported property-filter types as inconclusive" (#394, PostHog/sdk-specs#251). Conflict in lib/posthog/feature_flags.rb, resolved to keep both sides: - match_property checks the filter type with assert_property_filter_type_supported before the known-absent listing check, so an unsupported type such as person_metadata stays inconclusive (unsupported_definition) even when its key is listed known absent. The listing never resolves an unsupported filter. - Kept this PR's assert_operator_supported next to main's PROPERTY_FILTER_TYPES and assert_property_filter_type_supported, and made all three private. Seven known-absent specs expected a person_metadata filter to read caller properties (missing_context, or a match from a supplied value). The spec now says that filter is unsupported_definition whatever the caller passes, so those specs are updated in the next commit.
After merging #394 (PostHog/sdk-specs#251), a person_metadata filter is inconclusive with unsupported_definition whatever the caller passes, and listing its key as known absent doesn't resolve it. Update the known-absent specs that expected missing_context or a match from a supplied created_at value.
💡 Motivation and Context
A cohort can filter on Person metadata > First seen:
{"type": "person_metadata", "key": "created_at", ...}./flagsreads that value from the persons table and never compares it with acreated_atperson property (PostHog/posthog#137503). PostHog/sdk-specs#251 made this a spec rule: a filter type other thanperson,group,cohortorflagis inconclusive withunsupported_definition, and a missing,nullor emptytypeis still a person filter.On
main, local evaluation sends every type exceptcohortandflagto the person-property matcher. A caller that passes its owncreated_atgets a local answer that can disagree with/flags, and the load-time warning doesn't list the flag.This change:
assert_property_filter_type_supported, which lets throughperson,groupand a missing,nilor""type, and raisesInconclusiveMatchErrorwithUNSUPPORTED_DEFINITIONfor any other type;match_property(flag conditions and cohort leaves) and inunsupported_filter?(the load-time check, including inside cohorts);UnresolvedFlagReasondoc to mention unknown filter types.It's an ordinary inconclusive result, so negation and
not_indon't turn it into a match, another filter can still decide a cohort group or a condition, a later condition can still match, and other flags keep evaluating locally.A
flagleaf inside a cohort keeps its current handling onmain. Autoreview pointed out that this is matched as a plain property. That's existing behaviour and out of scope here.The same fix for other SDKs: PostHog/posthog-python#1288, PostHog/posthog-go#465, PostHog/posthog-js#5840, PostHog/posthog-rs#397.
💚 How did you test it?
spec/posthog/feature_flags_unsupported_filter_type_spec.rb(28 examples). 15 fail onmainand all pass with the fix.bundle exec rspec: 2625 examples, 0 failures (49 pending need the optional otel bundle).bundle exec rubocopandrake public_api:checkpass.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
early_exit. The Python, Go, Node and Rust fixes do the same.