Skip to content

feat(cli): non-blocking upgrade check with rate-limited notice#1173

Merged
graphite-app[bot] merged 1 commit intomainfrom
upgrade-tips
Mar 30, 2026
Merged

feat(cli): non-blocking upgrade check with rate-limited notice#1173
graphite-app[bot] merged 1 commit intomainfrom
upgrade-tips

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Mar 27, 2026

Summary

  • Add background upgrade check that queries the npm registry for the latest vp version
  • Show a one-line notice on stderr at most once per 24 hours (not on every run)
  • Registry query is also rate-limited to once per 24 hours, cached to ~/.vite-plus/.upgrade-check.json
  • Runs as an async background task concurrently with the command — zero latency impact

Suppression

The check is skipped entirely when:

  • VP_NO_UPDATE_CHECK=1, CI, or VITE_PLUS_CLI_TEST is set
  • Stderr is not a TTY (non-interactive / piped)
  • Command is upgrade, implode, lint, or fmt
  • Command has --silent or --json flag

RFC

See rfcs/upgrade-check.md for full design rationale.

image.png

Test plan

  • cargo test -p vite_global_cli -- upgrade_check (16 tests)
  • Manual: rm ~/.vite-plus/.upgrade-check.json && vp build — shows notice if behind latest
  • Manual: vp build again — no notice (prompted_at within 24h)
  • Manual: VP_NO_UPDATE_CHECK=1 vp build — no notice
  • Manual: vp install --silent — no notice

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 27, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit db75675
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69ca19cd0ba0fd0008b57070

@fengmk2 fengmk2 self-assigned this Mar 27, 2026
Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 27, 2026


How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 changed the title feat(cli): add non-blocking upgrade check with cached registry query feat(cli): non-blocking upgrade check with rate-limited notice Mar 27, 2026
@fengmk2 fengmk2 marked this pull request as ready for review March 30, 2026 02:48
Copy link
Copy Markdown
Member

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! It looks like it is not annoying, which is the most important thing.

@graphite-app
Copy link
Copy Markdown

graphite-app bot commented Mar 30, 2026

Merge activity

  • Mar 30, 6:28 AM UTC: fengmk2 added this pull request to the Graphite merge queue.
  • Mar 30, 6:52 AM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'done', 'CLI E2E test (windows-latest, x86_64-pc-windows-msvc)').
  • Mar 30, 7:32 AM UTC: fengmk2 added this pull request to the Graphite merge queue.
  • Mar 30, 7:33 AM UTC: Merged by the Graphite merge queue.

## Summary

- Add background upgrade check that queries the npm registry for the latest `vp` version
- Show a one-line notice on stderr at most **once per 24 hours** (not on every run)
- Registry query is also rate-limited to once per 24 hours, cached to `~/.vite-plus/.upgrade-check.json`
- Runs as an async background task concurrently with the command — zero latency impact

## Suppression

The check is skipped entirely when:

- `VP_NO_UPDATE_CHECK=1`, `CI`, or `VITE_PLUS_CLI_TEST` is set
- Stderr is not a TTY (non-interactive / piped)
- Command is `upgrade`, `implode`, `lint`, or `fmt`
- Command has `--silent` or `--json` flag

## RFC

See `rfcs/upgrade-check.md` for full design rationale.

![image.png](https://app.graphite.com/user-attachments/assets/da1a8f7b-12bb-49c3-8f0d-9133d04c8bad.png)

## Test plan

- [x] `cargo test -p vite_global_cli -- upgrade_check` (16 tests)
- [x] Manual: `rm ~/.vite-plus/.upgrade-check.json && vp build` — shows notice if behind latest
- [x] Manual: `vp build` again — no notice (prompted_at within 24h)
- [ ] Manual: `VP_NO_UPDATE_CHECK=1 vp build` — no notice
- [ ] Manual: `vp install --silent` — no notice
@graphite-app graphite-app bot merged commit db75675 into main Mar 30, 2026
54 of 56 checks passed
@graphite-app graphite-app bot deleted the upgrade-tips branch March 30, 2026 07:33
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.

2 participants