Skip to content

fix: align current output and uninstall version spelling - #744

Merged
linghengqian merged 1 commit into
version-fox:mainfrom
mvanhorn:fix/390-current-uninstall-version-consistency
Nov 2, 2026
Merged

linghengqian merged 1 commit into
version-fox:mainfrom
mvanhorn:fix/390-current-uninstall-version-consistency

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Background

Copying a version from vfox current into vfox uninstall can report that it is not installed. current also displays an extra v compared with list and search. vfox info has the same problem as uninstall: vfox info [email protected]+13 prints notfound for an installed 21.0.2+13.

current prepends v to the stored version name in both output forms. uninstall and info resolve aliases without using the version-name resolver that handles a conventional leading v.

Summary of the fix

current now prints the stored name unchanged. uninstall and info use ResolveVersionName to accept prefixed versions while preserving exact aliases and installed names that begin with v, and info --json reports the name without the v. Regression tests cover both current output forms, prefixed and as-typed names for uninstall and info, alias cleanup, linked targets, and unknown versions.

Verification

On macOS with Go 1.26.5:

  • gofmt -l on the changed Go files reported no formatting differences.
  • go vet ./cmd/commands/... ./internal/... completed without diagnostics.
  • go build ./... passed.
  • go test ./cmd/commands/... passed.
  • TestCurrentPrintsVersionAsStored, TestUninstallAcceptsConventionalVersionPrefix and TestInfoAcceptsConventionalVersionPrefix fail with current.go, uninstall.go and info.go from main, and pass with this change.

The CLI tests are skipped on Windows, and I have not tried this on Windows.

Fixes #390

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.87%. Comparing base (4766d24) to head (1785400).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #744      +/-   ##
==========================================
+ Coverage   51.60%   51.87%   +0.26%     
==========================================
  Files         111      111              
  Lines        8276     8276              
==========================================
+ Hits         4271     4293      +22     
+ Misses       3585     3561      -24     
- Partials      420      422       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@linghengqian linghengqian left a comment

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.

Thanks. This is the right fix for #390: current adds a v and uninstall doesn't accept one, and this changes both. The new tests fail on main and pass here. info has the same problem, see 7.

A few things to sort out before I merge:

  1. Three comments still say vfox current prints a leading v, which isn't true anymore: cmd/commands/alias.go:72, cmd/commands/alias_cli_test.go:38 and cmd/commands/commands_unit_test.go:58. We still accept the v, so only the wording needs to change.
  2. AGENTS.md:80 lists the commands where ResolveVersionName decides what to do with a leading v. uninstall and info (see 7) belong in that list now.
  3. The commit message has both Fixes #390 and Refs #390, and the description only has Refs. Please use Fixes #390 in both places and drop the Refs line. The graal part of that issue was fixed in vfox-java 0.6.3, so nothing is left open after this.
  4. In the description, go test ./internal/sdk -v doesn't cover anything this PR touches, and "the vfox currentCmd change" in two of the bullets doesn't match the diff, which changes more than current. Please cut it down to what you ran for this change.
  5. The new CLI tests are skipped on Windows (the fixture needs a POSIX shell), and #390 was reported on Windows. If you tried vfox un java@v... there, say so. If not, no problem, I'll check it myself.
  6. The release notes are built from commit titles, and this title doesn't say what users will notice. Something like fix: drop the leading v from vfox current, accept it in vfox uninstall and vfox info would.
  7. vfox info [email protected]+13 has the same problem as uninstall: it prints notfound for an installed 21.0.2+13 (exit code 0, and "installed": false with --json), while use, install, exec and doctor take the v. I'd rather fix it here than in a follow-up. info calls ResolveAlias at cmd/commands/info.go:188, and switching that to ResolveVersionName, like uninstall now does, should be enough. Please add a test to cmd/commands/info_cli_test.go for the v spelling, plus the as-typed cases you already have for uninstall (an installed v1.0.0, a linked vendor, an alias v1). --json should report the name without the v, the way it does for aliases.

Otherwise good to go.

…l and vfox info

`current` now prints the stored name unchanged. `uninstall` and `info`
use `ResolveVersionName`, so they accept a prefixed version while keeping
exact aliases and installed names that begin with `v`. `info --json`
reports the name without the `v`. Regression tests cover both current
output forms, prefixed and as-typed names for uninstall and info, alias
cleanup, linked targets, and unknown versions.

Fixes version-fox#390
@mvanhorn
mvanhorn force-pushed the fix/390-current-uninstall-version-consistency branch from b03f9f5 to 1785400 Compare November 2, 2026 13:35
@mvanhorn

mvanhorn commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. These are in 1785400, amended into the one commit so the message is clean.

  1. Reworded the three comments. The leading v is still accepted.
  2. Added uninstall and info to the ResolveVersionName list in AGENTS.md.
  3. The commit message and the description now only have Fixes #390.
  4. Cut the verification section down to what I ran on this head.
  5. I have not tried vfox un java@v... on Windows, so that one is yours to check.
  6. The commit title is now the one you suggested.
  7. info now uses ResolveVersionName. info_cli_test.go covers the v spelling plus the as-typed cases (an installed v1.0.0, a linked vendor, an alias v1), and --json reports the name without the v. The v spelling test fails with main's info.go and passes here.

Locally on macOS, gofmt -l, go vet ./cmd/commands/... ./internal/..., go build ./... and go test ./cmd/commands/... all came back clean. I haven't seen CI on this sha yet.

@linghengqian linghengqian added bug Something isn't working and removed need-more-info labels Nov 2, 2026
@linghengqian linghengqian added this to the 1.0.14 milestone Nov 2, 2026

@linghengqian linghengqian left a comment

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.

LGTM

@linghengqian
linghengqian merged commit cdf0747 into version-fox:main Nov 2, 2026
6 checks passed
@mvanhorn

mvanhorn commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Many thanks, @linghengqian. Copying a version straight from vfox current into uninstall or info should just work now.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: version of plugin inconsistency

2 participants