ci: fix release-day flakes in upgrade test and snap test#1645
Merged
Conversation
Right after a release commit lands on main, the dev build's package.json version equals npm latest, so `vp upgrade --force` is a no-op and the "version must change" assertion fails (e.g. v0.1.22 → v0.1.22 on run 26112690623). Downgrade to a known prior release first so the upgrade-to-latest below has a guaranteed version delta to assert against. The pin version is hoisted to a single job-level env var for easy bumps.
✅ Deploy Preview for viteplus-preview canceled.
|
fengmk2
commented
May 20, 2026
The previous approach pinned to an older release first, but that caused `vp upgrade --force` to run from the *released* 0.1.21 binary instead of the dev build — so dev's upgrade logic wasn't actually exercised. Switch the assertion to verify that `~/.vite-plus/current` resolves to a different install directory after upgrade (dev `local-dev-<ts>/` → release `<version>/`) and that rollback restores it. This exercises dev's full download/extract/swap path end-to-end, regardless of whether the dev version equals npm latest. Node's `fs.realpathSync` resolves both Unix symlinks and Windows junctions, so all three shells share the same helper.
…lake The command-upgrade-check snap test was failing on PR CIs running after v0.1.22 shipped because dev's package.json version (0.1.22) now equals npm latest (0.1.22), so `vp upgrade --check` takes the "Already up to date" branch instead of the recorded "Update available" output. Query the `alpha` dist-tag instead. Alpha is always a different version from latest (currently 0.1.21-alpha.7), so the "Update available" branch is always taken and the snapshot is stable across release cycles. The semver normalization in the snap-test framework masks the actual version numbers, so the body of snap.txt is unchanged. Same root cause as the cli-e2e-test upgrade-bash fix in this PR; the snap test surfaced on PR #1635 first because that PR also triggered CI after the release.
Member
Author
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e4556ae. Configure here.
Boshen
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Right after a release commit lands on main, the dev build's
package.jsonversion equals npm latest. Two CI checks were hard-coded to assert outputs that only happen when those versions differ, so they fail on every release-day PR run.CLI E2E
Test upgrade (bash/pwsh/cmd)(ci.yml) — assertedUPDATED_VERSION != INITIAL_VERSIONaftervp upgrade --force. When dev == latest, the upgrade runs end-to-end but the version is unchanged.currentinstall dir basename (local-dev-<ts>/→<version>/) instead. The dir flip proves the download/extract/swap and rollback flows ran. Node'sfs.realpathSyncresolves both Unix symlinks and Windows junctions, so all three shells share the same helper.Snap test
command-upgrade-check(packages/cli/snap-tests-global/command-upgrade-check/) — recorded the "Update available" output ofvp upgrade --check. When dev == latest, the actual output is "Already up to date".alphadist-tag instead. Alpha is always a different version from latest (currently0.1.21-alpha.7), so the "Update available" branch is always taken. Semver normalization masks the actual version, so the snap body is unchanged.Failure examples
Test plan
Note
Low Risk
Low risk: changes only affect CI assertions and snapshot test inputs, not production code. Main risk is masking a real regression if install directory swapping semantics change.
Overview
Makes the CI
vp upgradeE2E checks resilient to release-day runs by asserting on the.vite-plus/currentinstall directory target (viafs.realpathSync) instead of comparing CLI versions, across bash/pwsh/cmd.Stabilizes the
command-upgrade-checksnapshot by runningvp upgrade --checkagainst thealphadist-tag so the "Update available" branch is consistently exercised.Reviewed by Cursor Bugbot for commit e4556ae. Configure here.