Skip to content
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

fix(version-checker): Use latest semantic version #18085

Merged
merged 3 commits into from
Oct 19, 2023
Merged

Conversation

neilkakkar
Copy link
Collaborator

@neilkakkar neilkakkar commented Oct 19, 2023

Problem

The version checker bugs out frequently, whenever, say a 2nd posthog instance running on localhost / old installation sends us events from an outdated library. This is much more common than we expected earlier.

Ex: see our instance

image

So, using the latest timestamp to get the latest used version doesn't work well.

Also, it's much worse to show this banner when they're on latest (further confusing them), than to not show this banner when they're not.

Now, instead, we use the highest semantic version. This means if they went to a higher version, then reverted, it will take upto 24 hours for us to reflect this change (when the higher version moves out of the last 24h date range). This has the advantage of not incorrectly showing the banner when they have multiple versions of posthog-js sending stuff.

Q: Why isn't this in the clickhouse query?
A: Because semantic version comparison is hard

Q: Does the current semVer comparison work in all cases?
A: No, not all, pretty sure there are edge cases with 'alpha' versions and the like, but for all regular numbers should be fine

Changes

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

How did you test this code?

unit tests

@neilkakkar neilkakkar marked this pull request as ready for review October 19, 2023 11:07
Copy link
Contributor

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great. Thanks for looking at this 👍

@neilkakkar neilkakkar merged commit b5c1ed6 into master Oct 19, 2023
77 checks passed
@neilkakkar neilkakkar deleted the version-checker branch October 19, 2023 15:00
@pauldambra
Copy link
Member

Oh, came here to see how you'd been clever enough to do this with HogQL, so disappointing 🤣

@neilkakkar
Copy link
Collaborator Author

there were enough exceptions that my naive split string by dot & compare array elements was not smarter than the entire world's knowledge inside localeCompare 😂

daibhin pushed a commit that referenced this pull request Oct 23, 2023
* fix(version-checker): Use latest semantic version

* elaborate

* more version nums for funsies
Justicea83 pushed a commit to Justicea83/posthog that referenced this pull request Oct 25, 2023
* fix(version-checker): Use latest semantic version

* elaborate

* more version nums for funsies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants