Skip to content

Never downgrade a newer version pin in self-update; single-line Markdown banner#96

Merged
Byggarepop merged 2 commits into
mainfrom
fix-selfupdate-downgrade-and-md-banner
Jun 11, 2026
Merged

Never downgrade a newer version pin in self-update; single-line Markdown banner#96
Byggarepop merged 2 commits into
mainfrom
fix-selfupdate-downgrade-and-md-banner

Conversation

@Byggarepop

Copy link
Copy Markdown
Owner

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 like 9.9.9-dev served from a --source local feed — the re-pin downgraded it to the nuget.org version while leaving --source untouched, producing a version/source combination that doesn't exist. The server then failed to launch at all.

SetPinnedVersion now refuses to lower an existing pin when the pinned version is newer than the target, using the existing IsNewer core-version comparison (prerelease suffixes ignored). The guard sits in SetPinnedVersion itself, so every caller (background self-update, manual self-update, AutoUpdateRegistrations reconcile) 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

MarkdownEmitter was 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_InsertsReplacesNoOpsAndNeverDowngrades gains a downgrade case (a 9.9.9-dev pin survives a 1.99.1 re-pin attempt), and Md_Minify_NoteIsSingleLine asserts the single-line note. 173/173 passing.

Byggarepop and others added 2 commits June 11, 2026 21:25
…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]>
@Byggarepop
Byggarepop merged commit 3e0eb67 into main Jun 11, 2026
1 check passed
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.

1 participant