Never downgrade a newer version pin in self-update; single-line Markdown banner#96
Merged
Merged
Conversation
…own banner SetPinnedVersion now refuses to lower an existing --version pin when the pinned version is newer than the target (core-version comparison via IsNewer, prerelease suffixes ignored). This stops the background self-update from stomping a deliberately pinned local dev build (e.g. 9.9.9-dev from a local feed) with the latest stable from nuget.org — which previously left the entry pointing at a version the configured --source doesn't have, so the server failed to launch. Stale-config re-pinning and the manual self-update path (#68) are unaffected: older pins still upgrade. MarkdownEmitter's banner note collapses from two lines to one, matching the other emitters after #94 (it was the only emitter missed in that pass). Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Two fixes found while live-testing the #94 trim changes against the 9.9.9-dev local-feed build.
Self-update downgrade protection
The background self-update discovers the latest version with an unpinned
dotnet tool execute(which resolves nuget.org's latest stable) and re-pins all host configs unconditionally. When a config was deliberately pinned to a newer version — a local dev build like9.9.9-devserved from a--sourcelocal feed — the re-pin downgraded it to the nuget.org version while leaving--sourceuntouched, producing a version/source combination that doesn't exist. The server then failed to launch at all.SetPinnedVersionnow refuses to lower an existing pin when the pinned version is newer than the target, using the existingIsNewercore-version comparison (prerelease suffixes ignored). The guard sits inSetPinnedVersionitself, so every caller (background self-update, manualself-update,AutoUpdateRegistrationsreconcile) gets the same protection, while stale-config re-pinning is unchanged — older pins still upgrade, and the #68 behavior of re-pinning regardless of the running process version is preserved.Markdown banner note
MarkdownEmitterwas the only emitter missed in #94's banner collapse and still emitted a two-line note. Now one line, matching the other 14 emitters.Tests
AutoUpdate_SetPinnedVersion_InsertsReplacesNoOpsAndNeverDowngradesgains a downgrade case (a9.9.9-devpin survives a1.99.1re-pin attempt), andMd_Minify_NoteIsSingleLineasserts the single-line note. 173/173 passing.