Skip to content

wslc: add --size to inspect for docker parity - #41489

Open
ggarzia-MSFT wants to merge 6 commits into
masterfrom
user/ggarzia/wslc-inspect-size
Open

wslc: add --size to inspect for docker parity#41489
ggarzia-MSFT wants to merge 6 commits into
masterfrom
user/ggarzia/wslc-inspect-size

Conversation

@ggarzia-MSFT

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Adds the --size / -s flag to wslc inspect and wslc container inspect for Docker CLI parity. When specified, the container inspect output gains the SizeRw and SizeRootFs fields reported by the Docker Engine API.

Docker also prints WARNING: --size ignored for <type> to stderr when --size is used against a non-container object and still inspects the object. That behavior is mirrored here for image, network, and volume inspect via the root wslc inspect command. The type-specific wslc image inspect / network inspect / volume inspect subcommands do not register --size at all, so passing it there is a parse error.

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

Fields are omitted, not null, when --size is absent

Docker only emits SizeRw / SizeRootFs when --size is passed. To match that — and to avoid changing the shape of the default wslc inspect output — the schema fields are std::optional<std::int64_t> and a new wslc_schema::ToInspectJson(const InspectContainer&) helper erases the keys when they are nullopt. NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT serializes an empty optional as null rather than omitting it, hence the explicit helper.

Plumbing

  • ArgumentDefinitions.h — new ArgType::Size (--size, alias s).
  • docker_schema.h / wslc_schema.hInspectContainer gains the two optional fields.
  • DockerHTTPClient::InspectContainer(Id, Size) — forwards size as a query parameter to the Engine API.
  • wslc.idlIWSLCContainer::Inspect gains an [in] BOOL Size parameter. This is an internal, non-stable interface rebuilt in lockstep with its clients. The ABI-frozen IWSLCCompatContainer::Inspect is unchanged; WSLCContainer now provides a separate compat overload that forwards with Size = FALSE.
  • ContainerService::Inspect(session, id, size) and the inspect / container inspect tasks read the flag.

Tests

  • 15 command-line parser cases, including assertions that image inspect --size, network inspect --size, and volume inspect --size are rejected.
  • InspectCommands_HaveSizeArgumentWithDockerAlias unit test covering all five inspect commands.
  • E2E: WSLCE2E_Container_Inspect_SizeOption, WSLCE2E_Container_Inspect_SizeListedInHelp, WSLCE2E_Inspect_SizeIgnoredForNonContainerTypes.

Validation Steps Performed

Full cmake --build . succeeds. Automated coverage above; CI runs the test suite.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 31, 2026 18:42

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 Docker parity support for --size / -s on wslc inspect and wslc container inspect, plumbing the flag through CLI parsing → service/COM → Docker Engine API, and ensuring the size fields are omitted (not null) when --size isn’t provided.

Changes:

  • Introduces ArgType::Size and wires --size/-s into root inspect and container inspect, including Docker-like warnings when used on non-container types via wslc inspect.
  • Extends container inspect schema (SizeRw, SizeRootFs) as std::optional<int64_t> and adds wslc_schema::ToInspectJson() to omit keys when absent.
  • Updates internal container inspect plumbing (IDL + session/container + HTTP client query param) and adds/updates unit + E2E coverage.

Reviewed changes

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

Show a summary per file
File Description
test/windows/WSLCTests.cpp Updates COM Inspect call site for new Size parameter.
test/windows/wslc/WSLCCLICommandUnitTests.cpp Adds unit coverage ensuring --size/-s is present only on the intended inspect commands.
test/windows/wslc/e2e/WSLCE2EInspectTests.cpp Adds E2E coverage for --size warning behavior on non-container types.
test/windows/wslc/e2e/WSLCE2EContainerInspectTests.cpp Adds E2E coverage for presence/absence of SizeRw/SizeRootFs and help text.
test/windows/wslc/CommandLineTestCases.h Adds parser test cases for --size support and rejection on type-specific inspect subcommands.
src/windows/wslcsession/WSLCContainer.h Extends container inspect APIs to accept a Size flag and adds compat overload.
src/windows/wslcsession/WSLCContainer.cpp Plumbs Size through to Docker inspect and maps returned size fields into WSLC schema.
src/windows/wslcsession/DockerHTTPClient.h Extends InspectContainer signature to accept Size.
src/windows/wslcsession/DockerHTTPClient.cpp Adds size query parameter forwarding to Docker Engine API.
src/windows/wslc/tasks/InspectTasks.cpp Adds --size handling, warning behavior, and JSON emission with omitted size keys when absent.
src/windows/wslc/tasks/ContainerTasks.cpp Adds --size handling for container inspect and emits JSON via ToInspectJson.
src/windows/wslc/services/ContainerService.h Extends Inspect service API to accept size.
src/windows/wslc/services/ContainerService.cpp Passes size to COM IWSLCContainer::Inspect.
src/windows/wslc/commands/InspectCommand.cpp Registers --size on root inspect.
src/windows/wslc/commands/ContainerInspectCommand.cpp Registers --size on container inspect.
src/windows/wslc/arguments/ArgumentDefinitions.h Adds ArgType::Size (--size, alias -s) with localized description.
src/windows/service/inc/wslc.idl Updates internal IWSLCContainer::Inspect to include [in] BOOL Size.
src/windows/inc/wslc_schema.h Adds optional size fields and ToInspectJson() helper to omit absent size keys.
src/windows/inc/docker_schema.h Extends Docker inspect schema to deserialize optional size fields.
src/windows/common/WSLCContainerLauncher.cpp Updates internal inspect call site to pass FALSE for Size.
localization/strings/en-US/Resources.resw Adds localized strings for --size description and ignored warning.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread localization/strings/en-US/Resources.resw Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 31, 2026 20:10

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 20 out of 20 changed files in this pull request and generated no new comments.

Suppressed comments (1)

localization/strings/en-US/Resources.resw:3319

  • The RESW for this new string does not follow the required token order/content produced by tools/devops/validate-localization.py (it expects {FixedPlaceholder="{}"} first, then {Locked="..."}, then the canonical sentence). As written, localization validation is likely to flag this entry.
    <comment>{Locked="--size"}{FixedPlaceholder="{}"}Command line arguments and string inserts should not be translated</comment>

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 31, 2026 20:30

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 20 out of 20 changed files in this pull request and generated no new comments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 31, 2026 21:03

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 20 out of 20 changed files in this pull request and generated no new comments.

ggarzia-MSFT and others added 2 commits September 1, 2026 13:14
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 2, 2026 01: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.

🟡 Changes recommended

The Docker Engine size query parameter is currently sent even when false, which is unnecessary and slightly undermines the PR’s stated Docker parity goal.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 20/20 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/windows/wslcsession/DockerHTTPClient.cpp
@ggarzia-MSFT
ggarzia-MSFT marked this pull request as ready for review September 2, 2026 20:52
@ggarzia-MSFT
ggarzia-MSFT requested review from a team as code owners September 2, 2026 20:52
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.

3 participants