Skip to content

feat(docker): C2 — read-only ContainerInspect/ContainerLogs + mock (spec 10) - #2

Merged
gustavobertoi merged 1 commit into
mainfrom
nightly/C2
Jun 29, 2026
Merged

feat(docker): C2 — read-only ContainerInspect/ContainerLogs + mock (spec 10)#2
gustavobertoi merged 1 commit into
mainfrom
nightly/C2

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

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) → ContainerDetailsState, 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(ctx, id, tail) → string — combined stdout+stderr, tail-limited, demuxed via stdcopy into 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

  • Daemon-free unit tests via MockClient (new Details/LogLines maps + InspectErr/LogsErr), plus ContainerDetails helper + lastLines table tests.
  • //go:build integration test 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/docker green locally.

🤖 Generated with Claude Code

…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>
@gustavobertoi
gustavobertoi merged commit d291ef5 into main Jun 29, 2026
9 checks passed
@gustavobertoi
gustavobertoi deleted the nightly/C2 branch June 29, 2026 12:26
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.

1 participant