Skip to content

fix(global): preserve existing binaries when installation fails - #3119

Merged
fengmk2 merged 6 commits into
voidzero-dev:mainfrom
jong-kyung:fix/global-install-rollback
Oct 19, 2026
Merged

fengmk2 merged 6 commits into
voidzero-dev:mainfrom
jong-kyung:fix/global-install-rollback

Conversation

@jong-kyung

Copy link
Copy Markdown
Collaborator

Summary

A failed vp install -g could delete existing executables while rolling back the installation, including files it never created. It could also lose an existing npm link and its ownership config after replacing the link.

Rollback now restores the state captured before each change instead of inferring ownership from the package's declared binaries. If restoration fails, backups are retained and a warning identifies their location.

Capture binary files and ownership configs before changing them, then
restore their original state on failure instead of removing every declared
binary. Keep backups when restoration fails.

Add regression coverage for existing files, replaced npm links, partial
installs, and failed restoration.
@jong-kyung jong-kyung self-assigned this Oct 19, 2026
@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-19T11:24:53.157117Z 4892858 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.

@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: 662a755ebb

ℹ️ 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/commands/global/install.rs Outdated
Comment thread crates/vp_global_cli/src/commands/global/install.rs Outdated
Defer temporary directory creation until an existing path needs a backup so fresh global installations do not fail when temporary storage is unavailable.

Cover packages without binaries and fresh binary installations with a read-only temporary directory.
Reject foreign regular files at new shim paths before activation and restore
backups without comparing full file contents. Keep lazy disk backups so
permissions survive rollback and failed restorations retain recoverable files.

Cover permission restoration and preserve CLI coverage for existing files
and npm ownership after installation failures.
@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: 288eb4b897

ℹ️ 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/commands/global/install.rs
Skip shim capture for protected stale bin names while retaining BinConfig backups. Add regression coverage for file identity preservation and config restoration after a later failure.
@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: be182726c4

ℹ️ 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/commands/global/install.rs
Discard rollback entries added by a failed capture_bin call because no changes to those paths have started. Preserve earlier backups so prior changes still roll back.

Add regression coverage for untouched hard links and restoration of earlier binaries and ownership configs.
@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. Delightful!

Reviewed commit: 48928582cb

ℹ️ 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 11:17
@jong-kyung jong-kyung 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
@jong-kyung
jong-kyung requested a review from fengmk2 October 19, 2026 11:25
@fengmk2
fengmk2 merged commit 554486b into voidzero-dev:main Oct 19, 2026
140 checks passed
@jong-kyung
jong-kyung deleted the fix/global-install-rollback branch October 19, 2026 12:11
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