Skip to content

fix(shim): preserve npm global links during uninstall dry runs - #3112

Merged
fengmk2 merged 7 commits into
voidzero-dev:mainfrom
jong-kyung:fix/npm-global-uninstall-dry-run
Oct 19, 2026
Merged

fengmk2 merged 7 commits into
voidzero-dev:mainfrom
jong-kyung:fix/npm-global-uninstall-dry-run

Conversation

@jong-kyung

Copy link
Copy Markdown
Collaborator

Summary

npm uninstall -g <package> --dry-run leaves the package installed, but Vite+ previously removed its executable links and BinConfig after npm exited successfully. This could make the installed command unavailable through Vite+.

Only clean up links after the package has disappeared from the selected npm prefix. This also preserves installed state when dry-run is enabled through .npmrc or npm_config_dry_run, without duplicating npm's configuration parsing.

Collect uninstall binaries only from the selected prefix to avoid removing links based on a package installed under another Node prefix.

Only clean up links after the package disappears from the selected npm
prefix. Collect uninstall binaries from that prefix without falling back
to another Node installation.

Cover dry runs configured through CLI flags, environment variables, and
user npmrc, while verifying that real uninstalls still remove links.
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T05:33:50.531481Z 93385e5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jong-kyung jong-kyung self-assigned this Oct 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d536bb4bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vp_global_cli/src/shim/dispatch.rs Outdated
Recognize -C and -C= so link creation and cleanup use the same prefix as npm when npmrc or NPM_CONFIG_PREFIX points elsewhere.

Cover argument ordering, mixed-prefix precedence, configuration overrides, and dry-run preservation.
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d94400848

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vp_global_cli/src/shim/dispatch.rs Outdated
Comment thread crates/vp_global_cli/src/shim/dispatch.rs Outdated
Keep the package path collected before uninstall so a surviving local copy cannot be mistaken for the removed global installation.

Verify that real uninstall cleans up global links while preserving local packages, and that dry runs still preserve the installed command.
Restore lookup in the selected Node installation when the configured npm prefix has no readable package manifest. Retain the actual installation path so dry runs and no-op uninstalls preserve links to surviving packages.

Reuse the existing package lookup helper without adding npm configuration parsing. Cover userconfig overrides with a private runtime copy so tests do not modify the shared runtime seed.
Replace the private runtime copy script with seed-runtime = false and a pinned Node version. Keep the package and link assertions and verify that the runtime directory is not a shared symlink before global npm writes.

This case now downloads its own runtime rather than copying the shared seed.
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bdd2c8c13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Restore a private copy of the seeded runtime so global npm writes stay isolated without downloading Node for each case. Point the Node distribution mirror at a closed local endpoint to catch accidental download dependencies.

Keep the existing uninstall assertions and regenerate the snapshot.
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 93385e58bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jong-kyung
jong-kyung marked this pull request as ready for review October 19, 2026 05:25
@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: create-e2e Run `vp create` e2e tests labels Oct 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93385e58bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vp_global_cli/src/shim/dispatch.rs
@fengmk2
fengmk2 merged commit a42d40a into voidzero-dev:main Oct 19, 2026
140 checks passed
@jong-kyung
jong-kyung deleted the fix/npm-global-uninstall-dry-run branch October 19, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants