Repository navigation
feat(config): make baseline the default path.mode - #738
Open
linghengqian wants to merge 2 commits into
Open
linghengqian wants to merge 2 commits into
linghengqian wants to merge 2 commits into
Conversation
`legacy` keeps every PATH entry in front of vfox's first directory in front of it, so a system directory that macOS path_helper or the Windows machine PATH put there keeps winning over the version `vfox use` selected (version-fox#337, version-fox#732). `baseline` fixes that by moving what was already in PATH when `vfox activate` ran behind vfox's directories, but everyone had to opt in with `vfox config path.mode baseline`. It is the default now; `vfox config path.mode legacy` brings back the behavior of 1.0.x. - config.DefaultPathMode names the default in one place. EmptyPath, both fallbacks of Path.EffectiveMode and the starting mode of pathPolicy() use it. - An empty or unknown mode is the default, as before, so a typo lands on baseline instead of failing `vfox env`, which runs at every prompt. EffectiveMode names `legacy` as a case of its own now, because it is no longer what the fallback returns. - A shell without a recorded baseline still behaves like legacy in every mode, so upgrading does not reorder the PATH of a running shell. - The path.shadowed hint for a directory that was already in PATH at activation can only come up in legacy mode now. It says so before it suggests `vfox config path.mode baseline`. Tests: the eleven that asserted the old default are updated. Tests that used `baseline` as the value that has to survive a merge, a save or a shared config would have passed for the wrong reason once it became the default, so they use `legacy`. New checks pin the default and its fallbacks, and that an unconfigured vfox leaves the PATH of a shell without a baseline alone. Part of version-fox#737
Quick Start and both READMEs no longer ask new installations to run `vfox config path.mode baseline`, and the configuration guide, the FAQ and AGENTS.md stop announcing that the default will change. Quick Start and the READMEs read as they did before version-fox#736 added that step. - Configuration guide (en, zh-hans): the section described what `legacy` does as the general behavior. It now says that `baseline` is the default, what `legacy` is, and how to keep the behavior of vfox 1.0.x: `vfox config path.mode legacy`, or `path.preserve` when only a few directories have to stay in front. - FAQ (en, zh-hans): a system JDK or a Homebrew node in front of vfox's directories no longer wins by default. It lists what still can (pnpm and anything added after `vfox activate`) and what to check when `vfox doctor` still names a system directory: a shell that was started before the upgrade, `legacy`, or `path.preserve`. - AGENTS.md: where the default is defined and what has to stay in step. Part of version-fox#737
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #738 +/- ##
=======================================
Coverage 51.39% 51.39%
=======================================
Files 111 111
Lines 8240 8240
=======================================
Hits 4235 4235
Misses 3583 3583
Partials 422 422 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
linghengqian
commented
Oct 23, 2026
linghengqian
left a comment
Member
Author
There was a problem hiding this comment.
CC @aooohan . Could you please take a look and review this?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #737 (item 3, "Change the default of
path.modetobaseline").What changes
path.modedefaults tobaseline. The default waslegacy, which keeps everyPATHentry in front of vfox's first directory in front of it, so a system directory that macOSpath_helperor the Windows machinePATHput there kept winning over the versionvfox useselected (#337, #732).baselinemoves what was already inPATHwhenvfox activateran behind vfox's directories, and keeps what is added afterwards (a virtualenv, the$PNPM_HOMEofpnpm setup) in front. The way back is one line:vfox config path.mode legacy.Checked with real binaries, built from
mainand from this branch. The shell'sPATHis<system dir with alphatool>:<vfox sdks dir>:/usr/bin:/binwhenvfox activate bashruns, which is the shape behind #337 and #732:alphatoolrunsPATHstarts withmain(defaultlegacy)vfox config path.mode legacypath.preservelisting the system dirCode
config.DefaultPathModenames the default in one place.EmptyPath, both fallbacks ofPath.EffectiveModeand the starting mode ofpathPolicy()use it: the four places listed in Follow-ups of #736: plugin updates, the path.mode default and vfox config #737.vfox env, which runs at every prompt.EffectiveModehas to namelegacyas a case of its own now. Flipping only the fallbacks would turnmode: legacyintobaseline. I removed the case to see: 12 tests in all four packages fail.legacyin every mode, so upgrading does not reorder thePATHof a shell that is already running. It gets the new default when it is restarted.TestEnvWithoutABaselineBehavesLikeLegacyInEveryModecovers the unconfigured case too.path.shadowedhint for a directory that was already inPATHat activation said to runvfox config path.mode baseline. That finding can only come up inlegacymode now (baselinemoves such a directory behind vfox's, and without a recorded baseline the source is "unknown"), so the hint says that first. The other two hints are still right and unchanged.Tests
The eleven tests that the flip breaks, as counted in #737, are updated: 4 in
cmd/commands, 4 ininternal/config, 2 ininternal/env, 1 ininternal/sdk.Five more kept passing for the wrong reason. They used
baselineas the value that has to survive a merge, a save, the first run with a sharedVFOX_HOMEor an alias change; once it is the default, losing it would not show. They uselegacynow:TestMergePath,TestPathRoundTripThroughYAML,TestSharedSettingsApplyOverANewUserConfigFile,TestAFreshUserFollowsTheSharedConfig,TestAliasChangesLeaveTheRestOfTheUserConfigAlone.New:
TestDefaultPathModeIsBaseline, and the unconfigured andlegacycases in the activate, env and use tests. Breaking the implementation four ways (nolegacycase,pathPolicy()starting fromlegacy, unknown values falling back tolegacy,EmptyPathstayinglegacy) fails tests each time.Docs
English and zh-hans. Quick Start and both READMEs lose the "set baseline" step and the announcement; they are identical to v1.0.13 again. The configuration guide described what
legacydoes as the general behavior; it now describes the default, and says how to keep the 1.0.x behavior (vfox config path.mode legacy, orpath.preservewhen a few directories have to stay in front). The FAQ says what can still win (pnpm, anything added aftervfox activate) and what to check whenvfox doctorstill names a system directory (a shell started before the upgrade,legacy,path.preserve).AGENTS.mdsays where the default lives.Not in this PR
vfox doctornotice. No release containspath.modeyet (v1.0.13 is the latest,mainis three commits ahead), so the first release that has the setting can ship withbaseline; there is no earlier release to warn in. If you would rather shippath.modewithlegacyfirst and flip one release later, this PR can wait for that release.vfox use java@Xdoesn't changejavawhen a JDK is in the system PATH and a global SDK is set #732 stay open until a release contains this.vfox config --unset path.modestill writes the default into the file instead of removing the key (Follow-ups of #736: plugin updates, the path.mode default and vfox config #737, item 4).Draft for the release notes
Verification
go teston all packages exceptinternal/shared/printer(it needs a TTY), run on the exported tree ofHEAD: pass.go veton Linux,GOOS=windowsandGOOS=darwin: clean. The docs site builds (VitePress, no dead links; the new callouts render in both languages).On Windows most tests that exercise the
PATHorder skip, as before (they use POSIX paths, and the CLI fixture skips there, #737 item 5). Theinternal/configtests, which pin the default and its fallbacks, run there.CI on my fork for the head commit (3703b90) is green:
VersionFox CI(ubuntu, macOS, Windows, the Windows regressions, Fish) andvfox E2E Test(Unix, macOS, Windows, MSIX packaging): CI, E2E.