feat: support starts_with and ends_with operators in local evaluation - #229
Draft
haacked wants to merge 1 commit into
Draft
feat: support starts_with and ends_with operators in local evaluation#229haacked wants to merge 1 commit into
haacked wants to merge 1 commit into
Conversation
Adds local evaluation for the starts_with, not_starts_with, ends_with, and not_ends_with property filter operators (PostHog/posthog#72992). Matching is case-insensitive and mirrors icontains: both sides are stringified and lowercased, and the not_ variants are exact negations. Generated-By: PostHog Code Task-Id: ef980bb5-ff81-4191-a7df-796e932b8251
posthog-ruby Compliance ReportDate: 2026-07-31 02:44:16 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
|
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
PostHog/posthog#72992 added four case-insensitive property filter operators —
starts_with,not_starts_with,ends_with,not_ends_with— across HogQL, the flags service, and the UI. The UI surface is gated behind a feature flag until server-side SDKs can evaluate these operators locally; on SDK versions without support, flags using them fall back to remote evaluation.This adds local evaluation support for the four operators, mirroring
icontains: both sides are stringified and lowercased, and thenot_variants are exact negations. Filter values are single strings — server-side validation rejects list values for these operators, matching the flags service behavior.💚 How did you test it?
New unit tests mirror the flags service's own test matrix for these operators: case-insensitive anchored matching, mid-string non-matches (
prevaluedoes not matchstarts_with: "Val"), numeric stringification (323matchesstarts_with: "3",123does not), negation inverses, and missing-key inconclusive behavior.bundle exec rspec spec/posthog/feature_flag_spec.rbpasses locally (106 examples), andbundle exec rubocopreports no offenses on the changed files.📝 Checklist
If releasing new changes
posthog-rubypackage)🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with PostHog Code as part of rolling out local evaluation for these operators across all server-side SDKs. The implementation deliberately mirrors the existing
icontainsbranch in this repo (same string coercion and case folding) and the reference behavior in the Rust flags service (rust/feature-flags/src/properties/property_matching.rsin PostHog/posthog). The changeset file was written by hand following the repo's existing format.Created with PostHog Code