Skip to content

fix(env): regenerate all trampoline .exe files after upgrade#1369

Merged
fengmk2 merged 3 commits into
mainfrom
fix-trampoline-exe-regen
Apr 13, 2026
Merged

fix(env): regenerate all trampoline .exe files after upgrade#1369
fengmk2 merged 3 commits into
mainfrom
fix-trampoline-exe-regen

Conversation

@fengmk2

@fengmk2 fengmk2 commented Apr 13, 2026

Copy link
Copy Markdown
Member

During vp upgrade, only core shims (vp, node, npm, npx, vpx, vpr)
were refreshed. Package shims installed via vp install -g (e.g.,
corepack.exe, tsc.exe) kept stale trampoline binaries from the
previous version.

  • Add BinConfig::find_all_vp_source() to discover package shims
  • Add refresh_package_shims() to vp env setup --refresh (Windows)
  • Fix create_package_shim() to re-copy trampoline on re-install
    instead of returning early when .exe exists
  • Make rename_to_old pub(crate) for reuse in global_install

Closes #1349


Note

Medium Risk
Changes Windows shim generation/refresh and global package shim overwrite behavior, which can affect command resolution and upgrade stability. Scoped to Windows and mostly best-effort, but failures could leave incorrect or stale shims.

Overview
Ensures Windows upgrades regenerate all trampoline shims, not just core tools: vp env setup --refresh now discovers package-installed binaries via BinConfig (source: Vp) and replaces their <bin>.exe with the current trampoline.

Updates global package install to always re-copy (or rename/delete then copy) the trampoline .exe on re-install instead of skipping when the shim already exists, and adds a shared remove_or_rename_to_old helper to handle locked executables. Also centralizes SHIM_TOOLS in setup and documents the new upgrade refresh behavior in the RFCs.

Reviewed by Cursor Bugbot for commit 2d37595. Configure here.

@netlify

netlify Bot commented Apr 13, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

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

@fengmk2 fengmk2 self-assigned this Apr 13, 2026

fengmk2 commented Apr 13, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 force-pushed the fix-trampoline-exe-regen branch 2 times, most recently from e8dbb3f to fd7e589 Compare April 13, 2026 03:19

This comment was marked as resolved.

cursor[bot]

This comment was marked as resolved.

@fengmk2 fengmk2 force-pushed the fix-trampoline-exe-regen branch from fd7e589 to 79d4856 Compare April 13, 2026 06:16
Comment thread crates/vite_global_cli/src/commands/env/global_install.rs Outdated
Comment thread crates/vite_global_cli/src/commands/env/setup.rs Outdated
@fengmk2 fengmk2 force-pushed the fix-trampoline-exe-regen branch from 79d4856 to 2d37595 Compare April 13, 2026 07:18
@fengmk2

fengmk2 commented Apr 13, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@fengmk2 fengmk2 force-pushed the fix-trampoline-exe-regen branch from 2d37595 to 11be4e3 Compare April 13, 2026 07:26

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2d37595. Configure here.

Comment thread crates/vite_global_cli/src/commands/env/setup.rs
@fengmk2

This comment was marked as resolved.

@fengmk2 fengmk2 marked this pull request as ready for review April 13, 2026 07:41
@fengmk2 fengmk2 requested review from cpojer and wan9chi April 13, 2026 07:41
@fengmk2 fengmk2 changed the title fix(env): regenerate all trampoline .exe files after upgrade fix(env): regenerate all trampoline .exe files after upgrade Apr 13, 2026
fengmk2 added 3 commits April 13, 2026 16:41
During `vp upgrade`, only core shims (vp, node, npm, npx, vpx, vpr)
were refreshed. Package shims installed via `vp install -g` (e.g.,
corepack.exe, tsc.exe) kept stale trampoline binaries from the
previous version.

- Add `BinConfig::find_all_vp_source()` to discover package shims
- Add `refresh_package_shims()` to `vp env setup --refresh` (Windows)
- Fix `create_package_shim()` to re-copy trampoline on re-install
  instead of returning early when .exe exists
- Make `rename_to_old` pub(crate) for reuse in global_install

Closes #1349
Address PR review: explicitly check for NotFound when trying to
delete an .exe file, returning early instead of falling through
to the rename_to_old fallback.

Closes #1349
- Remove redundant try_exists check before remove_or_rename_to_old
  since it already handles NotFound
- Log the original remove_file error at debug level before falling
  back to rename
@fengmk2 fengmk2 force-pushed the fix-trampoline-exe-regen branch from 07db9ed to a5fca7d Compare April 13, 2026 08:41
@fengmk2

fengmk2 commented Apr 13, 2026

Copy link
Copy Markdown
Member Author

windows test works
image

@fengmk2 fengmk2 merged commit f95ad4e into main Apr 13, 2026
47 checks passed
@fengmk2 fengmk2 deleted the fix-trampoline-exe-regen branch April 13, 2026 09:15
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.

Windows trampoline .exe is not regenerated after vite-plus upgrade

2 participants