Repository navigation
Conversation
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🔴 CRITICAL
This PR correctly introduces engine.API as a narrowed interface and plumbs it throughout the codebase. The mechanical refactoring is consistent. Two correctness issues are introduced by the new s.engine priority in apiClient().
Lower-confidence findings (not posted inline)
- [medium] pkg/compose/compose.go:279 — Close() may not close s.dockerCli.Client() connection when s.engine is set (confidence: weak 52/100)
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟡 NEEDS ATTENTION
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
01ffffc to
155ec8f
Compare
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
Incremental review — this review covers only the commits pushed since
155ec8f959c0e52062b98543dd1c83ca5918b9d9.
The incremental diff refines the engine-interface refactor by giving each sub-package only the narrower engine family it actually calls (ContainerAPI(), ImageAPI(), NetworkAPI(), etc.) rather than the full engine.API. The changes are mechanically consistent: every method call site is covered by the new narrower interface type, the WithDryRun-with-injected-engine guard introduced in the previous round is intact, and the NewMonitor signature split into separate ContainerAPIClient / SystemAPIClient fields is reflected at all call sites. No bugs were introduced by the incremental commits.
The packages extracted from pkg/compose (build, images, relay, containerops, logstream, devwatch, inspect, projectloader, publish, provider) each received the whole moby client through a single APIClient accessor, and the classic image build reached the daemon through the Docker CLI. Their Backend interfaces now ask for the client interfaces moby defines per resource (ContainerAPI, NetworkAPI, ImageAPI, ImageBuildAPI, ExecAPI, VolumeAPI, SystemAPI, DistributionAPI), and only for those the component calls: containerops works on containers alone, registry only resolves digests, and so on. The helpers they call (registry, desktop, the log stream monitor) take the matching family. composeService implements every accessor with its engine. composeService gets an optional engine field, used instead of the client of the Docker CLI when set. The CLI client still backs it by default, resolved on first use as before, since it initializes lazily. WithDryRun refuses a service holding an engine, as the dry-run client only wraps the CLI's one. Close releases the engine handed to the service, while the CLI's client stays with the CLI. No behavior change. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
3725100 to
3334142
Compare
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
docker-agent
left a comment
There was a problem hiding this comment.
What this PR does, in one sentence
It gives each component extracted from
pkg/composeonly the part of the Docker Engine API it uses, instead of the whole moby client.Context
Every component reaches the daemon through the complete moby
APIClient: several hundred methods, of which each component calls a handful. Nothing in itsBackendsays which, so a component that only copies files into containers could as well manage networks or swarm. The classic image build even reached the daemon through the Docker CLI rather than through its backend.What the PR brings
Backendof each component (build,images,relay,containerops,logstream,devwatch,inspect,projectloader,publish,provider) asks for the client interfaces moby already defines per resource (ContainerAPI(),NetworkAPI(),ImageAPI(),ImageBuildAPI(),ExecAPI(),VolumeAPI(),SystemAPI(),DistributionAPI()), and only for those it calls:containeropsworks on containers alone,registryonly resolves digests. The helpers they call (registry, desktop, log stream monitor) take the matching family.composeServiceimplements every accessor with its engine, and the classic build now goes through its backend like the others.composeServicegets an optionalenginefield, used instead of the Docker CLI's client when set. By default the engine is still the CLI's client, resolved on first use as before: that client initializes lazily, so a command that never reaches the engine (compose config) still doesn't open a connection.WithDryRunrefuses a service holding an injected engine, since the dry-run client only wraps the CLI's one, andClosereleases the engine handed to the service while the CLI's client stays with the CLI.Guardrails: no behavior change, no change to the exported signatures of
pkg/compose. What stays on the Docker CLI is what really is bound to it: terminal streams, config file, buildx and model plugins, and attach/exec.Why this is the right first brick
A component's
Backendnow states exactly what it needs from the engine, which is what makes it possible to run it against something else than a CLI-backed client, and to separate the remaining Docker CLI dependencies (streams, credentials, plugins) one at a time.🤖 Generated with Claude Code