feat(docker): C2 — read-only ContainerInspect/ContainerLogs + mock (spec 10) - #2
Merged
Conversation
…pec 10) Grow the read-only Engine SDK Client with the two probes the health poller and up saga need: - ContainerInspect → ContainerDetails projection (State, Running, ExitCode, and .State.Health.Status as a typed HealthStatus). Health is "" when the container declares no healthcheck (nil State.Health), distinguishing "no signal" from "starting"; HasHealthcheck()/Healthy() helpers encode the rule. - ContainerLogs → combined stdout+stderr, tail-limited, demuxed via stdcopy into one buffer so frames stay interleaved (the fail-fast diagnostic). Both are strictly read-only (ARCHITECTURE §4) so they stay outside the flock. MockClient gains Details/LogLines maps + InspectErr/LogsErr for daemon-free unit tests; a `//go:build integration` test validates the moby field mapping against a real container (healthy + no-healthcheck cases, log demux). go mod tidy promotes moby/moby/api to a direct dep (stdcopy import). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Chunk C2 (M2-remainder)
Adds the two read-only Engine SDK probes the health poller (C3b) and the up saga (C5) gate on, per spec 10.
What
ContainerInspect(ctx, id) → ContainerDetails—State,Running,ExitCode, and.State.Health.Statusas a typedHealthStatus.Healthis""when the container declares no healthcheck (nilState.Health), distinguishing "no signal" fromstarting.HasHealthcheck()/Healthy()helpers encode the rule.ContainerLogs(ctx, id, tail) → string— combined stdout+stderr, tail-limited, demuxed viastdcopyinto one buffer so frames stay interleaved (the fail-fast diagnostic in spec 10 §blocking-UX).Both are strictly read-only (ARCHITECTURE §4) → they stay outside the flock (spec 10 §gotchas: health polling is lock-free).
Tests
MockClient(newDetails/LogLinesmaps +InspectErr/LogsErr), plusContainerDetailshelper +lastLinestable tests.//go:build integrationtest validates the real moby field mapping against a live container (healthy + no-healthcheck cases, log demux). Verified locally against Engine 29.5.3.Gate
make ci(fmt-check + vet + build + test-race) green;go test -tags=integration ./internal/dockergreen locally.🤖 Generated with Claude Code