8000 Let me compare string properties via greater than/less than, in feature flag conditions and people filters · Issue #24771 · PostHog/posthog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Let me compare string properties via greater than/less than, in feature flag conditions and people filters #24771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aseemk opened this issue Sep 4, 2024 · 5 comments
Labels
enhancement New feature or request feature/feature-flags Feature Tag: Feature flags mobile team/feature-flags

Comments

@a
8000
seemk
Copy link
aseemk commented Sep 4, 2024

Feature request

Is your feature request related to a problem?

Our server tracks the last app version it has seen for each user, so we also send this property to PostHog as a person property. And we thought that's great, we can now use this property in feature flag rules (release conditions) while still retaining local evaluation benefits.

However, our app version is (like for many apps) a string property, since it consists of multiple parts (major/minor/patch, like typical semvers). E.g. 1.2.3.

Unfortunately — this baffled us and we thought we were crazy at first, that we must be missing this somewhere — we don't see any way to filter string properties by <, <=, >, or >= — only by equality, contains, and regex. Why is this? Could these standard string comparison operators be added?

Screenshot 2024-09-03 at 8 37 31 PM

Screenshot 2024-09-03 at 8 38 37 PM

Describe the solution you'd like

Would love to be able to set simple rules & filters like lastAppVersion >= '1.2.3' or lastAppVersion < '1.2.3'.

Describe alternatives you've considered

We're currently now resorting to a crazy manual & brittle workaround of sending additional person properties to PostHog of the version components: lastAppVersionMajor, lastAppVersionMinor, and lastAppVersionPatch.

And then we're creating this frankenstein of a ruleset:

Screenshot 2024-09-03 at 8 37 52 PM

(This is even more annoying because numeric properties can only be filtered by > and <, not >= or <=. So what we really meant to say here is: lastAppVersion >= '24.32.1', but had to write it as this.)

This is super brittle though — it'll literally stop working whenever we bump either our major version (e.g. to 25.0.0) or minor version (e.g. to 24.33.0) next.

Additional context

Please help us! We're really wishing this were better, and would love to not have a ticking time bomb in our feature flags that we forget next major or minor bump. Thank you so much.

Debug info

Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/0191bb17-062e-75e1-b1ad-900bd76ab1b2?t=1318
Admin: http://go/adminOrgUS/018d351a-9ff7-0000-eaff-4628875ad045 (project ID 50689)
Sentry: http://go/sentryUS/50689
@dfed
Copy link
dfed commented Sep 4, 2024

I've tried utilizing regular expressions to match versions, but that is arguably more brittle and significantly more difficult to create than the above options.

We have effectively set properties on users based on their app version now to avoid deploying features based on app version, but this requires more foresight and coordination between frontend/backend than we should need here.

Having this feature would have easily saved us a few hours a month. I'm sure we're not the only ones!

@audreyanngoing
Copy link
audreyanngoing commented Oct 3, 2024

We are also experiencing this issue and have resorted to temporary solutions requiring maintenance with inclusion lists, exclusion lists, and regex. +1 to string comparison that covers standard semantic versioning.

@reddavis
Copy link

+1 We're also coming across this issue.

@haacked
Copy link
Contributor
haacked commented Mar 5, 2025

Hi @aseemk, I'm not sure that < and > string comparison would solve your scenario. It looks like you want to be able to compare versions. Versions don't sort lexicographically. For example, let's look at these two versions: 1.10.0 and 1.2.0

String sorting would put: 1.10.0 < 1.2.0
Version sorting would put: 1.2.0 < 1.10.0 #This is correct

I'll talk with the team and see if there's support for this idea.

@aseemk
Copy link
Author
aseemk commented Apr 23, 2025

Yes @haacked you're of course totally right. (Not sure how we totally forgot about that case originally.) Happy to close this issue out in favor of #24485 to actually handle semvers directly and correctly.

@aseemk aseemk closed this as completed Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature/feature-flags Feature Tag: Feature flags mobile team/feature-flags
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
0