Skip to content

fix(global): introduce install id for global installation#1906

Merged
fengmk2 merged 17 commits into
voidzero-dev:mainfrom
liangmiQwQ:liang/codex/global-install-id
Jun 25, 2026
Merged

fix(global): introduce install id for global installation#1906
fengmk2 merged 17 commits into
voidzero-dev:mainfrom
liangmiQwQ:liang/codex/global-install-id

Conversation

@liangmiQwQ

@liangmiQwQ liangmiQwQ commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

The global package reinstall flow introduced by #1698 installs into the final prefix, but it first moves the active prefix to a backup. An interruption can leave the installed package unavailable, and the approaches explored in #1770 and #1773 trade that failure mode for other windows where bins can still break.

This PR adds an install ID to managed package metadata. Each install now writes directly to a sibling prefix such as packages/<name>#<uuid>, then activates that immutable directory by saving metadata after npm succeeds. The ID is a standard UUID v4 prefixed with #, which is filesystem-safe but invalid in npm package names. Binary dispatch, vp env which, vpx, and global outdated output resolve the active directory from metadata, so no installed prefix is moved.

Metadata without installId, or with an empty value, continues to resolve packages/<name> for compatibility with existing installations. A successful reinstall deletes only the installation it directly replaced. Cleanup of any older interrupted-install directories through vp upgrade is intentionally left to a follow-up PR.

🤖 Generated with Codex

@netlify

netlify Bot commented Jun 21, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 9a89539
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a3c9900e01936000887db85
😎 Deploy Preview https://deploy-preview-1906--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@liangmiQwQ liangmiQwQ changed the title fix(global): activate immutable package installs fix(global): introduce install id for global installation Jun 22, 2026
Comment thread .github/workflows/ci.yml
@liangmiQwQ liangmiQwQ marked this pull request as ready for review June 22, 2026 01:10
@fengmk2

fengmk2 commented Jun 22, 2026

Copy link
Copy Markdown
Member

@codex review

@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 Jun 22, 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: fc9645b7c8

ℹ️ 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/vite_global_cli/src/commands/global/install.rs
Comment thread crates/vite_global_cli/src/commands/global/install.rs
Comment thread crates/vite_global_cli/src/commands/global/install.rs Outdated
Comment thread crates/vite_global_cli/src/commands/global/install.rs Outdated
@liangmiQwQ liangmiQwQ marked this pull request as draft June 22, 2026 08:26

@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: 1311ca417f

ℹ️ 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 packages/cli/snap-tests-global/env-install-interrupt/test-reinstall-interrupt.js Outdated
@liangmiQwQ liangmiQwQ marked this pull request as ready for review June 22, 2026 09:48
@liangmiQwQ liangmiQwQ requested a review from fengmk2 June 22, 2026 09:49

@fengmk2 fengmk2 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

One question about lifecycle: interrupted installs can leave inactive packages/<name>#<uuid> directories behind, and this PR intentionally leaves cleanup to a follow-up.
Do we already have an issue or plan for when this cleanup runs.

@liangmiQwQ

Copy link
Copy Markdown
Collaborator Author

LGTM

One question about lifecycle: interrupted installs can leave inactive packages/<name>#<uuid> directories behind, and this PR intentionally leaves cleanup to a follow-up. Do we already have an issue or plan for when this cleanup runs.

I plan to deal with them unitedly like in vp upgrade, but considering locked files and other problems, I decide to handle it later.

@fengmk2 fengmk2 merged commit 7c4bd59 into voidzero-dev:main Jun 25, 2026
91 of 92 checks passed
@liangmiQwQ liangmiQwQ deleted the liang/codex/global-install-id branch June 25, 2026 03:29
fengmk2 pushed a commit that referenced this pull request Jun 25, 2026
The current global install cleanup only removes the install directory
recorded by previous metadata. If a reinstall is interrupted, unrecorded
package directories can stay behind, and the legacy empty install-id
package directory can also survive.

This PR keeps a file lock for each in-progress global package install
directory, then replaces the previous-install cleanup with a
same-package stale directory sweep. The sweep skips locked directories
so concurrent global installs are protected, and removes both
`package#installId` stale directories and the empty install-id layout.

Related:
-
#1906 (comment)
-
#1943 (comment)

🤖 Generated with Codex.
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