fix(flags): honor versioned local property matching - #266
Draft
marandaneto wants to merge 1 commit into
Draft
Conversation
posthog-ruby Compliance ReportDate: 2026-09-05 12:48:08 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
Contributor
|
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 use the
property_matching_versionreturned with definitions so Ruby agrees with the service. This follows the backend behavior and the shared SDK contract.Intentional service-v1 compatibility correction: Missing/1 versions now use the released service's aggregate boolean truthiness instead of Ruby's previous unversioned explicit comparison. For example, a
falsefilter matches"banana"in legacy mode. This can change existing local results even before version 2 is enabled. Unsupported version selectors also use legacy matching.Exactly numeric version 2 uses explicit scalar equality or member equality for nonempty filter arrays. Empty filter arrays retain recursive truthiness.
is_notcomplementsexactfor known properties, while missing properties remain inconclusive. Null and composite values use JSON representations with sorted object keys rather than Ruby's nil/array string conversions.Definitions and their matching version are published together in an atomic snapshot. Person, group, mixed, recursive cohort, dependency, payload and full-result evaluation retain that snapshot across refreshes. Version-only refreshes take effect on the next evaluation. The initial empty legacy snapshot is available before polling starts.
External cache providers must store the entire snapshot, including
property_matching_versionand version-only updates. Older entries without the version select legacy matching. The cache provider documentation and the existingposthog-rubypatch changeset describe this requirement and the compatibility correction.Optional shared harness coverage is related work. This PR does not opt an adapter into it.
💚 How did you test it?
ruby /Users/marandaneto/Github/posthog-ruby/vendor/bundle/ruby/4.0.0/bin/rspec -I lib spec/posthog/feature_flags_property_matching_version_spec.rbon the exact tree committed as63d115ab09cbb40af1c8bf35c7984151a05d600a: 327 examples, 0 failures. Tests cover both operators, selectors, null/composite values, missing properties, version-only refreshes, JSON cache round trips, dependencies, asynchronous loading, 304/error retention and refresh interleavings.git diff --checkpassed. The required isolated autoreview againstorigin/mainpassed on the final signed commit with no actionable findings.📝 Checklist
The existing patch changeset provides the release note, including the intentional legacy behavior correction above. No generated changelog was edited.
If releasing new changes
pnpm changesetto generate a changeset fileThe existing
.changeset/versioned-property-matching.mdwas retained. The generator was not rerun.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi implementation and publication agents used file inspection/editing tools, Bash, Git, GitHub CLI and the isolated autoreview helper. The human directed the versioned matching contract and publication scope. Session context is local, with no public session link available.
The implementation keeps matching metadata with definition snapshots to avoid switching semantics during an evaluation. It intentionally corrects Ruby's prior service-v1 mismatch rather than preserving that divergence. The signing retry used the existing Secretive SSH identity. This draft requires human review and does not enable auto-merge or release anything.