fix(version-checker): Use latest semantic version #18085
Merged
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.
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
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