Repository navigation
[WSLC Compose 3/5] Migrate the CLI to service operations - #42213
David Bennett (dkbennett) merged 7 commits into
Conversation
03cdab5 to
ef41867
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved regressions in symlink resolution and cancellation handling can select the wrong Compose project or bind-mount directory and leave attachment streams running after the first Ctrl-C.
2 open issues
What changed in this PR
Migrates the WSLC Compose CLI to the synchronous service-operation API introduced in #42158, replacing cached sessions with service-owned interpretation and execution.
Changes:
- Routes five lifecycle commands through shared helpers that capture document contents, forward cancellation, and surface localized errors.
- Removes the legacy Compose session interface, implementation, cache, and COM registration.
- Updates tests for shared project identity, document encoding, command ordering, and CLI validation errors.
| File | Description |
|---|---|
test/windows/wslc/WSLCE2EComposeLifecycleTests.cpp |
Adds localized service-validation error coverage. |
test/windows/wslc/WSLCComposeTests.cpp |
Migrates encoding and project-identity tests to operations. |
test/windows/wslc/WSLCCLICommandUnitTests.cpp |
Updates expected subcommand ordering. |
src/windows/wslcsession/WSLCSession.h |
Removes cached Compose session declarations and state. |
src/windows/wslcsession/WSLCSession.cpp |
Removes legacy session creation and its helper overload. |
src/windows/wslcsession/WSLCComposeSession.h |
Deletes the legacy session class declaration. |
src/windows/wslcsession/WSLCComposeSession.cpp |
Deletes the legacy session implementation. |
src/windows/wslcsession/CMakeLists.txt |
Removes deleted session files from build inputs. |
src/windows/wslc/tasks/ComposeTasks.h |
Declares shared Compose tasks. |
src/windows/wslc/tasks/ComposeTasks.cpp |
Connects command context and cancellation to service helpers. |
src/windows/wslc/services/ComposeService.h |
Adds project references and cancellation-aware signatures. |
src/windows/wslc/services/ComposeService.cpp |
Captures inputs, executes operations, and attaches streams. |
src/windows/wslc/commands/ComposeUpCommand.cpp |
Extracts the up command into a dedicated file. |
src/windows/wslc/commands/ComposeStopCommand.cpp |
Extracts the stop command into a dedicated file. |
src/windows/wslc/commands/ComposeStartCommand.cpp |
Extracts the start command into a dedicated file. |
src/windows/wslc/commands/ComposeCreateCommand.cpp |
Extracts the create command into a dedicated file. |
src/windows/wslc/commands/ComposeCommand.h |
Reorders declarations and standardizes parameter names. |
src/windows/wslc/commands/ComposeCommand.cpp |
Retains root help and subcommand registration. |
src/windows/wslc/commands/ComposeAttachCommand.cpp |
Extracts the attach command into a dedicated file. |
src/windows/service/inc/wslc.idl |
Removes the legacy Compose session contract. |
msipackage/package.wix.in |
Removes legacy interface registration. |
Review effort: Balanced
ef41867 to
c7cbce9
Compare
c7cbce9 to
2acce3d
Compare
Capture documents in the caller context, invoke transient service operations through the CLI task pipeline, and wait for completion with cooperative cancellation. Retire the synchronous Compose interface, path-keyed session cache, registration, and compatibility creation overload. Reuse lifecycle E2E coverage to verify the migrated CLI. Validation: full Windows build; Compose tests 14/14; CLI tests 518/518; formatting, localization, and changed-source copyright checks passed. The tree exactly matches the unsplit compose-operations layer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 675962d7-8ad8-45ed-8c6c-a0cce4f3d8c4 Copilot-Session: 4bce7a09-be93-4627-b729-aaada0f63c66
Retain BaseDirectory capture, release owned error messages, and observe session process exit during execution and cancellation waits. Verify localized service validation failures reach the command output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4c14c899-3f8c-4862-aeac-8a6f0482b7b7
Pass the cancellation event to ExecuteComposeOperation and use its terminal result directly. Preserve localized operation errors and let native RPC report service-process failure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4c14c899-3f8c-4862-aeac-8a6f0482b7b7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4c14c899-3f8c-4862-aeac-8a6f0482b7b7
2acce3d to
9db3063
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Active issues leave long-running Compose attachments unresponsive to the first Ctrl-C and break canonical path resolution, potentially missing existing containers or mounting incorrect host directories.
2 open issues
Review effort: Balanced
Resolve Compose document symlinks before deriving project identity and relative volume paths. Add an end-to-end regression covering both behaviors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e0bc0749-e046-40d8-894d-59696c501291
ranm-msft
left a comment
There was a problem hiding this comment.
Canonical document paths and project identity stay intact through the service operation API, with lifecycle, encoding and symlink coverage. The remaining attachment Ctrl-C work is explicitly deferred to layer 5.
ranm-msft
left a comment
There was a problem hiding this comment.
Reviewed the CLI-to-service migration, captured document ownership, result cleanup, cancellation forwarding, and updated lifecycle tests. The current head preserves the five Compose commands; the previously discussed attach relay follow-ups remain separate.
Blue (OneBlue)
left a comment
There was a problem hiding this comment.
LGTM, feel free to address remaining comments in a followup
| HRESULT_FROM_WIN32(ERROR_READ_FAULT), | ||
| wsl::shared::Localization::MessageWslcComposeFileReadFailed(sourcePath.wstring()), | ||
| stream.gcount() != streamSize); | ||
| std::array<char, 4096> buffer{}; |
There was a problem hiding this comment.
nit: I recommend reading directly inside of content to avoid the additional copy + buffer here

Summary of the Pull Request
Migrates the Compose CLI from the POC cached-session model to the service-operation API introduced in #42158, connecting the existing commands to service-owned interpretation and execution.
PR Checklist
Detailed Description of the Pull Request / Additional comments
create,up,start,attach, andstopthrough the synchronousExecuteComposeOperationAPI.IWSLCComposeSessioninterface, cached file-path sessions, implementation, and COM registration.Validation Steps Performed
Compose tests pass after the migration.