fix(flags): handle empty evaluation key scopes - #895
Merged
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-08-25 11:53:49 UTC ✅ All Tests Passed!111/111 tests passed Capture_V1 Tests✅ 94/94 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
marandaneto
marked this pull request as ready for review
August 25, 2026 11:06
Contributor
|
Reviews (1): Last reviewed commit: "fix(flags): handle empty evaluation key ..." | Re-trigger Greptile |
turnipdabeets
approved these changes
Aug 25, 2026
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
evaluate_flagstreated an explicit emptyflag_keyslist the same as an omitted scope and evaluated every flag. This did not match the evaluation scope behavior defined in sdk-specs PR #47.When
flag_keysis omitted orNone, the SDK continues to evaluate all flags. When it is an explicit empty list, the SDK now returns an empty snapshot without loading definitions or running local or remote evaluation. When it contains keys, the SDK continues to evaluate and return only that requested scope.The public and client method documentation now describes these three cases.
💚 How did you test it?
uv run pytest --verbose --timeout=30 posthog/test/test_evaluate_flags.py- 44 passed.uv run pytest --verbose --timeout=30 posthog/test/test_evaluate_flags.py -k 'empty_flag_keys or forwards_flag_keys or returns_a_FeatureFlagEvaluations_instance'- 3 passed and 41 deselected.uv run ruff format --check .- 279 files already formatted.uv run ruff check .- all checks passed.uv run mypy --no-site-packages --config-file mypy.ini . | uv run mypy-baseline filter- no issues found in 217 source files.uv run python -W error -c "import posthog"- passed with no warnings.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
A Pi coding agent prepared the commit, ran the requested validation, and opened this draft PR under human direction. Pi's autoreview skill reviewed the committed branch against
origin/mainand reported no actionable findings. A human must review and merge this PR.