fix(update): dev build of current release no longer self-reports an upgrade#186
Merged
Conversation
…pgrade A local/source sidecar is stamped <version>-dev+<sha> (build-sidecar.ts). Within its (correct) stable channel, the published <version> then ranked ABOVE the running build because semver puts a prerelease below its release, so the app perpetually offered an 'upgrade' to the very version it was on. Normalize the running version by stripping only the -dev+<sha> local suffix before the channel comparison; real -beta.N/-rc.N prereleases are left intact so they still see their release as an upgrade. The reported current field keeps the full string for diagnostics.
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.
Symptom
A build running the current release (e.g. v0.4.35) perpetually highlights that the same version "is available for upgrade."
Root cause
A local/source sidecar is stamped `-dev+` by `scripts/build-sidecar.ts`. The update check already polls the correct channel (stable→stable, beta→beta), but within that channel the published `` ranks above the running build — because semver puts a prerelease below its release — so `isNewerVersion("0.4.35", "0.4.35-dev+sha")` returns true. The app then offers an "upgrade" to the very version it is already running.
Published builds are unaffected: a clean `0.4.35` compares equal, and a real `0.4.35-beta.2` polls the beta channel. Only `-dev+` local binaries misfire.
Fix
`src/lib/update-check.ts`: normalize the running version by stripping only the `-dev+` local suffix before the (already channel-correct) comparison. Real `-beta.N`/`-rc.N` prereleases are left intact, so they still see their release as an upgrade. The reported `current` field keeps the full string for diagnostics.
Tests
Added a `currentVersion` test-DI seam and 3 cases: dev build of current release → up to date; dev build vs a genuinely newer release → upgrade; real beta vs its release → still an upgrade. Full suite green (1031 pass / 1 skip / 0 fail).