Skip to content

#1886: fix npm based commandlet shows wrong tool version#1900

Open
AdemZarrouki wants to merge 13 commits into
devonfw:mainfrom
AdemZarrouki:feature/1886-fix-NpmBasedCommandlet-shows-wrong-tool-version
Open

#1886: fix npm based commandlet shows wrong tool version#1900
AdemZarrouki wants to merge 13 commits into
devonfw:mainfrom
AdemZarrouki:feature/1886-fix-NpmBasedCommandlet-shows-wrong-tool-version

Conversation

@AdemZarrouki
Copy link
Copy Markdown
Contributor

@AdemZarrouki AdemZarrouki commented May 7, 2026

This PR fixes #1886

Implemented changes:

  • Override getInstalledVersion in NpmBasedCommandlet to ignore the toolPath parameter and use npm package manager to detect the actual installed version of the tool.

Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board May 7, 2026
@AdemZarrouki AdemZarrouki self-assigned this May 7, 2026
@AdemZarrouki AdemZarrouki marked this pull request as ready for review May 7, 2026 10:44
@AdemZarrouki AdemZarrouki moved this from 🆕 New to Team Review in IDEasy board May 7, 2026
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 7, 2026

Coverage Report for CI Build 26214647811

Coverage increased (+0.02%) to 70.972%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 1 coverage regression across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/version/VersionSegment.java 1 89.24%

Coverage Stats

Coverage Status
Relevant Lines: 15517
Covered Lines: 11489
Line Coverage: 74.04%
Relevant Branches: 6934
Covered Branches: 4445
Branch Coverage: 64.1%
Branches in Coverage %: Yes
Coverage Strength: 3.13 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@areinicke areinicke left a comment

Choose a reason for hiding this comment

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

I have confirmed it works and the few lines of code you added look good. Nice job!

@areinicke areinicke self-assigned this May 7, 2026
@AdemZarrouki AdemZarrouki moved this from Team Review to 👀 In review in IDEasy board May 8, 2026
@AdemZarrouki AdemZarrouki requested a review from hohwille May 8, 2026 10:29
Copy link
Copy Markdown
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@AdemZarrouki thanks for your PR. Great that you figured out why we have this bug 👍
I left a comment for a better place to fix it so it will not only be fixed for npm based tools but also for pip based tools.

Comment on lines +61 to +62
protected VersionIdentifier getInstalledVersion(Path toolPath) {
return computeInstalledVersion();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

great finding. You traced down the bug.
However, a better or more proper fix would be to override this method in PackageManagerBasedLocalToolCommandlet that only overrides the method without the argument:

public VersionIdentifier getInstalledVersion() {
return this.installedVersion.get();
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review @hohwille.
Yes your comment makes sense as i wasn't aware that the bug is also in pip based commandlets.

@hohwille hohwille added this to the release:2026.05.001 milestone May 19, 2026
@hohwille hohwille changed the title #1886 fix npm based commandlet shows wrong tool version #1886: fix npm based commandlet shows wrong tool version May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

NpmBasedCommandlet shows wrong tool version after install

4 participants