Add wslc system info command - #41408
Conversation
There was a problem hiding this comment.
Pull request overview
Adds wslc system info and the top-level wslc info alias, providing client, server, and session details in table or JSON formats.
Changes:
- Added system information command and session-manager version retrieval.
- Added localized output and terminal flushing.
- Added parser, unit, and end-to-end test coverage.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
test/windows/wslc/WSLCCLITerminalUnitTests.cpp |
Tests terminal output flushing. |
test/windows/wslc/WSLCCLICommandUnitTests.cpp |
Tests command structure and registration. |
test/windows/wslc/e2e/WSLCE2EGlobalTests.cpp |
Tests table, JSON, alias, and session behavior. |
test/windows/wslc/CommandLineTestCases.h |
Adds command-line parser cases. |
src/windows/wslc/tasks/SessionTasks.h |
Declares system information task support. |
src/windows/wslc/tasks/SessionTasks.cpp |
Implements system information output. |
src/windows/wslc/services/SessionService.h |
Declares session-manager version retrieval. |
src/windows/wslc/services/SessionService.cpp |
Retrieves the session-manager version. |
src/windows/wslc/core/Terminal.h |
Declares terminal output flushing. |
src/windows/wslc/core/Terminal.cpp |
Implements terminal output flushing. |
src/windows/wslc/commands/SystemCommand.h |
Defines the system information command interface. |
src/windows/wslc/commands/SystemCommand.cpp |
Implements the system information command. |
src/windows/wslc/commands/RootCommand.cpp |
Registers the top-level info alias. |
localization/strings/en-US/Resources.resw |
Adds localized system information strings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/windows/wslc/tasks/SessionTasks.cpp:177
- The new
sessions.empty()branch changes the table contract by suppressing the session-table header, but the E2E additions do not assert this zero-session case: the table test only checks section/version strings and the session state is environment-dependent. Add a deterministic zero-session test that verifiesSessions: 0is present while the session-table ID header is absent.
if (!sessions.empty())
{
WriteSessionTable(context.Terminal, sessions);
}
test/windows/wslc/WSLCCLICommandUnitTests.cpp:261
- This unit test searches only by
Name(), so it also passes if the root-level registration is removed becausesystemalready contains aninfochild. That means it does not pin the second registration as the comment claims; also check the command'sFullName()(for example,root:info) or count the registrations.
if (subcmd->Name() == SystemInfoCommand::CommandName)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
Suppressed comments (3)
Previously missed (1) — in code that hasn't changed since the last review.
src/windows/wslc/tasks/SessionTasks.cpp:124
- The PR description says the client block mirrors
wsl --version, including WSLg and MSRDC versions, but this implementation omits both fields in JSON and the corresponding table/localization output (the tests even require them to be absent).WslClient.cppalready suppliesWSLG_VERSIONandMSRDC_VERSION; please either add those values consistently to both formats or update the PR description/requirements before merging.
client["Version"] = std::string{WSL_PACKAGE_VERSION};
client["KernelVersion"] = std::string{KERNEL_VERSION};
client["Direct3DVersion"] = std::string{DIRECT3D_VERSION};
client["DxCoreVersion"] = std::string{DXCORE_VERSION};
src/windows/wslc/tasks/SessionTasks.cpp:152
- This newly added invocation exceeds the repository's 130-column
.clang-formatlimit and can be wrapped without changing behavior, so source-format verification will flag it. Please run the formatter on this call before merging.
L"{}\n", Localization::WSLCCLI_SystemInfoVersions(WSL_PACKAGE_VERSION, KERNEL_VERSION, DIRECT3D_VERSION, DXCORE_VERSION, windowsVersion));
test/windows/wslc/e2e/WSLCE2EGlobalTests.cpp:244
- The PR description says this command reports the same client versions as
wsl --version, including WSLg and MSRDC, but this assertion deliberately requires both fields to be absent (andWSLCCLI_SystemInfoVersionsomits them too). Please either add those values to both output formats or update the command contract/description before merging.
// WSLg and MSRDC aren't relevant to wslc.
VERIFY_IS_FALSE(client.contains("WslgVersion"));
VERIFY_IS_FALSE(client.contains("MsrdcVersion"));
Summary of the Pull Request
Adds wslc system info (and wslc info as a root alias) that shows client version details and session manager state in both table and JSON formats. The command does not start a VM, it queries the session manager service the same way session list does.
PR Checklist
Detailed Description of the Pull Request / Additional comments
What it shows:
Design choices:
What this doesn't do:
Validation Steps Performed