fix(flags): handle empty evaluation key scopes - #232
Merged
Conversation
Contributor
posthog-php Compliance ReportDate: 2026-08-25 12:48:36 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 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
|
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
The feature flag evaluation scope needs to distinguish between a scope that was not provided and a scope that was explicitly empty. This follows the behavior defined in sdk-specs PR #47.
When the flag key list is omitted or
null, the SDK continues to evaluate all applicable flags. When the caller provides an empty list, the SDK now returns an empty snapshot without local evaluation or a/flagsrequest. When the caller provides a non-empty list, the SDK continues to evaluate and request only those keys.The change adds an early return for the explicit empty-list case, documents that behavior on
evaluateFlags, and includes regression coverage that verifies no evaluation request is made.💚 How did you test it?
vendor/bin/phpunit --no-coverage --display-phpunit-deprecations --filter '/(testEvaluateFlagsReturnsSnapshotAndMakesOneFlagsRequest|testEmptyFlagKeysReturnsEmptySnapshotWithoutEvaluationRequests|testFlagKeysIsForwardedInRequestBody)$/' test/FeatureFlagEvaluationsTest.phppassed 3 tests with 10 assertions. One unrelated existing doc-comment metadata deprecation remains.vendor/bin/phpcs -n lib/Client.php test/FeatureFlagEvaluationsTest.phppassed.php -l lib/Client.php && php -l test/FeatureFlagEvaluationsTest.phppassed.git diff --check origin/main...HEADpassed.pnpm change statusrecognized the patch intent and plannedposthog-php4.13.4.📝 Checklist
If releasing new changes
pnpm changeto generate a change intent file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
OpenAI Codex (
gpt-5.6-sol) through Pi applied the requested PR workflow and ran the Pi autoreview tool. The Pi session is local and does not have a shareable URL. The implementation keeps the omitted and non-empty behavior unchanged and only short-circuits an explicitly empty key list.