Skip to content

[WSLC Compose 3/5] Migrate the CLI to service operations - #42213

Merged
David Bennett (dkbennett) merged 7 commits into
feature/composefrom
user/dkbennett/compose-operation-client
Nov 20, 2026
Merged

David Bennett (dkbennett) merged 7 commits into
feature/composefrom
user/dkbennett/compose-operation-client

Conversation

@dkbennett

Copy link
Copy Markdown
Member

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

  • 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

  • Route create, up, start, attach, and stop through the synchronous ExecuteComposeOperation API.
  • Capture Compose file contents and path context in the CLI for service-side interpretation and execution.
  • Pass caller cancellation to the service and surface localized operation errors.
  • Split command implementations into dedicated files with shared task and service helpers.
  • Remove the legacy IWSLCComposeSession interface, cached file-path sessions, implementation, and COM registration.
  • Update coverage for lifecycle commands, shared normalized project identity, document encoding, and CLI error reporting.

Validation Steps Performed

Compose tests pass after the migration.

@dkbennett
David Bennett (dkbennett) force-pushed the user/dkbennett/compose-operation-client branch from 03cdab5 to ef41867 Compare November 10, 2026 23:18
Copilot AI balanced review requested due to automatic review settings November 10, 2026 23:18

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

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

@dkbennett
David Bennett (dkbennett) force-pushed the user/dkbennett/compose-operation-client branch from ef41867 to c7cbce9 Compare November 12, 2026 22:33
Copilot AI balanced review requested due to automatic review settings November 12, 2026 22:33

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.

🔵 Needs a closer look

Unresolved regressions cause attached Compose commands to ignore the first Ctrl-C and linked Compose files to use different project identities and relative bind-mount locations.

2 open issues

Review effort: Balanced

Base automatically changed from user/dkbennett/compose-operation-engine to feature/compose November 12, 2026 23:25
@OneBlue
Blue (OneBlue) force-pushed the user/dkbennett/compose-operation-client branch from c7cbce9 to 2acce3d Compare November 12, 2026 23:25
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
@dkbennett
David Bennett (dkbennett) force-pushed the user/dkbennett/compose-operation-client branch from 2acce3d to 9db3063 Compare November 13, 2026 21:11
Copilot AI balanced review requested due to automatic review settings November 13, 2026 21:11

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.

🔵 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
Copilot AI balanced review requested due to automatic review settings November 13, 2026 21:51

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

No active review issues are reported for the migration to the service-operation API.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@ggarzia-MSFT ggarzia-MSFT 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.

lgtm

@ranm-msft ranm-msft 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.

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.

Copilot AI balanced review requested due to automatic review settings November 17, 2026 20:11

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

No active review issues were identified for the migration to command-scoped Compose operations.

No open issues 🎉

Review effort: Balanced

@ranm-msft ranm-msft 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.

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.

@OneBlue Blue (OneBlue) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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{};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I recommend reading directly inside of content to avoid the additional copy + buffer here

@dkbennett
David Bennett (dkbennett) merged commit d4a1a3d into feature/compose Nov 20, 2026
15 checks passed
@dkbennett
David Bennett (dkbennett) deleted the user/dkbennett/compose-operation-client branch November 20, 2026 18:54
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.

5 participants