Skip to content

Refactor overrideStagingHash to overrideStagingFeed and add overrideStagingQuality configuration#12775

Merged
mitchdenny merged 4 commits intomainfrom
copilot/refactor-staging-feed-url
Nov 7, 2025
Merged

Refactor overrideStagingHash to overrideStagingFeed and add overrideStagingQuality configuration#12775
mitchdenny merged 4 commits intomainfrom
copilot/refactor-staging-feed-url

Conversation

Copy link
Contributor

Copilot AI commented Nov 6, 2025

Description

Replaces overrideStagingHash configuration with overrideStagingFeed to allow overriding the entire staging feed URL instead of just the commit hash portion. Adds overrideStagingQuality configuration to control the PackageChannelQuality of the staging feed.

Changes

PackagingService.cs

  • Renamed GetCommitHashForStagingChannel()GetStagingFeedUrl()
  • Configuration key: overrideStagingHashoverrideStagingFeed
  • Accepts full NuGet feed URLs with validation (HTTP/HTTPS only)
  • Invalid URLs fall back to assembly version extraction
  • Preserved staging feed URL template as comment for reference
  • Added GetStagingQuality() method to parse overrideStagingQuality configuration
  • Supports "Stable", "Prerelease", or "Both" values (case-insensitive)
  • Defaults to "Stable" if not specified or invalid

PackagingServiceTests.cs

  • Updated tests to use full URLs instead of hash values
  • Removed hash truncation tests (no longer applicable)
  • Added tests for custom URLs, Azure DevOps feeds, and invalid URL handling
  • Added 4 new tests for quality override scenarios (Prerelease, Stable, Both, invalid values, and default behavior)

Example

// Before: override just the hash
configuration["overrideStagingHash"] = "48a11dae";
// Resulted in: https://pkgs.dev.azure.com/.../darc-pub-dotnet-aspire-48a11dae/...

// After: override entire URL and quality
configuration["overrideStagingFeed"] = "https://example.com/nuget/v3/index.json";
configuration["overrideStagingQuality"] = "Prerelease";  // or "Stable" or "Both"

Valid quality values (case-insensitive):

  • Stable - Only stable packages (default)
  • Prerelease - Only prerelease packages
  • Both - Both stable and prerelease packages

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 (URL validation ensures HTTP/HTTPS schemes only)
        • No
    • No
  • Does the change require an update in our Aspire docs?
Original prompt

The Aspire CLI includes the ability to pull packages from a staging feed if the features.stagingChannelEnabled feature flag is enabled. As part of this logic it is possible to override the hash that is used to form the feed name. Instead of having a overrideStagingHash setting change it to a overrideStagingFeed which replaces the entire staging feed URL.

When refactoring code be sure to keep the template of the staging feed URL so that its a reminder to us what the format of the feed should be when we are in "staging mode"


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 6, 2025 22:18
…ride

Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>
Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor staging feed URL handling in Aspire CLI Refactor overrideStagingHash to overrideStagingFeed for full URL override Nov 6, 2025
Copilot AI requested a review from mitchdenny November 6, 2025 22:25
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12775

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12775"

@mitchdenny
Copy link
Member

@copilot add configuration value that controls the PackageChannelQuality of the feed. Basically we should parse the string value of an overrideStagingQuality config and allow it to be set to either Prelease, Stable or Both. With the current value as the default if it is not specified. This would work in conjunction with your existing changes.

…uality

Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot add configuration value that controls the PackageChannelQuality of the feed. Basically we should parse the string value of an overrideStagingQuality config and allow it to be set to either ...

Added overrideStagingQuality configuration that accepts "Stable", "Prerelease", or "Both" values (case-insensitive) with "Stable" as the default. The implementation includes proper validation and 4 new tests covering all scenarios. See commit 59d8aec.

Copilot AI changed the title Refactor overrideStagingHash to overrideStagingFeed for full URL override Refactor overrideStagingHash to overrideStagingFeed and add overrideStagingQuality configuration Nov 7, 2025
@mitchdenny
Copy link
Member

@joperezr can you try this PR? Just download via the script, then do the following:

aspire config set -g overrideStagingFeed https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json
aspire config set -g overrideStagingQuality Prerelease
aspire new (should show the prerelease templates from dotnet-libraries)

@mitchdenny mitchdenny marked this pull request as ready for review November 7, 2025 04:12
Copilot AI review requested due to automatic review settings November 7, 2025 04:12
Copy link
Contributor

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 refactors the staging channel configuration mechanism from a commit hash-based approach to a full URL-based approach, providing more flexibility and adding support for quality override configuration.

Key Changes:

  • Refactored GetCommitHashForStagingChannel() to GetStagingFeedUrl(), which now accepts full feed URLs via overrideStagingFeed configuration
  • Added GetStagingQuality() method to support configurable channel quality via overrideStagingQuality configuration
  • Added URL validation to ensure override feeds are well-formed before use
  • Enhanced test coverage with 6 new test cases covering URL validation, quality override, and edge cases

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Aspire.Cli/Packaging/PackagingService.cs Refactored staging channel configuration to use full URLs instead of commit hashes; added quality override support with validation and fallback logic
tests/Aspire.Cli.Tests/Packaging/PackagingServiceTests.cs Updated existing tests to use new URL-based configuration; added comprehensive test coverage for URL validation, quality overrides (Prerelease/Both/Invalid), and edge cases

@mitchdenny mitchdenny enabled auto-merge (squash) November 7, 2025 05:42
@mitchdenny mitchdenny merged commit 29a832c into main Nov 7, 2025
301 of 302 checks passed
@mitchdenny mitchdenny deleted the copilot/refactor-staging-feed-url branch November 7, 2025 10:32
@dotnet-policy-service dotnet-policy-service bot added this to the 13.1 milestone Nov 7, 2025
@mitchdenny
Copy link
Member

/backport to release/13.0

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Started backporting to release/13.0: https://github.com/dotnet/aspire/actions/runs/19182239761

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

@mitchdenny backporting to "release/13.0" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Creating an empty commit: Initial plan
Applying: Refactor overrideStagingHash to overrideStagingFeed for full URL override
.git/rebase-apply/patch:57: trailing whitespace.
        
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M	src/Aspire.Cli/Packaging/PackagingService.cs
M	tests/Aspire.Cli.Tests/Packaging/PackagingServiceTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Aspire.Cli/Packaging/PackagingService.cs
Auto-merging tests/Aspire.Cli.Tests/Packaging/PackagingServiceTests.cs
CONFLICT (content): Merge conflict in tests/Aspire.Cli.Tests/Packaging/PackagingServiceTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Refactor overrideStagingHash to overrideStagingFeed for full URL override
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

mitchdenny added a commit that referenced this pull request Nov 7, 2025
…tagingQuality configuration (#12775)

* Initial plan

* Refactor overrideStagingHash to overrideStagingFeed for full URL override

Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>

* Add URL validation for overrideStagingFeed configuration

Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>

* Add overrideStagingQuality configuration to control staging channel quality

Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>
joperezr pushed a commit that referenced this pull request Nov 7, 2025
…d add overrideS… (#12825)

* Refactor overrideStagingHash to overrideStagingFeed and add overrideStagingQuality configuration (#12775)

* Initial plan

* Refactor overrideStagingHash to overrideStagingFeed for full URL override

Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>

* Add URL validation for overrideStagingFeed configuration

Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>

* Add overrideStagingQuality configuration to control staging channel quality

Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>

* Remove excess tests.

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>
Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants