v0.1.4: --prerelease CLI flag on update + update check#8
Merged
Conversation
Adds a per-invocation `--prerelease` opt-in to the `update` and `update check` commands. Downstream apps (e.g. pl-app) need a way to test RC builds at the CLI without flipping the DI-registered `SelfUpdaterOptions.IncludePrereleases` default. Absence of the flag preserves today's behaviour exactly. The override threads through the source-query chain alongside the existing `channel` parameter. To keep `IUpdateSource` (the README's "primary extension point") backward-compatible, the new overload on `IUpdateSource`, `IUpdateChecker`, and `ISelfUpdater` is added as a default interface method that delegates to the existing one — external implementers compile unchanged; they only override the new overload if they want to honour `--prerelease`. `null` defers to the source's captured default; `true`/`false` force inclusion or exclusion. Cache change: the per-user JSON cache now keys on `(channel, includePrereleases)` so a `--prerelease` answer doesn't pollute the default `update check` cache, and vice versa. v0.1.3 cache files (missing the new field) are read as non-prerelease — matches their actual provenance, no migration needed. Tests: 7 new (164 → 171, all green). Covers flag-on/flag-off override plumbing for both commands, source endpoint switching on override, and cache key isolation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c76efd7 to
a396d6c
Compare
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
--prereleasetoupdateandupdate checkso downstream apps (e.g. pl-app) can opt into prerelease tags for one command invocation without touching the DI-registeredSelfUpdaterOptions.IncludePrereleasesdefault. Absence of the flag preserves today's behaviour exactly.bool? includePrereleasesOverridethrough the source-query chain (IUpdateSource.GetLatestAsync→IUpdateChecker.CheckAsync→ISelfUpdater.GetLatestReleaseAsync) as default interface methods, so existing externalIUpdateSourceimplementers compile unchanged.nulldefers to the source's captured default;true/falseforce inclusion or exclusion.(channel, includePrereleases)so a--prereleaseanswer doesn't pollute the next defaultupdate check(and vice versa). v0.1.3 cache files read as non-prerelease — matches their actual provenance.Why DIM over modifying interface signatures inline?
v0.1.3 set a precedent for inline parameter additions (
onConflictonISelfUpdater.InstallAsync), but the README billsIUpdateSourceas the primary extension point. Breaking it on a patch bump risks downstream churn that a DIM avoids. External implementers can opt into the new overload later if they want to honour the flag.Out of scope (deliberately)
ISelfUpdater.InstallAsync(progress, ct)for symmetry — CLI doesn't use that path (TOCTOU-safeGetLatestReleaseAsync+InstallAsync(release, ...)instead). Can be added later if a library caller needs it.Test plan
dotnet build— clean (TreatWarningsAsErrors=true).dotnet test— 171 passing (was 164; 7 new).updateandupdate check.HttpGitHubReleaseSourcehits/releases(not/releases/latest) whenincludePrereleasesOverride: trueeven if constructed withincludePrereleases: false.dotnet build -c Release— producesNextIteration.SpectreConsole.SelfUpdate.0.1.4.nupkg+.snupkginartifacts/packages/.pl-app update check --prereleaseagainst a repo with an RC tag) before cutting the release.🤖 Generated with Claude Code