Skip to content

fix(upgrade): install the exact version and verify it - #13

Merged
boyander merged 1 commit into
mainfrom
fix/upgrade-verifies-installed-version
Oct 14, 2026
Merged

boyander merged 1 commit into
mainfrom
fix/upgrade-verifies-installed-version

Conversation

@boyander

Copy link
Copy Markdown
Member

Right after a release, faable upgrade said Upgraded to 4.9.0 and left 4.8.0 installed.

Cause: the npm registry CDN caches the packument for up to 5 minutes per edge. getLatestVersion got "latest is 4.9.0" from one edge, then npm install -g @faable/faable@latest resolved latest against another edge that still said 4.8.0. npm saw 4.8.0 already installed, changed nothing and exited 0, and the command reported success.

Fix (src/lib/self_upgrade.ts):

  • Install @<exact version>: a stale edge now fails with ETARGET instead of keeping the old one silently.
  • Retry while the CDN catches up (5 × 30 s); the spinner says it's propagating.
  • Report success only when npm ls -g shows the target. Otherwise, say the release is still propagating and to run it again shortly.
  • Any other npm error (EACCES, network…) stops at once and prints npm's output.

Tests: unit tests with a fake npm cover each case, including the bug (exit 0 with the old version still installed). Also run against real global npm.

…sting npm's exit code

Right after a release `faable upgrade` said "Upgraded to X" and left the
old version installed. The registry CDN caches the packument up to 5 min
per edge: the edge that answered "latest is X" and the one `npm install
@faable/faable@latest` asked could disagree, npm resolved latest to the
installed version, changed nothing, and exited 0.

Now it installs @x (a stale edge fails with ETARGET instead of silently
keeping the old one), retries while the CDN catches up (5 × 30 s), and
only reports success when `npm ls -g` shows X. Otherwise it says the
release is still propagating and to try again shortly.
@boyander
boyander merged commit 7f4dcb5 into main Oct 14, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.9.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@boyander
boyander deleted the fix/upgrade-verifies-installed-version branch October 14, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant