Skip to content

[WSLC Compose 4/5] Add project listing and lifecycle management - #42292

Draft
David Bennett (dkbennett) wants to merge 3 commits into
feature/composefrom
user/dkbennett/compose-management
Draft

David Bennett (dkbennett) wants to merge 3 commits into
feature/composefrom
user/dkbennett/compose-management

Conversation

@dkbennett

@dkbennett David Bennett (dkbennett) commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary of the Pull Request

Add Compose project listing and lifecycle management by project name or Compose file. This is layer 4 of 5, based on #42213 and extending Compose stack 42214.

PR Checklist

  • Closes: No linked issue.
  • 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: No documentation PR.

Detailed Description of the Pull Request / Additional comments

  • Add compose list / ls with table, JSON, quiet, and all-project output. Discover projects from WSLC Compose labels, aggregate container state counts, and exclude unsupported metadata versions.
  • Allow start, attach, stop, and remove to accept either a Compose file or an existing normalized project name. Existing projects remain manageable after their source file is removed.
  • Add compose remove with rm and delete aliases. Remove only created or exited containers, preserve running containers and project networks, and report when no stopped containers are found.
  • Extend the internal session contract with project listing and the remove action. Use context-free concrete container wrappers for removal, including cached deletion-state verification after disconnection.
  • Add command, service, and end-to-end coverage for listing formats, aliases, metadata filtering, project-name lifecycle operations, and mixed running/stopped removal.

Interactive cancellation, resource-progress rendering, and service stream handoff remain in layer 5 and are not part of this diff.

Validation covers the combined layers 4 and 5 at 454920dca; this PR's exact layer-4 head, 390e680be, has not been independently tested.

Validation Steps Performed

  • .\bin\x64\Debug\test.bat '/name:*Compose*': 56 run; 55 passed, 1 failed.
  • .\bin\x64\Debug\test.bat '/name:WSLCComposeTests::ComposeSessionBasicLifecycle': 1 run; 1 passed (retry).

Base automatically changed from user/dkbennett/compose-operation-client to feature/compose November 20, 2026 18:54
Add list/ls output, resolve lifecycle arguments by file or project key, and remove only stopped project containers. Cover listing, project-key lifecycle, aliases, and removal across service and end-to-end tests.

Validation: full Windows build; Compose tests 16/16; CLI tests 518/518; formatting and localization checks passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4bce7a09-be93-4627-b729-aaada0f63c66
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4c14c899-3f8c-4862-aeac-8a6f0482b7b7
Use concrete container wrappers for project removal and retain the current execution context. Verify cached deletion state when a wrapper disconnects.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e0bc0749-e046-40d8-894d-59696c501291
@dkbennett
David Bennett (dkbennett) force-pushed the user/dkbennett/compose-management branch from 390e680 to f56865e Compare November 20, 2026 18:54
Copilot AI balanced review requested due to automatic review settings November 20, 2026 18:54

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 issues leave table state labels unlocalized, hide exited containers in mixed-state project summaries, and cause the final removal test to verify the wrong container.

3 open issues
What changed in this PR

This fourth Compose layer extends the service-backed CLI with project discovery and lifecycle management by project name, allowing existing projects to remain manageable after their Compose files are removed.

Changes:

  • Add compose list / ls with table, JSON, quiet, and all-project output.
  • Support project-name lifecycle commands and add remove / rm / delete for stopped containers, preserving running containers and networks.
  • Extend the internal session contract, localized messages, and command, service, and end-to-end coverage.
File Description
test/​windows/​wslc/​WSLCE2EComposeRemoveTests.cpp Test removal aliases and running-container preservation.
test/​windows/​wslc/​WSLCE2EComposeListTests.cpp Test listing formats and metadata filtering.
test/​windows/​wslc/​WSLCE2EComposeLifecycleTests.cpp Test lifecycle operations after source-file removal.
test/​windows/​wslc/​WSLCE2EComposeHelpers.h Add shared project-status assertions.
test/​windows/​wslc/​WSLCComposeTests.cpp Cover mixed-state removal and progress reporting.
test/​windows/​wslc/​WSLCCLIExecutionUnitTests.cpp Cover project-list execution data.
test/​windows/​wslc/​WSLCCLICommandUnitTests.cpp Verify commands, aliases, and argument types.
src/​windows/​wslcsession/​WSLCSession.h Declare project listing.
src/​windows/​wslcsession/​WSLCSession.cpp Discover labeled projects and aggregate container states.
src/​windows/​wslcsession/​WSLCComposeOperation.cpp Accept the remove action.
src/​windows/​wslcsession/​ComposeReconciler.h Declare stopped-container removal.
src/​windows/​wslcsession/​ComposeReconciler.cpp Remove eligible containers and verify deletion state.
src/​windows/​wslc/​tasks/​ComposeTasks.h Declare listing and removal tasks.
src/​windows/​wslc/​tasks/​ComposeTasks.cpp Resolve files or project names and render listings.
src/​windows/​wslc/​services/​ComposeService.h Expose listing and removal helpers.
src/​windows/​wslc/​services/​ComposeService.cpp Format project summaries and invoke removal.
src/​windows/​wslc/​services/​ComposeModel.h Define the project-list output model.
src/​windows/​wslc/​core/​ExecutionContextData.h Store project summaries in execution context.
src/​windows/​wslc/​commands/​ComposeStopCommand.cpp Accept a project name or file.
src/​windows/​wslc/​commands/​ComposeStartCommand.cpp Accept a project name or file.
src/​windows/​wslc/​commands/​ComposeRemoveCommand.cpp Implement the remove command.
src/​windows/​wslc/​commands/​ComposeListCommand.cpp Implement listing options and task flow.
src/​windows/​wslc/​commands/​ComposeCommand.h Declare new commands and aliases.
src/​windows/​wslc/​commands/​ComposeCommand.cpp Register list and remove commands.
src/​windows/​wslc/​commands/​ComposeAttachCommand.cpp Accept a project name or file.
src/​windows/​wslc/​arguments/​ArgumentDefinitions.h Define the project positional argument.
src/​windows/​service/​inc/​wslc.idl Extend the internal contract for listing and removal.
localization/​strings/​en-US/​Resources.resw Add help and error strings; update project terminology.

Review effort: Balanced

table.Reserve(projects.size());
for (const auto& project : projects)
{
table.AddRow({wsl::shared::string::MultiByteToWide(project.Name), wsl::shared::string::MultiByteToWide(project.Status)});
std::vector<docker_schema::ContainerInfo> containers;
try
{
containers = m_runtime.Docker().ListContainers(options->All, -1, filters);
VERIFY_ARE_EQUAL(std::vector<std::string>({"container:remove:wslc-compose-secondary:1/1"}), removeProgress->ProgressDescriptions());

wil::com_ptr<IWSLCContainer> removedContainer;
VERIFY_ARE_EQUAL(WSLC_E_CONTAINER_NOT_FOUND, m_defaultSession->OpenContainer("wslc-compose-basic", &removedContainer));

This branch has not been deployed

No deployments
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.

2 participants