Skip to content

Fix false positive update alert when local version is newer - #910

Closed
henriquegeremia wants to merge 2 commits into
royshil:mainfrom
henriquegeremia:fix/update-checker-logic
Closed

Fix false positive update alert when local version is newer#910
henriquegeremia wants to merge 2 commits into
royshil:mainfrom
henriquegeremia:fix/update-checker-logic

Conversation

@henriquegeremia

@henriquegeremia henriquegeremia commented Jun 27, 2026

Copy link
Copy Markdown

Description

This PR fixes a bug where the plugin incorrectly alerts the user that an update is available when the locally installed version is actually newer than the latest version fetched from the GitHub API.

Currently, users running a newer local version (e.g., 1.4.0) are prompted with 🚀 Update available! (1.3.7) because the update checking logic in update-checker.cpp only checks for strict equality (info.version == PLUGIN_VERSION). If the versions do not match, it assumes a new update is available.

Solution

  1. Introduced a semantic version comparison helper is_newer_version that splits both the remote and local version strings by . and compares the integer components sequentially.
  2. Updated the comparison inside the callback of check_update to only set latestVersionForUpdate if the fetched remote version is strictly newer than the currently installed PLUGIN_VERSION.

Pull Request Checklist

Please read our latest CONTRIBUTING.md.

  • I have read the latest CONTRIBUTING.md.
  • I have acknowledged the licensing and patent grant policy.
  • I have included the required license headers.
  • I am confident with my code integrity.
  • I have signed off and verified all my commits.

@umireon

umireon commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Nice catch!

@umireon umireon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You can use regex. This part is run only once and regex is preferred to stringstream.

@henriquegeremia

Copy link
Copy Markdown
Author

Done! I've updated the implementation to use std::regex instead of std::stringstream. Thanks for the feedback!

@umireon umireon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please use the following regex:

^(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z]+)(?:\.?(\d+))?)?$

Simply ignore the 4th and 5th component.
And please make this PR ready.

@umireon

umireon commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

You are required to check the Pull Request checklist I've added. Do not remove template.

@henriquegeremia
henriquegeremia force-pushed the fix/update-checker-logic branch from 50d4a28 to 2f1267a Compare June 28, 2026 18:12
@henriquegeremia
henriquegeremia marked this pull request as ready for review June 28, 2026 18:12
@henriquegeremia

Copy link
Copy Markdown
Author

Done! I've updated the regex to match the exact pattern you suggested, restored the PR checklist template, and marked the PR as ready for review.

@umireon umireon added the validate Triggers validation label Jul 6, 2026
@umireon

umireon commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

@umireon

umireon commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Stalled. Closing.

@umireon umireon closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validate Triggers validation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants