Skip to content

fix(flags): don't match person_metadata filters against person properties - #1288

Merged
marandaneto merged 7 commits into
PostHog:mainfrom
srednoff888-art:fix/person-metadata-filters
Nov 26, 2026
Merged

marandaneto merged 7 commits into
PostHog:mainfrom
srednoff888-art:fix/person-metadata-filters

Conversation

@srednoff888-art

@srednoff888-art srednoff888-art commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Part of PostHog/posthog#137503, for posthog-python, where the issue was reproduced.

A cohort can filter on Person metadata > First seen: {"type": "person_metadata", "key": "created_at", ...}. /flags reads that value from the persons table and ignores any created_at person property. Local evaluation treated every filter type other than cohort and flag as a person property, so:

  • person_properties={} was inconclusive and fell back to /flags (correct);
  • person_properties={"created_at": "2026-06-01"} returned a local answer from that value, which can disagree with /flags for teams that set their own created_at person property.

This follows the merged spec requirement "Unsupported property-filter types are inconclusive" (PostHog/sdk-specs#251):

  • _match_condition_filter now matches only person and group filters, or one whose type is missing, null or "", against the caller's properties. cohort and flag filters keep their own matching. Any other type raises InconclusiveMatchError with unsupported_definition. This covers flag conditions and cohort criteria, which both go through it.
  • It's an ordinary inconclusive result. Negation and not_in don't turn it into a match, another filter can still decide a cohort (AND with a mismatch, OR with a match) or a condition, and a later condition can still match. An inconclusive condition doesn't trigger early_exit, as the spec's condition-group requirement says.
  • _is_unsupported_property applies the same rule, so the definition check marks such a flag unsupported_definition when definitions load.
  • When a later filter needs the server (for example a dependency on a static cohort), the reason keeps its precedence, so unsupported_definition still wins over unresolved_dependency.
  • The load-time warning and the UNSUPPORTED_DEFINITION docstring mention filter types.
  • The public match_property is unchanged.

The same change for posthog-node is PostHog/posthog-js#5840, for posthog-go PostHog/posthog-go#465, and for posthog-rs PostHog/posthog-rs#397.

💚 How did you test it?

New posthog/test/test_feature_flags_person_metadata.py, through Client.evaluate_flags:

Case Expected
person_metadata filter in a cohort, caller passes created_at falls back to /flags and returns its answer
person_metadata filter directly in a flag condition falls back to /flags
only_evaluate_locally=True, with and without created_at, and with negation or not_in unresolved, unsupported_definition, no /flags call
loading the definitions logs the unsupported_definition warning
a later condition with another variant, or behind a dependent flag the later condition decides locally
with early_exit, a later condition excluded by its rollout stays inconclusive and falls back to /flags
another filter in the condition that does not match False locally
another filter that decides an AND or OR cohort, also with not_in, in either order, with the filter nested, in another cohort or behind a flag dependency decided locally, no /flags call
a cohort that stays undecided, with a later condition the later condition decides locally
several causes in one cohort, one condition or several conditions, including a dependency on a static cohort the highest-precedence reason
a person filter on created_at, or one whose type is missing, null or "", or a group filter still evaluated locally

Reverting the filter-type check, the definition check or either reason-precedence line makes some of these fail.

  • After the maintainer commits, on macOS with Python 3.11: the full posthog/test suite passes (8432 passed) apart from 3 fork tests in test_metrics_autocapture.py that also fail on main there. ruff check, ruff format --check and mypy are clean.
  • The flag tests on 3d709c7, on Windows: 2139 passed, 1 failed, the digest of vendored fixtures below.
  • The whole posthog/test tree with the test extra, on Windows, run on an earlier commit: 8938 passed, 41 skipped, 16 failed. 14 of them fail on the base commit too: fork hooks, path separators, and a digest of vendored fixtures. The other two are timing-dependent here: one also fails without this commit, the other passes when run alone.
  • End to end: a Posthog client against a local HTTP server that serves the definitions and /flags, with an AND cohort of a plan filter and First seen. It answers locally for a person the plan rules out, and makes exactly one /flags request otherwise.
  • ruff format --check is clean. ruff check reports nothing in the new test file and nothing new in feature_flags.py.

📝 Checklist

  • All commits are signed (see Commit signing)
  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran sampo add to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • Written with Claude Code. The account owner asked for fixes to open PostHog SDK issues, and the agent picked this one. The owner has reviewed the full diff at 3d709c7.
  • I used an allow-list (person, group) instead of special-casing person_metadata, so a filter type added on the server later also falls back instead of being matched as a person property.
  • Manoel pushed f1a521e and d0ab027 to align with the merged spec: the filter is now an ordinary inconclusive result rather than a server-only stop, so a later condition can decide the flag, and a null or "" type is a person filter. He also added the precedence test from review.

🤖 Generated with Claude Code

…ties

A cohort can filter on Person metadata > First seen
(type "person_metadata", key "created_at"). /flags reads that value
from the persons table and ignores any created_at person property.
Local evaluation treated every filter type other than cohort and flag
as a person property, so a caller passing created_at got an answer
based on that value, which could disagree with /flags.

Only person and group filters are now matched against the properties
the caller passes. Any other type is unsupported_definition: the
definition check flags it when definitions load, and evaluation falls
back to /flags (or stays unresolved with only_evaluate_locally).
match_property itself is unchanged.

Part of PostHog/posthog#137503 (posthog-python)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runtime change in posthog/feature_flags.py looks minimal and matches both /flags (person_metadata reads from the persons table rather than person properties) and posthog-dotnet's allow-list approach for unsupported property filter types.

There are two test concerns inline before approval:

  1. The new _is_unsupported_property check (posthog/feature_flags.py:1862) has no test coverage, and the new test file only exercises the deprecated get_feature_flag path.
  2. TestPersonMetadataFilters._client constructs live Client(..., send=True) instances without client.shutdown(), leaking background Consumer threads that attempt outbound capture POSTs during longer test runs.

Outside the scope of this PR (non-blocking follow-ups): codifying the property filter type allow-list in PostHog/sdk-specs, aligning remaining peer server SDKs and the posthog.com local-evaluation restrictions docs, and evaluating separately whether sdk-specs should address multi-condition multivariate / early_exit catch-all fallthrough after an inconclusive condition.

AI-assisted review.

Comment thread posthog/feature_flags.py Resolved
@dustinbyrne
dustinbyrne requested a review from a team November 23, 2026 21:43
The error let later conditions decide the flag. Only /flags knows the value,
so treat it like a static cohort. Also cover the load-time warning,
evaluate_flags and negation, with a client that sends nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the tests and fixing the test client cleanup — both concerns from the earlier review (_load_feature_flags() / evaluate_flags() / unresolved_flags / negation & negative-control coverage, and send=False + client.shutdown()) are addressed cleanly.

One Breaking regression remains inline on posthog/feature_flags.py before approval: switching _assert_property_filter_type_supported to raise RequiresServerEvaluation breaks three-valued AND/OR short-circuiting in match_property_group for dynamic cohorts that combine person_metadata with another filter (affecting both AND — including not_in — and OR cohorts, regressing merge-base behavior when created_at is omitted, and diverging from sdk-specs).

Optional Suggestion (non-blocking, outside the current diff): consider adding "an unsupported filter type" to the example list in the load-time unsupported_definition warning (posthog/client.py:4280-4288) and UnresolvedFlagReason.UNSUPPORTED_DEFINITION docstring (posthog/types.py:130-133) so operators seeing the warning for a dynamic cohort with a First seen filter can diagnose it directly.

(Outside this PR's scope as non-blocking follow-ups: pre-existing filter-order handling in _match_condition_properties at posthog/feature_flags.py:928 matches test_static_cohort_after_unchecked_filter_lets_later_conditions_resolve and peer SDKs; documenting person_metadata restrictions in PostHog/posthog.com and codifying unsupported filter types in PostHog/sdk-specs.)

AI-assisted review.

Comment thread posthog/feature_flags.py Resolved
@dustinbyrne
dustinbyrne requested a review from a team November 24, 2026 20:20
A cohort stopped at the first filter that only the server can check, even when
another filter had already decided it. Raise the error only when the cohort
stays undecided.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fast follow-up in 07ee9f6 — the _RequiresServerFilter deferral cleanly resolves the dynamic-cohort three-valued AND/OR regression (all 9 decisive-sibling regression cases now pass on 07ee9f6, alongside all 21 new tests and 1530 flag tests), and the warning/docstring updates look great.

One narrow Concern remains inline on posthog/feature_flags.py before approval: deferring _RequiresServerFilter in match_property_group drops higher-precedence UnresolvedFlagReason values (UNSUPPORTED_DEFINITION lost to UNRESOLVED_DEPENDENCY), with the same precedence drop amplified at _raise_condition_errors:960-961 and _match_flag_conditions:633-641. There is also one optional Suggestion inline on posthog/test/test_feature_flags_person_metadata.py.

(Outside this PR's scope as non-blocking follow-ups: documenting person_metadata / unsupported filter types in PostHog/posthog.com's local-evaluation restrictions, codifying them in PostHog/sdk-specs, and aligning peer server SDKs under PostHog/posthog#137503.)

AI-assisted review.

Comment thread posthog/feature_flags.py Resolved
@dustinbyrne
dustinbyrne requested a review from a team November 24, 2026 21:34
…lter

An error that only the server can resolve kept its own reason, so a flag with
a runtime unsupported_definition filter could be reported as
unresolved_dependency. The reasons are now merged in the cohort group, in the
condition and across conditions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

SDK performance: posthog-python

Benchmarks 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
Test Measurement Before PR With PR Change Assessment
Capture and deliver events (32-byte payload, burst)
Shard: capture
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Capture and deliver events (32-byte payload, steady)
Shard: capture
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Queue an event (32-byte payload)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​; head:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​
Queue an event (32-byte payload)
Shard: capture
Allocations per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​; head:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​
Queue an event (4,096-byte payload)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​; head:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​
Queue an event (4,096-byte payload)
Shard: capture
Allocations per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​; head:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Refresh 1,000 flag definitions
Shard: flags-memory
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Capture and deliver events (32-byte payload, burst)
Shard: capture
Allocated memory per operation 133.67 KiB/op 133.67 KiB/op <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Allocations per operation 1,345.52 count/op 1,345.53 count/op <0.1% more Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Time per operation 141.98 µs/op 142.87 µs/op 0.6% more time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Idle process memory (RSS) 37.78 MiB 37.77 MiB <0.1% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 40.23 MiB 40.23 MiB <0.1% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Process memory after settling (RSS) 40.23 MiB 40.23 MiB <0.1% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Process CPU time per operation 143.08 µs/op 144.28 µs/op 0.8% more time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Lifetime peak process memory (RSS) 40.4 MiB 40.42 MiB <0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Allocated memory per operation 185.76 KiB/op 185.76 KiB/op <0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Allocations per operation 1,337.57 count/op 1,337.57 count/op <0.1% more Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Time per operation 171.88 µs/op 175.63 µs/op 2.2% more time Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Idle process memory (RSS) 41.33 MiB 41.28 MiB 0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 47.11 MiB 47.07 MiB <0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Process memory after settling (RSS) 47.11 MiB 47.07 MiB <0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Process CPU time per operation 162.96 µs/op 167.86 µs/op 3% more time Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Lifetime peak process memory (RSS) 51.54 MiB 51.46 MiB 0.1% less memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Allocated memory per operation 138.74 KiB/op 138.74 KiB/op No observed change Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Allocations per operation 1,390.42 count/op 1,390.42 count/op No observed change Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Time per operation 152.18 µs/op 152.76 µs/op 0.4% more time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Idle process memory (RSS) 37.66 MiB 37.75 MiB 0.2% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 37.83 MiB 37.9 MiB 0.2% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 37.83 MiB 37.9 MiB 0.2% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process CPU time per operation 150.02 µs/op 149.76 µs/op 0.2% less time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 40.28 MiB 40.28 MiB No observed change Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Allocated memory per operation 190.92 KiB/op 190.92 KiB/op <0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Allocations per operation 1,382.38 count/op 1,382.38 count/op <0.1% fewer Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Time per operation 188.05 µs/op 192.25 µs/op 2.2% more time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Idle process memory (RSS) 41.16 MiB 41.24 MiB 0.2% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 41.62 MiB 41.68 MiB 0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 41.22 MiB 41.28 MiB 0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process CPU time per operation 181.55 µs/op 187.45 µs/op 3.2% more time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 41.58 MiB 41.55 MiB <0.1% less memory Not flagged
Queue an event (32-byte payload)
Shard: capture
Caller-thread CPU time per operation 108.82 µs/op 106.09 µs/op 2.5% less time Not flagged
Queue an event (32-byte payload)
Shard: capture
Time per operation 111.93 µs/op 108.96 µs/op 2.7% less time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Caller-thread CPU time per operation 110.72 µs/op 114.35 µs/op 3.3% more time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Time per operation 110.74 µs/op 114.35 µs/op 3.3% more time Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Allocated memory per operation 225.43 KiB/op 233.85 KiB/op 3.7% more memory Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Allocations per operation 2,279.42 count/op 2,352.93 count/op 3.2% more Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Time per operation 84.59 µs/op 84.92 µs/op 0.4% more time Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Process CPU time per operation 84.6 µs/op 84.92 µs/op 0.4% more time Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Allocated memory per operation 2.17 MiB/op 2.25 MiB/op 3.8% more memory Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Allocations per operation 22,413.69 count/op 23,148.75 count/op 3.3% more Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Time per operation 777.99 µs/op 800.25 µs/op 2.9% more time Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Process CPU time per operation 778.04 µs/op 800.26 µs/op 2.9% more time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Allocated memory per operation 21.63 MiB/op 22.45 MiB/op 3.8% more memory Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Allocations per operation 223,655.44 count/op 231,005.5 count/op 3.3% more Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Time per operation 7.79 ms/op 7.92 ms/op 1.7% more time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Process CPU time per operation 7.79 ms/op 7.92 ms/op 1.7% more time Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Idle process memory (RSS) 43.99 MiB 43.95 MiB <0.1% less memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Observed peak process memory (RSS) 44.32 MiB 44.25 MiB 0.2% less memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Process memory after settling (RSS) 44.32 MiB 44.25 MiB 0.2% less memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Lifetime peak process memory (RSS) 44.07 MiB 44 MiB 0.2% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Idle process memory (RSS) 43.15 MiB 43.09 MiB 0.1% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Observed peak process memory (RSS) 43.16 MiB 43.09 MiB 0.1% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Process memory after settling (RSS) 43.16 MiB 43.09 MiB 0.1% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Lifetime peak process memory (RSS) 42.96 MiB 43.31 MiB 0.8% more memory Not flagged
Evaluate one boolean flag
Shard: flags-single
Allocated memory per operation 15.74 KiB/op 15.74 KiB/op No observed change Not flagged
Evaluate one boolean flag
Shard: flags-single
Allocations per operation 162.77 count/op 162.77 count/op No observed change Not flagged
Evaluate one boolean flag
Shard: flags-single
Time per operation 8.18 µs/op 8.15 µs/op 0.3% less time Not flagged
Evaluate one boolean flag
Shard: flags-single
Process CPU time per operation 8.18 µs/op 8.16 µs/op 0.3% less time Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Allocated memory per operation 24.6 KiB/op 25.28 KiB/op 2.8% more memory Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Allocations per operation 239.28 count/op 245.28 count/op 2.5% more Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Time per operation 11.4 µs/op 11.57 µs/op 1.5% more time Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Process CPU time per operation 11.4 µs/op 11.57 µs/op 1.5% more time Not flagged
Evaluate a flag (early match)
Shard: flags-single
Allocated memory per operation 39.81 KiB/op 41.36 KiB/op 3.9% more memory Not flagged
Evaluate a flag (early match)
Shard: flags-single
Allocations per operation 388.27 count/op 401.77 count/op 3.5% more Not flagged
Evaluate a flag (early match)
Shard: flags-single
Time per operation 16.2 µs/op 16.6 µs/op 2.5% more time Not flagged
Evaluate a flag (early match)
Shard: flags-single
Process CPU time per operation 16.2 µs/op 16.61 µs/op 2.5% more time Not flagged
Evaluate a flag (late match)
Shard: flags-single
Allocated memory per operation 60.59 KiB/op 63.34 KiB/op 4.5% more memory Not flagged
Evaluate a flag (late match)
Shard: flags-single
Allocations per operation 584.27 count/op 608.27 count/op 4.1% more Not flagged
Evaluate a flag (late match)
Shard: flags-single
Time per operation 23.42 µs/op 23.93 µs/op 2.2% more time Not flagged
Evaluate a flag (late match)
Shard: flags-single
Process CPU time per operation 23.42 µs/op 23.93 µs/op 2.2% more time Not flagged
Evaluate a flag (no match)
Shard: flags-single
Allocated memory per operation 59.22 KiB/op 61.97 KiB/op 4.6% more memory Not flagged
Evaluate a flag (no match)
Shard: flags-single
Allocations per operation 567.77 count/op 591.77 count/op 4.2% more Not flagged
Evaluate a flag (no match)
Shard: flags-single
Time per operation 21.94 µs/op 22.7 µs/op 3.5% more time Not flagged
Evaluate a flag (no match)
Shard: flags-single
Process CPU time per operation 21.94 µs/op 22.7 µs/op 3.5% more time Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Allocated memory per operation 19.04 KiB/op 19.38 KiB/op 1.8% more memory Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Allocations per operation 192.27 count/op 195.27 count/op 1.6% more Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Time per operation 9.15 µs/op 9.26 µs/op 1.2% more time Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Process CPU time per operation 9.15 µs/op 9.26 µs/op 1.2% more time Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Allocated memory per operation 20.66 KiB/op 21.01 KiB/op 1.7% more memory Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Allocations per operation 197.77 count/op 200.77 count/op 1.5% more Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Time per operation 9.76 µs/op 9.77 µs/op 0.1% more time Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Process CPU time per operation 9.76 µs/op 9.77 µs/op 0.1% more time Not flagged
Evaluate a rollout flag
Shard: flags-single
Allocated memory per operation 14.89 KiB/op 14.89 KiB/op No observed change Not flagged
Evaluate a rollout flag
Shard: flags-single
Allocations per operation 152.77 count/op 152.77 count/op No observed change Not flagged
Evaluate a rollout flag
Shard: flags-single
Time per operation 7.58 µs/op 7.66 µs/op 1.1% more time Not flagged
Evaluate a rollout flag
Shard: flags-single
Process CPU time per operation 7.58 µs/op 7.66 µs/op 1.1% more time Not flagged
Evaluate a multivariate flag
Shard: flags-single
Allocated memory per operation 15.9 KiB/op 15.9 KiB/op No observed change Not flagged
Evaluate a multivariate flag
Shard: flags-single
Allocations per operation 166.77 count/op 166.77 count/op No observed change Not flagged
Evaluate a multivariate flag
Shard: flags-single
Time per operation 8.46 µs/op 8.49 µs/op 0.3% more time Not flagged
Evaluate a multivariate flag
Shard: flags-single
Process CPU time per operation 8.46 µs/op 8.49 µs/op 0.3% more time Not flagged

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 84fc9e06bd898fe090e7443138e32010b9aa91db → d0ab027591ae9dfc8d9868695a771186e7f1d981.

Full report and diagnostics

102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in comparison.json, including per-runner environments, resource limits, measurement methods, samples and checkpoints.

@marandaneto

Copy link
Copy Markdown
Member

lemme confirm PostHog/sdk-specs#251 before merging

@marandaneto marandaneto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent-drafted and reviewed by Manoel.

Comment thread posthog/feature_flags.py Resolved
@marandaneto
marandaneto requested a review from a team November 25, 2026 14:58

@marandaneto marandaneto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good; no qualifying findings. Verdict: correct.

Thank you for your contribution!

@marandaneto
marandaneto merged commit d569130 into PostHog:main Nov 26, 2026
55 checks passed
marandaneto added a commit that referenced this pull request Nov 26, 2026
…ests

Main #1288 (sdk-specs#251) sends a person_metadata filter to /flags instead of
matching it against a supplied created_at, even when created_at is listed. The
test that expected a person_metadata filter to read the supplied value is
deleted; test_listed_key_does_not_resolve_a_person_metadata_filter already
asserts the new behavior.

The duplicate person key test used a person_metadata filter to read the value
outside the listing's scope. No supported filter reads a person listing outside
its scope now, so it checks that a duplicated person key still reads as absent.
The group duplicate test keeps covering the out-of-scope read.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants