Skip to content

fix: check needsUpdate flag before showing update available warning#150

Open
ss251 wants to merge 2 commits intosolana-foundation:masterfrom
ss251:fix/check-needs-update-flag
Open

fix: check needsUpdate flag before showing update available warning#150
ss251 wants to merge 2 commits intosolana-foundation:masterfrom
ss251:fix/check-needs-update-flag

Conversation

@ss251
Copy link

@ss251 ss251 commented Jan 18, 2026

Problem

The install command shows "update available" warnings even when a tool is already at the latest version. This happens because the code checks if (updateAvailable) (whether the object exists) instead of if (updateAvailable?.needsUpdate) (whether an update is actually needed).

Summary of Changes

Changed all occurrences of if (updateAvailable) to if (updateAvailable?.needsUpdate) in the following functions:

  • installAnchorVersionManager
  • installAnchorUsingAvm
  • installTrident
  • installZest
  • installSolanaVerify
- if (updateAvailable) {
+ if (updateAvailable?.needsUpdate) {

Related PR

This PR works in conjunction with #147 which fixes version parsing.

The bug scenario (both issues combined):

  1. User has solana-verify 0.4.11 installed
  2. Regex bug (fix: use greedy regex for version parsing #147) causes mucho to display it as 0.4.1
  3. cargo install-update correctly knows it's 0.4.11 and reports needsUpdate: No
  4. But mucho ignores needsUpdate: No and shows warning anyway (this PR's fix)

Result: solana-verify 0.4.1 is already installed - v0.4.11 available

Testing this PR alone (user has 0.4.11 installed):

With both PRs merged:

  • solana-verify 0.4.11 is already installed (correct version + no false warning)

Note: If someone actually has 0.4.1 installed, cargo install-update reports needsUpdate: Yes, and the warning would correctly appear.

Fixes #149

ss251 added 2 commits January 18, 2026 19:16
The code was checking if the updateAvailable object exists rather than
checking if updateAvailable.needsUpdate is true. This caused false
"update available" warnings even when tools were already at the latest
version.

Changed all occurrences of `if (updateAvailable)` to
`if (updateAvailable?.needsUpdate)` in the following functions:
- installAnchorVersionManager
- installAnchorUsingAvm
- installTrident
- installZest
- installSolanaVerify
@changeset-bot
Copy link

changeset-bot bot commented Jan 18, 2026

🦋 Changeset detected

Latest commit: cd25c2d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mucho Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

False 'update available' warnings when tool is already at latest version

1 participant