Skip to content

Fix version checking with mixed state #10956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 15, 2025
Merged

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 14, 2025

Description

How the bug occurs:

  1. You're running pre-release.
  2. Version checker runs and sees a newer version. Saved to state.
  3. Within the version check interval (2 days) you switch the app to release.
  4. Version checker uses save state on startup. Release app prompts for newer pre-release version.

Fix is to unify logic for getting new version through PackageUpdateHelpers.GetNewerVersion.

(I don't think a backport is required. This is a niche and easily ignorable scenario)

Fixes #10749

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@JamesNK JamesNK added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Aug 14, 2025
@JamesNK JamesNK requested a review from mitchdenny as a code owner August 14, 2025 04:32
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in version checking logic where switching between pre-release and release versions within the check interval could cause inappropriate version notifications. The fix unifies the version comparison logic to properly handle mixed pre-release and stable version states.

  • Unified version checking logic to consider both fetched and stored versions together
  • Added dependency injection for package version provider to improve testability
  • Enhanced test coverage for mixed pre-release/stable version scenarios

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Shared/PackageUpdateHelpers.cs Modified GetNewerVersion to accept and process stored version alongside fetched packages
src/Aspire.Hosting/VersionChecking/VersionCheckService.cs Refactored to use injected package version provider and unified version checking logic
src/Aspire.Hosting/VersionChecking/IPackageVersionProvider.cs Added new interface for package version retrieval
src/Aspire.Hosting/VersionChecking/PackageVersionProvider.cs Implemented concrete package version provider
src/Aspire.Hosting/DistributedApplicationBuilder.cs Registered new package version provider service
tests/Aspire.Hosting.Tests/VersionChecking/VersionCheckServiceTests.cs Added comprehensive tests for mixed version scenarios and test infrastructure

@davidfowl davidfowl merged commit bda4f0d into main Aug 15, 2025
576 of 578 checks passed
@davidfowl davidfowl deleted the jamesnk/version-check-state branch August 15, 2025 16:39
@dotnet-policy-service dotnet-policy-service bot added this to the 9.5 milestone Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9.4 Dashboard prompting to upgrade to 9.5 preview
2 participants