Align wslc volume inspect and prune output with docker - #41404
Open
ggarzia-MSFT wants to merge 2 commits into
Open
Align wslc volume inspect and prune output with docker#41404ggarzia-MSFT wants to merge 2 commits into
ggarzia-MSFT wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns wslc volume inspect and volume prune output with Docker conventions.
Changes:
- Adds Docker-compatible inspect fields and serialization behavior.
- Updates prune formatting, spacing, headers, and size precision.
- Renames and parameterizes human-readable size formatting.
- Expands unit and end-to-end test coverage.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Summary | Final review |
|---|---|---|
test/windows/WSLCTests.cpp |
Updates volume inspect assertions. | No final comments. |
test/windows/wslc/e2e/WSLCE2EVolumePruneTests.cpp |
Verifies updated prune output and spacing. | No final comments. |
test/windows/wslc/e2e/WSLCE2EVolumeInspectTests.cpp |
Adds full inspect payload coverage. | No final comments. |
test/windows/wslc/e2e/WSLCE2EVolumeCreateTests.cpp |
Handles optional labels. | No final comments. |
test/windows/wslc/e2e/WSLCE2EContainerRemoveTests.cpp |
Handles optional volume labels. | No final comments. |
test/windows/StringUnitTests.cpp |
Tests formatter precision behavior. | No final comments. |
src/windows/wslcsession/WSLCVolumeMetadata.h |
Defines local volume scope. | No final comments. |
src/windows/wslcsession/WSLCVhdVolume.h |
Supports VHD volume mountpoints. | No final comments. |
src/windows/wslcsession/WSLCVhdVolume.cpp |
Plumbs VHD mountpoints and inspect fields. | No final comments. |
src/windows/wslcsession/WSLCGuestVolume.h |
Supports guest volume mountpoints. | No final comments. |
src/windows/wslcsession/WSLCGuestVolume.cpp |
Plumbs guest volume mountpoints. | Critical (2 votes): Wrap the constructor call at line 112 to satisfy the 130-column formatting limit. |
src/windows/wslc/tasks/VolumeTasks.cpp |
Implements Docker-style prune output. | Critical (2 votes): Wrap the output call at line 229 to satisfy clang-format verification while retaining precision-4 formatting. |
src/windows/wslc/tasks/ImageTasks.cpp |
Uses the renamed size formatter. | No final comments. |
src/windows/inc/wslc_schema.h |
Adds inspect fields and custom JSON serialization. | Critical (1 vote): Wrap the macro invocation at line 244 to satisfy the 130-column formatting limit. |
src/windows/common/string.hpp |
Adds configurable formatter precision. | No final comments. |
src/windows/common/string.cpp |
Implements precision-aware size formatting. | No final comments. |
localization/strings/en-US/Resources.resw |
Adds the deleted-volumes header resource. | No final comments. |
Suppressed comments (1)
src/windows/inc/wslc_schema.h:241
- The new serializer's non-empty Status branch is only exercised by VHD volumes, but the added inspect test covers a guest volume and the updated VHD test checks Options/Mountpoint without checking Status. A regression here could silently drop HostPath, SizeBytes, or recovery Error from VHD inspect output; add coverage for the emitted VHD status (and the recovery-error case if practical).
if (volume.Status.has_value() && !volume.Status->empty())
{
j["Status"] = *volume.Status;
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ggarzia-MSFT
marked this pull request as ready for review
August 20, 2026 23:21
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Blue (OneBlue)
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Brings
wslc volume inspectandwslc volume pruneoutput in line with the equivalent docker commands, continuing the CLI output parity work started for the network commands.PR Checklist
Detailed Description of the Pull Request / Additional comments
volume inspectThe inspect payload was missing fields that docker always reports, and rendered absent maps as empty objects rather than
null.Mountpoint, sourced from the mountpoint docker reports for the volume, and plumbed through both the guest and VHD volume implementations on their create and open paths.Scope, which is alwayslocal— every WSLC volume is machine level. The constant lives alongside the existing driver-name constants inWSLCVolumeMetadata.h.LabelsandOptionsare nowstd::optionaland serialize asnullwhen absent instead of{}.Statusis omitted entirely when the driver reports nothing. VHD volumes continue to populate it withHostPath,SizeBytesand, on a recovery failure,Error.DriverOptstoOptionson the read path. These are the same data under a read/write naming split —DriverOptsis the create-request spelling and remains unchanged,Optionsis the inspect spelling.InspectVolumenow uses an explicitto_jsonrather than the nlohmann macro, following the existingIPAMConfigconvention in the same header, since the null-vs-empty and omit-when-empty behaviour cannot be expressed through the macro.volume pruneDeleted Volumes:header as bare names, replacing the per-lineDeleted: <name>form. This matches the header already used bynetwork prune.12.29kB) rather than a two-decimal-place value with a space (12.29 KB).WSLCCLI_VolumePruneDeletedis replaced byWSLCCLI_VolumePruneDeletedHeader; only theen-USresources are touched.FormatDockerSizeRenamed to
FormatHumanReadableSizeand given aPrecisionparameter defaulting to 3. Image sizes keep precision 3; the prune reclaimed-space total uses 4. The only other caller,ImageTasks.cpp, is unaffected behaviourally.Validation Steps Performed
cmake --build .completes with no errors.WSLCE2E_Volume_Inspect_ReportsFullFieldSet, asserting the exact seven-key inspect payload, thatLabelsandOptionsarenull, thatScopeislocal, thatMountpointis non-empty, and thatStatusis absent.FormatHumanReadableSize_SupportsReclaimedSpacePrecisioncovering the precision-4 cases, and renamed the existing precision-3 test.volume prunee2e tests for the new header, bare names, and conditional blank line, including an exact-output assertion that a prune with nothing to delete emits only the reclaimed-space line.WSLCTests.cppvolume inspect coverage forOptions,ScopeandMountpoint, and the volume-create and container-remove e2e tests for the optionalLabels.