fix(flags): honor versioned local property matching - #238
Draft
marandaneto wants to merge 1 commit into
Draft
Conversation
Contributor
posthog-php Compliance ReportDate: 2026-09-05 11:56:30 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
September 5, 2026 17:29
|
Reviews (1): Last reviewed commit: "fix(flags): honor versioned local proper..." | Re-trigger Greptile |
marandaneto
marked this pull request as draft
September 6, 2026 07:00
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
Local feature flag evaluation needs to honor the matching version returned with flag definitions. This follows the backend behavior in PostHog/posthog#90694 and shared contract in PostHog/sdk-specs#59.
is_notcomplementsexact. Missing properties still allow remote fallback.property_matching_version. Providers receive the complete normalized snapshot for storage. Cache reads without the selector reset to legacy matching. The existinggroupTypeMappingalias remains supported for group mapping, not for version metadata.FeatureFlagevaluation helpers gain a trailing optionalpropertyMatchingVersionparameter defaulting to 1. Existing calls remain compatible, and the public API snapshot records the additions. The external cache provider contract documents preserving the metadata. The existing patch change intent is included.Related optional harness coverage is PostHog/posthog-sdk-test-harness#53. This PR does not opt a PHP adapter into that coverage.
💚 How did you test it?
Reran these checks on the source tree committed as
65ca15245e9c4d19b5311e285a3833fec6c0d2adwith PHP 8.5.10 and PHPUnit 11.5.55:./vendor/bin/phpunit --bootstrap vendor/autoload.php --configuration phpunit.xml --no-coverage --filter 'VersionedPropertyMatchingTest|testMatchingVersionSurvivesApiAndProviderRoundTrip|testVersionOnly|testReloadDuringEvaluation|testVersionedMissing' php scripts/check-public-api.php ./vendor/bin/phpcs --standard=phpcs.xml -n lib/FeatureFlag.php lib/Client.php lib/FlagDefinitionCacheProvider.php test/VersionedPropertyMatchingTest.php test/FlagDefinitionCacheProviderTest.php git diff --checkAll exited successfully. The focused run passed 195 tests and 613 assertions, with 42 existing PHPUnit metadata deprecations. Tests exercise the real Client and evaluator with mocked HTTP/provider boundaries, including cache round-trips, version-only transitions, nested conditions, reentrant reloads, and remote fallback. Positive local cases permit fallback and assert that no remote flag request occurs.
Earlier implementation validation passed the broader flag suite with 471 tests and 3819 assertions. That earlier run reported four existing SDK deprecated-method notices as well as the metadata deprecations. PHPCS without
-npreviously reported 13 unchanged-line length warnings and no errors. The complete unrelated suite, coverage, and live-service integration were not run in this publication pass. Local checks are not a CI result.The required isolated committed-branch autoreview passed for this exact commit against
origin/mainat6da44cd256743e9ba08c14a685dc8e8c5ac1e561, with no actionable findings.📝 Checklist
If releasing new changes
pnpm changeto generate a change intent fileThe existing
.changeset/versioned-property-matching.mdrecords a patch intent. It was preserved without rerunning the generator or adding a duplicate.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi agents assisted implementation and publication under human direction. Tools used included Git, PHP, PHPUnit, PHP_CodeSniffer, GitHub CLI, and the isolated Pi autoreview helper with TruffleHog. The local agent session is not publicly shared.
The implementation preserves legacy defaults and optional helper arguments while keeping matching metadata with each definition snapshot. Publication retained the approved changes and used a new signed commit without rewriting history. Human review is required before merging.