Skip to content

ci: fix release-day flakes in upgrade test and snap test#1645

Merged
fengmk2 merged 4 commits into
mainfrom
ci/fix-upgrade-test-release-day
May 20, 2026
Merged

ci: fix release-day flakes in upgrade test and snap test#1645
fengmk2 merged 4 commits into
mainfrom
ci/fix-upgrade-test-release-day

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented May 20, 2026

Summary

Right after a release commit lands on main, the dev build's package.json version 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) — asserted UPDATED_VERSION != INITIAL_VERSION after vp upgrade --force. When dev == latest, the upgrade runs end-to-end but the version is unchanged.

  • Fix: assert on the current install dir basename (local-dev-<ts>/<version>/) instead. The dir flip proves the download/extract/swap and rollback flows ran. Node's fs.realpathSync resolves 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 of vp upgrade --check. When dev == latest, the actual output is "Already up to date".

  • Fix: 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. Semver normalization masks the actual version, so the snap body is unchanged.

Failure examples

Test plan

  • CI passes on this PR.
  • After next release, both checks still pass on the post-release-day merge-to-main run.

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 upgrade E2E checks resilient to release-day runs by asserting on the .vite-plus/current install directory target (via fs.realpathSync) instead of comparing CLI versions, across bash/pwsh/cmd.

Stabilizes the command-upgrade-check snapshot by running vp upgrade --check against the alpha dist-tag so the "Update available" branch is consistently exercised.

Reviewed by Cursor Bugbot for commit e4556ae. Configure here.

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.
@fengmk2 fengmk2 self-assigned this May 20, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 03fec6e
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a0da01f18f2e500085ac93b

Comment thread .github/workflows/ci.yml Outdated
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.
@fengmk2 fengmk2 changed the title ci: pin to older version before upgrade test to avoid release-day flake ci: assert install-dir change instead of version change in upgrade test May 20, 2026
…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.
@fengmk2 fengmk2 changed the title ci: assert install-dir change instead of version change in upgrade test ci: fix release-day flakes in upgrade test and snap test May 20, 2026
@fengmk2
Copy link
Copy Markdown
Member Author

fengmk2 commented May 20, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread packages/cli/snap-tests-global/command-upgrade-check/steps.json
@fengmk2 fengmk2 merged commit 110f89c into main May 20, 2026
40 checks passed
@fengmk2 fengmk2 deleted the ci/fix-upgrade-test-release-day branch May 20, 2026 11:57
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