Skip to content

#2296: Refactor ToolCommandlet to determine InstalledEdition and Version in a Single Cached Lookup - #2306

Open
krystynaShatkovska wants to merge 9 commits into
devonfw:mainfrom
krystynaShatkovska:feature/issue-2296
Open

#2296: Refactor ToolCommandlet to determine InstalledEdition and Version in a Single Cached Lookup#2306
krystynaShatkovska wants to merge 9 commits into
devonfw:mainfrom
krystynaShatkovska:feature/issue-2296

Conversation

@krystynaShatkovska

@krystynaShatkovska krystynaShatkovska commented Aug 11, 2026

Copy link
Copy Markdown

Implemented changes:

This PR refactors the way IDEasy determines the installed edition and version of tools. Previously, getInstalledEdition() and getInstalledVersion() were separate methods
that often performed redundant expensive lookups (registry queries, process execution, etc.). The new combined approach computes both values in a single call.

  • Introduced the record EditionAndVersion(String edition, VersionIdentifier version) to hold both values together
  • Added getInstalledEditionAndVersion() with CachedValue to ToolCommandlet — delegates to computeInstalledEditionAndVersion()
  • Made getInstalledVersion() and getInstalledEdition() final — they now delegate to the combined method
  • Implemented computeInstalledEditionAndVersion() in LocalToolCommandlet (resolves edition + version via software link target)
  • GlobalToolCommandlet: getWindowsRegistryAppNames() returns Map<String, String> mapping edition → registry app name
  • Docker: returns Map.of(\"docker\", \"Docker Desktop\", \"rancher\", \"Rancher Desktop\") — enabling correct detection of Rancher Desktop edition
  • Implemented computeInstalledEditionAndVersion() in LocalToolCommandlet (resolves edition + version via software link target)
  • GlobalToolCommandlet: getWindowsRegistryAppNames() returns Map<String, String> mapping edition → registry app name
  • Docker: returns Map.of(\"docker\", \"Docker Desktop\", \"rancher\", \"Rancher Desktop\") — enabling correct detection of Rancher Desktop edition
  • Updated all relevant subclasses (IdeasyCommandlet, KubeCtl, DelegatingToolCommandlet, PackageManagerBasedLocalToolCommandlet, NodeBasedCommandlet)
  • Added cache invalidation after installation via invalidateInstalledEditionAndVersion()
  • Fixed pre-existing GUI compilation issue (IdeContext.findProjects was package-private instead of public)

Backward compatibility is maintained via deprecated hooks (computeInstalledEdition(), computeInstalledVersion(), getInstalledVersionDeprecated(),
getInstalledEditionDeprecated()).


Testing instructions

  1. Run `mvn clean test` — all 901 tests (CLI: 845, GUI: 56) pass with BUILD SUCCESS
  2. Test Docker edition detection: install Rancher Desktop and run `ideasy docker info` — should correctly report edition as "rancher" instead of "docker"
  3. Test global tool detection on Windows: run `ideasy docker install` and verify the registry lookup correctly identifies the installed edition

Checklist for this PR

  • When running `mvn clean test` locally all tests pass and build is successful
  • PR title is of the form `#«issue-id»: «brief summary»`
  • 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
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc
  • You have not changed any dependency in `pom.xml` files
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"" 2>&1

- Remove setController() to avoid conflict with fx:controller in FXML
- Add initialized flag to MainController.initialize() to run only once
  across all 3 FXML files (main-view, navigation, status-bar)
- All 56 GUI tests pass

Co-Authored-By: Capgemini Sovereign AI Platform
- Introduce EditionAndVersion record combining edition and version
- Add getInstalledEditionAndVersion() with CachedValue to ToolCommandlet
- Make getInstalledVersion()/getInstalledEdition() final, delegating to combined method
- Implement computeInstalledEditionAndVersion() in LocalToolCommandlet
- GlobalToolCommandlet: getWindowsRegistryAppNames() returns Map<String, String>
- Docker: support docker/rancher editions via registry app name mapping
- Update all subclasses (IdeasyCommandlet, KubeCtl, DelegatingToolCommandlet, etc.)
- Add cache invalidation after installation
- Fix pre-existing GUI compilation issue (IdeContext.findProjects visibility)
@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Aug 11, 2026
@krystynaShatkovska krystynaShatkovska self-assigned this Aug 11, 2026
@krystynaShatkovska krystynaShatkovska added enhancement New feature or request core FileAccess, ProcessUtil, IdeContext, etc. ready-to-implement labels Aug 11, 2026
@krystynaShatkovska krystynaShatkovska moved this from 🆕 New to Team Review in IDEasy board Aug 11, 2026
@krystynaShatkovska krystynaShatkovska changed the title Feature/issue 2296 #2296: Refactor ToolCommandlet to determine InstalledEdition and Version in a Single Cached Lookup Aug 11, 2026
@laert-ll laert-ll self-assigned this Aug 11, 2026
@krystynaShatkovska

Copy link
Copy Markdown
Author

@laert-ll i have tested locally and both ReleaseCommandletTest and BuildCommandletTest pass with BUILD SUCCESS. your refactoring is clean and ReleaseCommandlet now properly supports any BuildTool instead of being hardcoded to Maven. Good job.

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 31581158018

Coverage increased (+0.05%) to 72.945%

Details

  • Coverage increased (+0.05%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 242 coverage regressions across 10 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

242 previously-covered lines in 10 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/tool/IdeasyCommandlet.java 71 75.04%
com/devonfw/tools/ide/tool/ToolCommandlet.java 65 74.87%
com/devonfw/tools/ide/tool/GlobalToolCommandlet.java 31 11.97%
com/devonfw/ide/gui/MainController.java 30 67.21%
com/devonfw/tools/ide/tool/docker/Docker.java 29 6.58%
com/devonfw/tools/ide/tool/kubectl/KubeCtl.java 5 17.65%
com/devonfw/ide/gui/App.java 4 0.0%
com/devonfw/tools/ide/tool/PackageManagerBasedLocalToolCommandlet.java 3 90.7%
com/devonfw/tools/ide/tool/DelegatingToolCommandlet.java 2 16.67%
com/devonfw/tools/ide/tool/node/NodeBasedCommandlet.java 2 83.33%

Coverage Stats

Coverage Status
Relevant Lines: 17572
Covered Lines: 13365
Line Coverage: 76.06%
Relevant Branches: 7773
Covered Branches: 5123
Branch Coverage: 65.91%
Branches in Coverage %: Yes
Coverage Strength: 3.23 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core FileAccess, ProcessUtil, IdeContext, etc. enhancement New feature or request ready-to-implement

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

3 participants