Skip to content

fix(env): unset session override when vp env use called without arguments#960

Merged
fengmk2 merged 3 commits intovoidzero-dev:mainfrom
JasonOA888:fix/env-use-unset-override
Mar 17, 2026
Merged

fix(env): unset session override when vp env use called without arguments#960
fengmk2 merged 3 commits intovoidzero-dev:mainfrom
JasonOA888:fix/env-use-unset-override

Conversation

@JasonOA888
Copy link
Contributor

Fixes #951

When vp env use is called without a version argument, it should revert to file-based Node.js version resolution instead of keeping the session override from VITE_PLUS_NODE_VERSION env var or session file.

Changes:

  • Add resolve_version_from_files() to resolve version skipping session overrides
  • Update vp env use to unset session override before resolving when no arg provided
  • This allows users to temporarily override with vp env use 22 and revert with vp env use

@netlify
Copy link

netlify bot commented Mar 16, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 464c13e
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69b8cfad2299cf000895eab0

@fengmk2
Copy link
Member

fengmk2 commented Mar 16, 2026

Can you refer to the current unit tests or snap tests in the project and add test cases corresponding to this change?

@JasonOA888
Copy link
Contributor Author

Good call! I've added unit tests following the existing test patterns in config.rs:

  • test_resolve_version_from_files_ignores_env_var - verifies env var override is skipped
  • test_resolve_version_from_files_ignores_session_file - verifies session file override is skipped
  • test_resolve_version_still_respects_overrides - verifies existing resolve_version behavior is unchanged

Commit: 1c84e2e

@fengmk2
Copy link
Member

fengmk2 commented Mar 16, 2026

Please fix CI fails.

@JasonOA888
Copy link
Contributor Author

Hi @fengmk2, I see the CI is failing. I checked the logs and it looks like there are issues in cargo check and cargo shear. However, the code compiles fine locally.

Could you help me understand the specific errors? The GitHub Actions UI shows failures but I cannot access the detailed logs directly.

Copy link
Member

@fengmk2 fengmk2 left a comment

Choose a reason for hiding this comment

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

@JasonOA888 I will take over to fix the remaining issues and merge after manual testing. Thank you for the contribution!

@fengmk2

This comment was marked as outdated.

@fengmk2
Copy link
Member

fengmk2 commented Mar 17, 2026

signed commits required is disable, will merge after ci pass.

…uments

Fixes voidzero-dev#951

When `vp env use` is called without a version argument, it should revert
to file-based Node.js version resolution instead of keeping the session
override from `VITE_PLUS_NODE_VERSION` env var or session file.

Changes:
- Add `resolve_version_from_files()` to resolve version skipping session overrides
- Update `vp env use` to unset session override before resolving when no arg provided
- This allows users to temporarily override with `vp env use 22` and revert with `vp env use`

Signed-off-by: JasonOA888 <101583541+JasonOA888@users.noreply.github.com>
Add unit tests to verify that resolve_version_from_files correctly
ignores session overrides (env var and session file) while
resolve_version still respects them.

Signed-off-by: JasonOA888 <101583541+JasonOA888@users.noreply.github.com>
Signed-off-by: JasonOA888 <101583541+JasonOA888@users.noreply.github.com>
@JasonOA888 JasonOA888 force-pushed the fix/env-use-unset-override branch from e5c4e9d to 464c13e Compare March 17, 2026 03:51
@fengmk2 fengmk2 merged commit 6c4b979 into voidzero-dev:main Mar 17, 2026
22 checks passed
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.

vp env use without arguments does not unset VITE_PLUS_NODE_VERSION

2 participants