Skip to content

Tell CLI users when a newer stable release is published - #490

Merged
tnkuehne merged 8 commits into
mainfrom
cli-update-hint
Nov 29, 2026
Merged

tnkuehne merged 8 commits into
mainfrom
cli-update-hint

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The CLI prints one line on stderr after a command when an earlier check found a newer stable release:
    Widefleet 0.7.23 is available (installed 0.7.22). Update with: pnpm add --global widefleet@latest --config.minimum-release-age=0
  • Like Vite+, the hint comes from a cached answer. When that answer is missing or older than an hour, the CLI starts a hidden widefleet update-check in its own process group with closed standard streams. That process records the attempt, asks npm for latest and saves the answer for later commands, so no command waits for the registry and short commands do not lose the check.
  • CI or NO_UPDATE_NOTIFIER (the variable update-notifier uses) turns the check off. The test configuration sets NO_UPDATE_NOTIFIER, so CLI tests make no registry requests.
  • Canary builds get no hint, because @latest would move them to the stable channel.
  • The update command disables pnpm's minimumReleaseAge for that one install. pnpm 11 defaults it to one day, so a plain reinstall silently picks the newest release older than a day. The widefleet package depends only on its own native packages, so no third-party code bypasses the age check.
  • The three copies of the state directory lookup now share one helper.

Verification

  • cargo clippy -p platform-cli --all-targets -- -D warnings
  • cargo test -p platform-cli update::
  • Release build against the real registry: a cached newer version prints the hint; a 4 ms command with a stale cache prints the cached hint and the detached process refreshes it; an unreachable registry records the attempt without an answer; CI and NO_UPDATE_NOTIFIER suppress it.
  • RUN_CLI_TESTS=1 without CI against the debug build: discovery-cli.test.ts, cli.test.ts, auth-cli.test.ts, reporting-cli.test.ts (130 passed)

The CLI checks npm's latest dist-tag at most once a day and prints the
update command on stderr. The command disables pnpm's minimumReleaseAge
for that one install: the package depends only on its own native builds,
and pnpm 11 otherwise installs the newest release older than a day.
Canary builds get no hint, because @latest would switch their channel.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 17bb9f5 Nov 29 2026, 12:45 PM

A slow registry or an unwritable state directory no longer makes every
command wait for the registry. CI installs a chosen version, and source
builds used by the CLI tests do not come from npm. A closed stderr no
longer panics after the command finished.
Tests that run release builds without CI record a fresh check without an
answer, so they make no registry request and print no hint. A failed
first check no longer stores the CLI's own version as the latest release,
which another installed CLI would have reported as an available update.
The hint comes from the previous check, and an outdated answer is
refreshed in the background, so no command waits for the registry.
CI and NO_UPDATE_NOTIFIER, the variable npm's update-notifier uses,
turn the check off. Tests set NO_UPDATE_NOTIFIER instead of preparing
a cache, and source builds no longer need their own exception.
A hanging resolver, registry or state file system no longer keeps a
finished command from exiting, because the runtime waits for its
blocking tasks on shutdown. Without a state directory there is no check.
The Playwright CLI login sets NO_UPDATE_NOTIFIER like the Vitest suites.
A stale answer starts a hidden widefleet update-check process in its own
process group. It records the attempt, asks npm and saves the result, so
short commands no longer lose the check and none of them waits for it.
@tnkuehne
tnkuehne merged commit 4f369db into main Nov 29, 2026
17 checks passed
@tnkuehne
tnkuehne deleted the cli-update-hint branch November 29, 2026 15:40
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