Group channels in darc get-channels output and deduplicate categorization logic#5197
Group channels in darc get-channels output and deduplicate categorization logic#5197
Conversation
Co-authored-by: premun <7013027+premun@users.noreply.github.com>
Co-authored-by: premun <7013027+premun@users.noreply.github.com>
darc get-channels outputCo-authored-by: premun <7013027+premun@users.noreply.github.com>
Co-authored-by: premun <7013027+premun@users.noreply.github.com>
Yes! I've now moved the |
There was a problem hiding this comment.
Pull Request Overview
This PR improves the organization and maintainability of channel display logic by grouping channels by category in the darc get-channels command output and consolidating duplicate categorization logic into a shared utility class.
Key changes:
- Shared categorization logic: Created
ChannelCategorizerutility class to eliminate code duplication between Darc and BarViz - Enhanced CLI output: Modified text output to group channels by category (.NET versions, VS, Windows, Test, Other) while preserving JSON format
- Comprehensive testing: Added test suite covering various scenarios including edge cases and output format verification
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/ProductConstructionService/Microsoft.DotNet.ProductConstructionService.Client/Helpers/ChannelCategorizer.cs |
New shared utility class implementing channel categorization logic with predefined category hierarchy |
src/Microsoft.DotNet.Darc/Darc/Operations/GetChannelsOperation.cs |
Updated to use shared categorizer and group channels by category in text output |
src/ProductConstructionService/ProductConstructionService.BarViz/Layout/NavMenu.razor |
Refactored to use shared ChannelCategorizer instead of duplicate local implementation |
test/Microsoft.DotNet.Darc.Tests/Operations/GetChannelsOperationTests.cs |
Comprehensive test suite covering operation behavior, output formats, and categorization edge cases |
| Test verification files | Expected output snapshots for JSON, text, and grouped text formats |
|
we might want to hide this feature behind some flag, could be that there's some automation using the command? |
Good point. We can just put a bunch of .NET versions there as empty groups are discarded.
I searched through the dnceng and devdiv orgs and didn't find any. I hope if people use this, they use |
|
@copilot fix the unit tests to match the last changes |
Co-authored-by: premun <7013027+premun@users.noreply.github.com>
Fixed the unit test failures caused by a static state bug in ChannelCategorizer. The issue was that the static categories were being reused across multiple test runs, causing channels to accumulate. Now creates fresh category instances for each categorization call. All tests now pass. Commit: 3f68429 |
The
darc get-channelscommand now groups channels by category in the text output, matching the organization used in the BarViz navigation menu. This provides better structure and readability when viewing channels in the CLI.Additionally, the duplicate categorization logic between Darc and BarViz has been consolidated into a shared
ChannelCategorizerclass in theMicrosoft.DotNet.ProductConstructionService.Client.Helpersnamespace, eliminating code duplication and ensuring both tools use identical categorization logic.Changes Made
ChannelCategorizerutility class in the shared Client project that implements the categorization logicWriteYamlChannelList()to group channels by category instead of simple alphabetical listingChannelCategorizerinstead of its own duplicate logic (~50 lines of code removed)Example Output
Before:
After:
Categorization Logic
Channels are organized into predefined categories in priority order:
.NET 20,.NET 19, ....NET 6,.NET(for .NET releases)VS(for Visual Studio channels)Windows(for Windows-related channels)Test(for channels with classification="test")Other(for channels that don't match other categories)Categories with no channels are automatically excluded from the output. The categorization uses case-insensitive prefix matching, ensuring channels like ".NET 8 Preview" are correctly grouped under ".NET 8".
Fixes #5196.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.