Skip to content

Fix double v prefix and version comparison in update banner#1615

Merged
aliasaria merged 3 commits intomainfrom
fix/version-banner-display
Mar 23, 2026
Merged

Fix double v prefix and version comparison in update banner#1615
aliasaria merged 3 commits intomainfrom
fix/version-banner-display

Conversation

@aliasaria
Copy link
Copy Markdown
Member

Summary

  • Strip existing "v" prefix from API version strings before displaying, preventing "vv0.30.3"
  • Add semver comparison (isNewerVersion) so the banner only appears when the latest version is actually newer than the current one

Test plan

  • Verify banner displays "v0.30.3" not "vv0.30.3"
  • Verify banner does not show when current version >= latest version
  • Verify banner still shows correctly when a genuine update is available

The version API response already includes the "v" prefix, causing "vv0.30.3"
in the display. Also adds semver comparison to ensure the banner only shows
when the latest version is actually newer than the current one.
@paragon-review
Copy link
Copy Markdown

Paragon Summary

This pull request review identified 2 issues across 1 category in 1 file. The review analyzed code changes, potential bugs, security vulnerabilities, performance issues, and code quality concerns using automated analysis tools.

This PR fixes a visual bug where the version update banner displayed a duplicated "v" prefix (e.g., "vv0.30.3") and adds proper semver comparison logic so the banner only appears when an actual newer version is available.

Key changes:

  • Strip "v" prefix from API version strings to prevent double-v display ("vv0.30.3")
  • Add semver comparison (isNewerVersion) to only show banner when update is genuinely newer
  • Modified VersionUpdateBanner.tsx component

Confidence score: 4/5

  • This PR has low-moderate risk with 2 medium-priority issues identified
  • Score reflects code quality concerns and maintainability issues
  • Consider addressing medium-priority findings to improve code quality

1 file reviewed, 2 comments

Severity breakdown: Medium: 2


Tip: @paragon-run <instructions> to chat with our agent or push fixes!

Dashboard

return version.startsWith('v') ? version.slice(1) : version;
}

function isNewerVersion(latest: string, current: string): boolean {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Version comparison breaks with pre-release tags

Version comparison breaks with pre-release tags. The .map(Number) produces NaN for non-numeric parts like beta. Filter out or handle non-numeric version segments.

View Details

Location: src/renderer/components/Shared/VersionUpdateBanner.tsx (lines 22)

Analysis

**Version comparison breaks with pre-release tags. The **

What fails isNewerVersion function produces NaN values when version strings contain non-numeric parts like 'beta', 'rc', 'alpha'
Result NaN comparisons always return false, so pre-release versions may be incorrectly compared or banner may not show when it should
Expected Pre-release versions should be handled gracefully, either by ignoring suffixes or treating them as older than the base version
Impact Users with pre-release builds may see incorrect update banner behavior
How to reproduce
Call isNewerVersion('v0.30.3-beta', 'v0.30.2') - the 'beta' becomes NaN and comparison fails
AI Fix Prompt
Fix this issue: Version comparison breaks with pre-release tags. The .`map`(Number) produces NaN for non-numeric parts like beta. Filter out or handle non-numeric version segments.

Location: src/renderer/components/Shared/VersionUpdateBanner.tsx (lines 22)
Problem: isNewerVersion function produces NaN values when version strings contain non-numeric parts like 'beta', 'rc', 'alpha'
Current behavior: NaN comparisons always return false, so pre-release versions may be incorrectly compared or banner may not show when it should
Expected: Pre-release versions should be handled gracefully, either by ignoring suffixes or treating them as older than the base version
Steps to reproduce: Call isNewerVersion('v0.30.3-beta', 'v0.30.2') - the 'beta' becomes NaN and comparison fails

Provide a code fix.


Tip: Reply with @paragon-run to automatically fix this issue


if (updateCheckDisabled) return null;
if (!data?.update_available) return null;
if (!data?.update_available || !data.latest_version) return null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: current_version is used without null check

current_version is used without null check. If API returns undefined current_version, isNewerVersion breaks. Add null check for data.current_version.

View Details

Location: src/renderer/components/Shared/VersionUpdateBanner.tsx (lines 48)

Analysis

current_version is used without null check. If API returns undefined current_version, isNewerVersion

What fails data.current_version is passed to isNewerVersion without checking if it exists, unlike the explicit check added for data.latest_version
Result isNewerVersion receives undefined/null, leading to 'undefined'.split('.') and incorrect comparisons
Expected Should return null early if current_version is missing, same pattern as latest_version check
Impact Could cause runtime errors or incorrect banner behavior if API returns incomplete data
How to reproduce
If API returns { update_available: true, latest_version: 'v0.31.0', current_version: null } or undefined current_version
Patch Details
-  if (!data?.update_available || !data.latest_version) return null;
+  if (!data?.update_available || !data.latest_version || !data.current_version) return null;
AI Fix Prompt
Fix this issue: current_version is used without null check. If API returns undefined current_version, isNewerVersion breaks. Add null check for data.current_version.

Location: src/renderer/components/Shared/VersionUpdateBanner.tsx (lines 48)
Problem: data.current_version is passed to isNewerVersion without checking if it exists, unlike the explicit check added for data.latest_version
Current behavior: isNewerVersion receives undefined/null, leading to 'undefined'.split('.') and incorrect comparisons
Expected: Should return null early if current_version is missing, same pattern as latest_version check
Steps to reproduce: If API returns { update_available: true, latest_version: 'v0.31.0', current_version: null } or undefined current_version

Provide a code fix.


Tip: Reply with @paragon-run to automatically fix this issue

@sentry
Copy link
Copy Markdown

sentry bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
api/transformerlab/services/version_service.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@aliasaria aliasaria merged commit 46dba44 into main Mar 23, 2026
11 of 12 checks passed
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.

2 participants