Skip to content

api: DownOptions.Images becomes a typed ImagePruneMode, validated upfront - #14149

Open
ndeloof wants to merge 1 commit into
docker:mainfrom
ndeloof:b6-image-prune-mode
Open

api: DownOptions.Images becomes a typed ImagePruneMode, validated upfront#14149
ndeloof wants to merge 1 commit into
docker:mainfrom
ndeloof:b6-image-prune-mode

Conversation

@ndeloof

@ndeloof ndeloof commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Epic #14074, B.6. The legal values of DownOptions.Images lived in pkg/compose while the field was a bare string in pkg/api, and the only validation fired inside ImagesToPrune — after down had already removed the project's containers, leaving the teardown half done on a typo (SDK callers only; the CLI validated its --rmi flag separately).

  • ImagePruneMode and its three values move to pkg/api, next to the field they constrain (type-aliased in pkg/compose for existing consumers — untyped string literals still compile);
  • down() rejects any other value before touching a single resource;
  • the CLI --rmi check reuses the same definition;
  • a unit test runs Down with expectation-free mocks: one daemon call would fail it. Mocks verified in sync (make mocks, no drift).

🤖 Generated with Claude Code

…ront

The legal values of DownOptions.Images lived in pkg/compose
(image_pruner.go) while the field itself was a bare string in pkg/api,
and the only validation fired inside ImagesToPrune — after down had
already removed the project's containers, leaving the teardown half
done on a typo. The CLI validated its --rmi flag separately, so only
SDK callers were exposed.

ImagePruneMode and its three values now live in pkg/api next to the
field they constrain (type-aliased in pkg/compose for existing
consumers), down() rejects any other value before touching a single
resource, and the CLI check reuses the same definition. A unit test
runs Down with expectation-free mocks: one daemon call would fail it.

Epic docker#14074, B.6.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/compose/down.go 33.33% 1 Missing and 1 partial ⚠️
pkg/api/api.go 66.66% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

2 participants