Skip to content

Comments

Converge Container Start/Stop/Run/Create into CLI model#14240

Open
dkbennett wants to merge 17 commits intofeature/wsl-for-appsfrom
user/dkbennett/converge2
Open

Converge Container Start/Stop/Run/Create into CLI model#14240
dkbennett wants to merge 17 commits intofeature/wsl-for-appsfrom
user/dkbennett/converge2

Conversation

@dkbennett
Copy link
Member

@dkbennett dkbennett commented Feb 20, 2026

Summary of the Pull Request

Porting over Create, Run, Stop, and Start container commands.
Added an argument validator for a common type (unint) for time and signal.
Added support for infinite limit on multi-input arguments.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

  • Migrated container commands Start, Stop, Create, and Run to the new model. The functionality of these should not be any different beyond extra argument validation.
  • All arguments for these commands were added per the spec, many are not implemented but will get fleshed out over time and adjusted as needed.
  • Added support for common argument validation, with unsigned integer being the first common validator added for --signal and --time arguments. This allows the commands to not duplicate validation logic and they can assume all relevant validation of the arguments has happened prior to execution. This also allows us to bubble up argument errors before starting execution flows and show the help.
  • Added support for infinite values provided on arguments. A "NO_LIMIT" macro was added to represent this (-1 integer on limit). Updated tests and existing arguments as appropriate.
  • Added CMake Unity build option to the wslc as a potential optimization in the future. It is not active and commented out. It's there for testing and finding what breaks when unity is enabled. We plan on using some form of Unity build at least for commands for full builds so we can have the performance benefit of large compilation units but have the incremental and maintainability value of more files.
  • The PullImageProgress class and file was created from the previous ImageCommand.cpp. It is not new code, just refactored. It may show up in the diff as different but it was not changed from its previous form.

Validation Steps Performed

  • Unit tests added for command line validation and arguments.
  • Manual validation for the commands themselves. Encountered some problems but the same problems were also happening with wsladiag so I do not believe these are regressions due to the migration to the new model. In any case these commands are still WIP and this update just opens the way to more iteration on them.

@dkbennett dkbennett changed the title User/dkbennett/converge2 Converge Container Start/Stop/Run/Create into CLI model Feb 20, 2026
@dkbennett dkbennett marked this pull request as ready for review February 20, 2026 22:50
@dkbennett dkbennett requested a review from a team as a code owner February 20, 2026 22:50
Copilot AI review requested due to automatic review settings February 20, 2026 22:50
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 pull request converges the container Start, Stop, Run, and Create commands into the new CLI model, introducing unified argument handling, validation infrastructure, and support for unlimited multi-value arguments. The changes establish patterns for common argument validation and extend the CLI framework to handle more complex command scenarios.

Changes:

  • Migrated four container commands (Start, Stop, Create, Run) to the new CLI model with full argument definitions
  • Added common argument validation framework with unsigned integer validator for time and signal arguments
  • Introduced NO_LIMIT macro (-1) to support unlimited argument values for multi-value arguments like --env and --publish

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/windows/wslc/arguments/Argument.h Added NO_LIMIT macro and Validate method declaration
src/windows/wslc/arguments/ArgumentDefinitions.h Added 25+ new argument definitions for container commands
src/windows/wslc/arguments/ArgumentValidation.h New header for centralized argument validation functions
src/windows/wslc/arguments/ArgumentValidation.cpp Implements ValidateUInteger and Argument::Validate dispatcher
src/windows/wslc/arguments/ArgumentParser.cpp Updated to handle NO_LIMIT in positional argument anchoring; replaced THROW_HR with WI_ASSERT for internal checks
src/windows/wslc/core/Command.cpp Added validation call integration and NO_LIMIT check in limit enforcement
src/windows/wslc/commands/ContainerCommand.h Added declarations for Create, Run, Start, and Stop command classes
src/windows/wslc/commands/ContainerCommand.cpp Registered new commands as subcommands
src/windows/wslc/commands/ContainerCreateCommand.cpp Implements container create command with argument definitions and task chain
src/windows/wslc/commands/ContainerRunCommand.cpp Implements container run command with detach support and full argument set
src/windows/wslc/commands/ContainerStartCommand.cpp Implements container start command with attach and interactive options
src/windows/wslc/commands/ContainerStopCommand.cpp Implements container stop command with signal/timeout support and --all flag
src/windows/wslc/commands/RootCommand.cpp Registered new commands at root level for direct invocation
src/windows/wslc/tasks/ContainerTasks.h Added task function declarations for new commands
src/windows/wslc/tasks/ContainerTasks.cpp Implements tasks with shared helper for common container options
src/windows/wslc/services/PullImageCallback.h New progress callback for image pull operations with terminal control
src/windows/wslc/services/PullImageCallback.cpp Implements multi-line progress display with ANSI escape codes
src/windows/wslc/services/ContainerModel.h Added includes for unordered_map and string
src/windows/wslc/core/ExecutionContextData.h Added CreateContainerOptions and RunContainerOptions data mappings
src/windows/wslc/CMakeLists.txt Added new source files and (commented) unity build configuration
test/windows/wslc/WSLCCLIParserUnitTests.cpp Refactored to use string::Join utility
test/windows/wslc/WSLCCLIExecutionUnitTests.cpp Added mock handlers for new option types
test/windows/wslc/ParserTestCases.h Added validation test cases and updated NO_LIMIT usage
test/windows/wslc/CommandLineTestCases.h Added test cases for all new commands

@dkbennett dkbennett requested a review from OneBlue February 23, 2026 19: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

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

Copy link
Collaborator

@OneBlue OneBlue left a comment

Choose a reason for hiding this comment

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

Change looks good. I still think that we avoid parsing non-string command line arguments twice, but that's not worth blocking the change over.

Let's merge this and re-evaluate once we have most the API surface implemented & test coverage

@dkbennett dkbennett enabled auto-merge (squash) February 24, 2026 20:28
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.

3 participants