wslc: align docker_schema with bundled dockerd v25.0.3 (API v1.44)#40552
Open
benhillis wants to merge 2 commits into
Open
wslc: align docker_schema with bundled dockerd v25.0.3 (API v1.44)#40552benhillis wants to merge 2 commits into
benhillis wants to merge 2 commits into
Conversation
WSLC talks to a bundled dockerd v25.0.3 (Docker API v1.44). Several entries in docker_schema.h drifted toward documented-but-not-shipped types or were defensive in the wrong way. None of these are observable user-facing bugs on a stock daemon today, but each is a latent crash or misbehavior waiting on the right wire payload from a third-party driver, future daemon, or TTY exec. Authoritative source: https://github.com/moby/moby/tree/v25.0.3/api Schema fixes: * ContainerState enum: prepend {Unknown, nullptr} so an unrecognized state string from the daemon falls back to Unknown rather than silently decoding as the first map entry (Created). * HostConfig.ShmSize: change std::optional<ULONGLONG> -> std::int64_t. Docker's wire type is signed int64 and 0 already means "use daemon default", so the optional indirection added nothing. * Volume.Status: change optional<map<string,string>> -> optional<map<string, nlohmann::json>>. Docker's wire schema is map[string]any; third-party volume drivers may publish numbers, bools, or nested objects which would currently throw type_error during deserialize. * Image.Size, InspectImage.Size: change uint64_t -> int64_t to match the daemon's int64 wire type. Cast at consumer sites that feed ULONGLONG ABI fields. * CreateExec / StartExec ConsoleSize: replace NLOHMANN_DEFINE_TYPE_INTRUSIVE_* with explicit to_json that omits the field when empty. Docker treats an empty array as an explicit 0x0 console for TTY execs; we were unconditionally serializing []. * CreatedContainer.Name: removed (Docker's POST /containers/create response only contains Id and Warnings; Name is supplied as a query parameter, not echoed back). Switched to WITH_DEFAULT for parity with surrounding types. Doc: * Updated two API doc URL references from v1.52 to v1.44 with a note about the bundled dockerd version. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
benhillis
commented
May 15, 2026
benhillis
commented
May 15, 2026
benhillis
commented
May 15, 2026
Per PR review: replace boundary static_casts with consistent signed 64-bit types across IDL, SDK, service models, and CLI schema. Mirrors the existing MemoryBytes/NanoCpus precedent. - IDL: WSLCImageInformation.Size, WSLCContainerOptions.ShmSize -> LONGLONG - SDK: WslcImageInfo.sizeBytes -> int64_t - Models: ImageInformation::Size, ContainerOptions::ShmSize -> int64_t - Schema: InspectImage::Size -> int64_t - Launcher: m_shmSize/SetShmSize -> int64_t - Validation: GetMemorySizeFromString returns int64_t Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dkbennett
reviewed
May 15, 2026
dkbennett
approved these changes
May 15, 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.
Follow-up to #40550. Audits the rest of
docker_schema.hagainst the moby version we actually ship — dockerd v25.0.3, Docker API v1.44 (verified via the version banner in the dockerd ETL trace from the linked test failure). Authoritative source: https://github.com/moby/moby/tree/v25.0.3/api.None of these are observable user-facing bugs on a stock Docker daemon today, but each is a latent crash or wrong-behavior path waiting on the right wire payload from a third-party driver, future daemon, or TTY exec.
Schema fixes
ContainerStateenumCreatedwas the first enum entry, soNLOHMANN_JSON_SERIALIZE_ENUMmapped any unrecognized state string toCreatedUnknownis first, mapped tonullptrconfiguredfor swarm). Old code silently labels themCreated.HostConfig.ShmSizestd::optional<ULONGLONG>std::int64_tint64;0already means "use daemon default". Theoptionaladded nothing.Volume.Statusoptional<map<string, string>>optional<map<string, nlohmann::json>>map[string]any. Third-party volume drivers may publish numbers, bools, or nested objects — currently throwstype_error.Image.Size,InspectImage.Sizeuint64_tint64_tint64.CreateExec/StartExecConsoleSizeto_jsonthat always wrote"ConsoleSize": []to_jsonthat omits the field when emptyConsoleSize, so every exec was sending[].CreatedContainer.NamePOST /containers/createresponse is only{Id, Warnings};Nameis a query parameter, not echoed in the response body. Switched toWITH_DEFAULTfor parity.v1.52(aspirational)v1.44+ comment about bundled dockerd versionConsumer cascade
Image.Sizegoinguint64_t -> int64_trequires explicit casts where the value flows back to ULONGLONG ABI fields:WslcSDK\wslcsdk.cpp:1480wslc\services\ImageService.cpp:207wslcsession\WSLCSession.cpp:112, 1314, 1340HostConfig.ShmSizebecomingint64_tsimplifies the consumer atWSLCContainer.cpp:1419(drops the> 0guard, just direct assignment with cast).Not in scope
state.Pidis no longer alwayshas_value() == true, otherwise we'd race-bug on the transientRunning=false, ExitCode=nullstate.ExitCodebecoming non-nullable): not exercised today; left for a future PR after the daemon bumps.Verification
clang-format --dry-run --Werrorpasses on all modified files.Volume.Status,CreatedContainer.Name, or anyConsoleSizefield; the rest are listed above.https://raw.githubusercontent.com/moby/moby/v25.0.3/api/types/...to confirm wire types.