Skip to content

fix: surface failed package delete during unpublish#9158

Open
buley wants to merge 1 commit intonpm:latestfrom
buley:fix_unpublish_delete_404_clean
Open

fix: surface failed package delete during unpublish#9158
buley wants to merge 1 commit intonpm:latestfrom
buley:fix_unpublish_delete_404_clean

Conversation

@buley
Copy link
Copy Markdown

@buley buley commented Mar 27, 2026

Summary

  • Treat E404 as success only when the initial packument fetch reports the package is already gone.
  • Surface 404 failures from the full-package delete path instead of returning success.
  • Add regressions at both the libnpmpublish and CLI layers for a failed full-package delete.

Verification

  • source ~/.nvm/nvm.sh && nvm use 22.22.0 >/dev/null && cd /Users/buley/Documents/Code/cli-fix-unpublish-clean && npx tap --no-coverage workspaces/libnpmpublish/test/unpublish.js
  • source ~/.nvm/nvm.sh && nvm use 22.22.0 >/dev/null && cd /Users/buley/Documents/Code/cli-fix-unpublish-clean && npx tap --no-coverage test/lib/commands/unpublish.js

Repro

Before this change, npm unpublish <pkg> --force could receive a DELETE .../-rev/... 404 from the registry, still exit 0, and print success because libnpmpublish swallowed any E404 raised anywhere in the unpublish flow.

@buley buley requested a review from a team as a code owner March 27, 2026 20:27
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.

1 participant