Skip to content

Fix cli help and pip budget - #5485

Merged
Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix/release-sweep-cli-help-and-pip-budget
Oct 7, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix/release-sweep-cli-help-and-pip-budget

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request refines how command-line help flags are handled and improves test coverage for CLI argument parsing and package version resolution. The main changes include centralizing help flag detection, ensuring help requests are routed to the correct handler, and adding tests to verify this behavior. Additionally, it exposes and tests internals of the Pip package manager for robustness.

Command-line help handling improvements:

  • Centralized help flag detection with a new IsHelpRequest method in IpcCliSyntax, replacing scattered logic and supporting both --help and -h (case-insensitive) globally. HelpArguments is now an array for easier extension (src/Shared/SharedPreUiCommandDispatcher.cs, src/UniGetUI.Interface.IpcApi/IpcCliSyntax.cs). [1] [2] [3]
  • Updated CLI startup logic so that help requests always open the documentation URL and bypass other command handling, including when help is provided after a subcommand or as a value to a settings command (src/UniGetUI.Avalonia/Infrastructure/AvaloniaAppHost.cs). [1] [2] [3] [4]

Testing enhancements:

  • Added comprehensive tests for help flag handling, ensuring help is correctly detected, routed, and does not trigger unintended side effects (like creating files named --help) (src/UniGetUI.Tests/CLIHandlerTests.cs, src/UniGetUI.Tests/IpcCliSyntaxTests.cs). [1] [2]

Pip package manager improvements:

  • Made VersionResolution and ResolveLatestVersionAsync internal for better testability and added tests to ensure version resolution fails gracefully when the cancellation token is already cancelled, and remains robust under repeated failures (src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs, src/UniGetUI.PackageEngine.Tests/PipManagerTests.cs). [1] [2] [3] [4]

These changes improve maintainability, user experience, and reliability of command-line operations and package management.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Duplicate help-alias definitions undermine centralized detection and can reintroduce settings side effects when aliases evolve.

1 open finding
What changed in this PR

Refines global CLI help routing and fixes Pip’s cancellation-safe concurrency handling.

Changes:

  • Routes --help and -h through centralized CLI parsing.
  • Prevents settings commands from consuming help flags.
  • Avoids releasing unacquired Pip semaphore permits and adds regression tests.
File Description
src/​UniGetUI.Tests/​IpcCliSyntaxTests.cs Tests global help recognition and routing.
src/​UniGetUI.Tests/​CLIHandlerTests.cs Tests help precedence over settings commands.
src/​UniGetUI.PackageEngine.Tests/​PipManagerTests.cs Tests canceled version-resolution budgets.
src/​UniGetUI.PackageEngine.Managers.Pip/​Pip.cs Tracks semaphore acquisition before release.
src/​UniGetUI.Interface.IpcApi/​IpcCliSyntax.cs Adds reusable help-request detection.
src/​UniGetUI.Avalonia/​Infrastructure/​AvaloniaAppHost.cs Handles help according to console availability.
src/​Shared/​SharedPreUiCommandDispatcher.cs Defers help processing to the CLI layer.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The centralized help handling and semaphore cancellation fix are consistent and covered by focused regression tests.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "92014e30-c274-11f1-84f6-d99dc2912cdf",
	"headSha": "4d6d1b7f6bc7e7b326cef6fe8a5b191e3a447ac6",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit ce0589d into main Oct 7, 2026
6 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/release-sweep-cli-help-and-pip-budget branch October 7, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants