Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 25, 2025

Description

Extends darc delete-default-channel to modify default channel configuration via the maestro-configuration repository, controlled by DARC_USE_CONFIGURATION_REPOSITORY environment variable. This enables the transition period where both API-based and config-repo-based deletion can coexist.

Changes

Interface & Implementation

  • Added DeleteDefaultChannelAsync method to IConfigurationRepositoryManager and ConfigurationRepositoryManager
  • Follows the same generic deletion pattern used by DeleteSubscriptionAsync

Command Options

  • Changed DeleteDefaultChannelCommandLineOptions to extend ConfigurationManagementCommandLineOptions
  • Inherits configuration repository flags: --configuration-repository, --configuration-branch, --configuration-base-branch, --configuration-file, --no-pr

Operation Logic

  • DeleteDefaultChannelOperation now resolves the default channel once, then branches based on ShouldUseConfigurationRepository
  • Config repo path: converts DefaultChannel model to DefaultChannelYaml and calls DeleteDefaultChannelAsync
  • API path: maintains existing DeleteDefaultChannelAsync(id) call
  • Full backward compatibility preserved

Testing

  • Added DeleteDefaultChannelOperationConfigRepoTests with 4 test cases covering deletion from files, file cleanup, custom paths, and file searching

Usage

# Enable config repo mode
export DARC_USE_CONFIGURATION_REPOSITORY=true

# Delete default channel - creates PR in maestro-configuration
darc delete-default-channel \
  --repo https://github.com/dotnet/runtime \
  --branch refs/heads/main \
  --channel ".NET 9"

# Use custom branch and skip PR (for scenario tests)
darc delete-default-channel \
  --repo https://github.com/dotnet/runtime \
  --branch refs/heads/main \
  --channel ".NET 9" \
  --configuration-branch my-test-branch \
  --no-pr
Original prompt

This section details on the original issue you should resolve

<issue_title>Make darc delete-default-channel work with the Configuration repo</issue_title>
<issue_description>Depends on #5480

Context

With the default channel configuration moving to the configuration repo, we should make it so darc delete-default-channel modifies the repo config. During the transition period, this should be behind a flag in the command.

Goal

Modify the existing darc delete-default-channel command so it deletes the default channel by modifying the configuration repo in whichever structure we agree on, using the available yaml models. We'll need to add a few flags to the command:

  • Flag to target the repo instead of the API
  • Flag to specify configuration repository
  • Flag to specify which branch to commit the config changes to (if we already have a PR, or for scenario tests)
  • Flag to specify which base branch to use for the PR creation
  • Flag to specify we don't want to open a PR (for scenario tests)

This should be written so it makes it easy to remove the API part, and use the configuration repo as one and only way to modify the configuration
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 25, 2025
Copilot AI changed the title [WIP] Update darc delete-default-channel for configuration repo Add configuration repository support to darc delete-default-channel Dec 25, 2025
Copilot AI requested a review from dkurepa December 25, 2025 12:52
@dkurepa dkurepa force-pushed the copilot/modify-darc-delete-default-channel branch from 52443ff to a059406 Compare December 25, 2025 15:43
premun
premun previously approved these changes Jan 5, 2026
premun
premun previously approved these changes Jan 6, 2026
adamzip
adamzip previously approved these changes Jan 6, 2026
@premun premun marked this pull request as ready for review January 7, 2026 09:11
Copilot AI review requested due to automatic review settings January 7, 2026 09:11
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 extends the darc delete-default-channel command to support modifying default channel configuration via the maestro-configuration repository, controlled by the DARC_USE_CONFIGURATION_REPOSITORY environment variable. This enables a transition period where both API-based and configuration-repository-based deletion can coexist.

Key Changes:

  • Added configuration repository deletion support to IConfigurationRepositoryManager and implementation
  • Extended command-line options to include configuration repository parameters
  • Updated operation logic to route to either configuration repository or API based on environment flag

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/Microsoft.DotNet.Darc.Tests/Operations/DeleteDefaultChannelOperationConfigRepoTests.cs Comprehensive test suite with 4 test cases covering deletion scenarios, file cleanup, custom paths, and file searching
src/Microsoft.DotNet.Darc/DarcLib/ConfigurationRepository/LocalGitRepo.cs Updated DeleteFileAsync to handle file deletion with git operations
src/Microsoft.DotNet.Darc/Darc/Options/UpdateDefaultChannelBaseCommandLineOptions.cs Changed base class to ConfigurationManagementCommandLineOptions to inherit config repo options
src/Microsoft.DotNet.Darc/Darc/Options/DeleteDefaultChannelCommandLineOptions.cs Restructured to extend configuration management options and implement required interface
src/Microsoft.DotNet.Darc/Darc/Operations/DeleteDefaultChannelOperation.cs Added branching logic to route deletion through config repo or API based on environment flag
src/MaestroConfiguration/src/Microsoft.DotNet.MaestroConfiguration.Client/IConfigurationRepositoryManager.cs Added DeleteDefaultChannelAsync method signature
src/MaestroConfiguration/src/Microsoft.DotNet.MaestroConfiguration.Client/ConfigurationRepositoryManager.cs Implemented DeleteDefaultChannelAsync following the established deletion pattern

…elOperationConfigRepoTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@adamzip adamzip dismissed stale reviews from premun and themself via 8d6d9b2 January 7, 2026 11:43
…mandLineOptions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@premun premun enabled auto-merge (squash) January 7, 2026 13:19
@premun premun merged commit 887a87d into main Jan 7, 2026
7 of 9 checks passed
@premun premun deleted the copilot/modify-darc-delete-default-channel branch January 7, 2026 13:21
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.

Make darc delete-default-channel work with the Configuration repo

4 participants