Repository navigation
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-10-29T15:12:10.692068+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
|
This was referenced Oct 30, 2026
andehen
marked this pull request as ready for review
November 2, 2026 11:26
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Why: sdk-specs #111 adds the requirement "Snapshot feature flag event control" to
evaluate-flags. A caller can now read a flag from anevaluate_flags()snapshot without sending$feature_flag_called, the same wayget_feature_flag(..., send_feature_flag_events=False)does for one flag. posthog-js implements it in PostHog/posthog-js#5252.Changes:
FeatureFlagEvaluations.is_enabled()andget_flag()take a keyword-onlysend_feature_flag_events: bool = True.False, the read sends no$feature_flag_called, including theflag_missingevent for a key that is not in the snapshot. It also does not check or update the dedupe cache, so a later read that sends events, on the snapshot or throughget_feature_flag(), still reports the flag.only_accessed().get_flag_payload(),keys,only(),only_accessed()andevaluate_flags()do not take the option, as the spec says.Decision order: the spec checks the per-read option, then the SDK's client-level feature flag event default, then
True. posthog-python has no client-level default:get_feature_flag()andfeature_enabled()takesend_feature_flag_events: bool = Trueand nothing else. So step 2 does not apply, and the snapshot option mirrors those getters with aTruedefault. The scenarios tagged@requires:flag_event_defaultdo not apply to this SDK.💚 How did you test it?
TestEvaluateFlagsPerReadEventOptioninposthog/test/test_evaluate_flags.pycovers each spec scenario that applies:test_option_false_silences_one_readtest_suppressed_read_leaves_dedupe_untouchedtest_suppressed_read_leaves_single_flag_getter_exposure_intacttest_suppressed_reads_still_count_for_only_accessedtest_suppressed_missing_key_reports_no_missing_flag@requires:flag_event_default)test_option_true_sends_eventschecks that an explicitTruesends.Run locally:
pytest posthog/test --timeout=30: all pass except three fork tests intest_metrics_autocapture.py, which fail the same way onmainin my local full run and pass when that file runs alone.ruff format --checkandruff checkon the changed files, mypy with the baselinemake public_api_check. The snapshot shows the two new keyword arguments.No manual testing in an app.
📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Claude Code from the merged spec, using posthog-js#5252 as a reference. The option defaults to
Trueinstead ofNone, because Python has no client-level default to fall back to and the single-flag getters usebool = True.🤖 Generated with Claude Code