Skip to content

fix: trim first letter to fix version check - #491

Merged
Mzack9999 merged 3 commits into
projectdiscovery:mainfrom
Mapioe:fix-version-check
Oct 23, 2026
Merged

Mzack9999 merged 3 commits into
projectdiscovery:mainfrom
Mapioe:fix-version-check

Conversation

@Mapioe

@Mapioe Mapioe commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #513

When using vulnx version it suggests user to update because Version = "v2.0.2" while latestVersion = "2.0.2"

Fixed:

vulnx  ❯ git:(fix-version-check) ./vulnx --silent version
[INF] Current vulnx version v2.0.2 (latest)

Not Fixed:

vulnx  ❯ git:(fix-version-check) ./vulnx --silent version
[INF] Current vulnx version v2.0.2 (latest)
[INF] To update vulnx, use:
[INF] vulnx --update  or  vulnx update
[INF] Or install via pdtm: pdtm -u vulnx

Summary by CodeRabbit

  • Bug Fixes
    • Improved version update detection so equivalent version numbers are treated consistently, whether or not they include a leading “v.”
    • Update instructions are now shown when a newer release is available, and are not shown when the installed version matches or is newer.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 85ca5a5a-fd7c-4b1c-bf7a-20495375221c
📥 Commits

Reviewing files that changed from the base of the PR and between 99601c7 and 82dca50.

📒 Files selected for processing: 2
  • cmd/vulnx/clis/version.go
  • cmd/vulnx/clis/version_test.go

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The update check now removes a leading v from the current version before comparing it with the latest version.

Changes

Version comparison

Layer / File(s) Summary
Normalize current version
cmd/vulnx/clis/version.go
The CLI imports strings and strips the leading v from Version before checking for an available update.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: ehsandeep

Merge Risk: ⚪ Minimal · up to 82dca

No merge-blocking issue is identified for the version update hint.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the version comparison fix. It matches the pull request objective and the changes to update detection.
Linked Issues check Passed Issue #513 requires the update hint to use the same version comparison as the latest/outdated label. showVersion now calls shouldSuggestUpdate, which delegates to updateutils.IsOutdated. The add…
Out of Scope Changes check Passed The pull request changes only version-update decision logic and adds focused tests for that logic. Both changes support issue #513. No unrelated changes are present in the reviewed diff.
Full details: Linked Issues check

Explanation

Issue #513 requires the update hint to use the same version comparison as the latest/outdated label. showVersion now calls shouldSuggestUpdate, which delegates to updateutils.IsOutdated. The added table-driven test covers v2.0.2 versus 2.0.2 and newer or older releases.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

A rabbit checks the version line
And trims the v to make it shine
Latest news hops into view
The update check now matches true
Carrots celebrate the fix 🥕

Comment @coderabbitai help to get the list of available commands.

@Mzack9999
Mzack9999 merged commit 068e632 into projectdiscovery:main Oct 23, 2026
7 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.

version command asks for an update when already current

2 participants