Skip to content

Add wslc system info command - #41408

Open
beena352 wants to merge 4 commits into
microsoft:masterfrom
beena352:users/beenachauhan/system-info-command
Open

Add wslc system info command#41408
beena352 wants to merge 4 commits into
microsoft:masterfrom
beena352:users/beenachauhan/system-info-command

Conversation

@beena352

@beena352 beena352 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

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

  • Closes: Link to issue wslc: support wslc system info #41282
  • 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

What it shows:

  • Client block: package version, kernel, direct3d, dxcore, and Windows version, plus the settings file path. Dev builds also show the compiler version, commit hash, and build time
  • Server block: session manager version and the list of active sessions (reuses the same table as session list)
    Design choices:
  • No VM boot. The command only calls IWSLCSessionManager::GetVersion and ListSessions, which don't take a lease. This is the same pattern as session list
  • --format json builds the full document before writing, so a service failure fails the whole command. Both table and JSON modes query the service first. A stopped service fails the whole command cleanly with no partial output.
  • The session table is hidden when there are no sessions (no empty header row). session list keeps showing the header - that's intentional, they serve different purposes
  • The WriteSessionTable helper is shared between ListSessions and ShowSystemInfo in SessionTasks.cpp, which is why there's no separate SystemTasks file
  • JSON session entries use "ID" (not "Id") to match the convention in ContainerTasks and NetworkTasks.

What this doesn't do:

  • No Docker engine version or container runtime info. That would need a running VM and HTTP client plumbing-separate work
  • --session is a global argument and is silently accepted. This matches how other non-session commands behave.

Validation Steps Performed

  • Ran wslc system info and wslc info with 0 and 1 active sessions - output is correct in both cases
  • Ran wslc system info --format json and verified valid JSON with Client and Server sections, correct key casing ("ID", not "Id")
  • Ran wslc system info --format invalid - clean error message, exit code 1, nothing on stdout
  • CLI parse tests: 12 new cases for system info and info with valid/invalid args
  • Structural unit tests: 5 new tests covering command name, subcommands, format argument, and registration under both system and root
  • E2E tests: 5 new tests (table output, invalid format, JSON validation with key assertions, root alias equivalence, does-not-create-session check)
  • Terminal unit test: 1 new test for Flush - verified it goes red when Flush is stubbed out, green with the real implementation

Copilot AI lite review requested due to automatic review settings August 21, 2026 07:22

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.

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.

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

@beena352
beena352 marked this pull request as ready for review August 21, 2026 17:05
@beena352
beena352 requested review from a team as code owners August 21, 2026 17:05
@beena352
beena352 requested a lite review from Copilot August 21, 2026 17:05

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

@beena352
beena352 marked this pull request as draft August 21, 2026 17:25
@beena352
beena352 requested a lite review from Copilot August 21, 2026 17:37

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.

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 verifies Sessions: 0 is 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 because system already contains an info child. That means it does not pin the second registration as the comment claims; also check the command's FullName() (for example, root:info) or count the registrations.
            if (subcmd->Name() == SystemInfoCommand::CommandName)

@beena352
beena352 marked this pull request as ready for review August 21, 2026 17:45
Comment thread src/windows/wslc/tasks/SessionTasks.cpp Outdated
Copilot AI review requested due to automatic review settings August 24, 2026 18:34

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.

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.cpp already supplies WSLG_VERSION and MSRDC_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-format limit 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 (and WSLCCLI_SystemInfoVersions omits 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"));

Comment thread src/windows/wslc/commands/SystemCommand.cpp Outdated
Comment thread src/windows/wslc/tasks/SessionTasks.cpp Outdated
Copilot AI review requested due to automatic review settings August 28, 2026 20:37

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.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Comment thread src/windows/wslc/tasks/SessionTasks.cpp
Copilot AI review requested due to automatic review settings August 28, 2026 21:27

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.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

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.

4 participants