fix(global): introduce install id for global installation#1906
Conversation
✅ Deploy Preview for viteplus-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@codex review |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
Signed-off-by: Liang <github@liangmi.dev>
fengmk2
left a comment
There was a problem hiding this comment.
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 |
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.
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 resolvepackages/<name>for compatibility with existing installations. A successful reinstall deletes only the installation it directly replaced. Cleanup of any older interrupted-install directories throughvp upgradeis intentionally left to a follow-up PR.🤖 Generated with Codex