Skip to content

refactor(compose): move the dependency wait helpers to their own file - #14401

Merged
ndeloof merged 3 commits into
docker:mainfrom
ndeloof:chore/move-dependency-wait-helpers
Oct 27, 2026
Merged

ndeloof merged 3 commits into
docker:mainfrom
ndeloof:chore/move-dependency-wait-helpers

Conversation

@ndeloof

@ndeloof ndeloof commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

What this PR does, in one sentence

Moves the dependency-wait helpers out of pkg/compose/service_containers.go into their own file, dependency_wait.go, with their tests, without changing a line of what they do.

Context

service_containers.go was the home of the imperative engine that started the services. That engine is gone (the start phase runs on the plan, #14081), but the file kept the one thing that survived it: the polling of a depends_on condition — waitDependency, waitDependencyReached and the per-condition checks, shared by the plan executor and by what still waits outside a plan (restart, run, --wait). It was one third of the file and nearly half of its tests, under a name that no longer says what is in it.

What the PR brings

  • dependency_wait.go gathers the waits on depends_on conditions: waitDependencies, waitDependency, waitDependencyReached, the three checkDependency*, shouldWaitForDependency, isServiceHealthy, isServiceCompleted and the running_or_healthy condition. Their tests move to dependency_wait_test.go. service_containers.go keeps what is about the containers themselves, and its header now says so.
  • A pure move: every declaration of pkg/compose has the same text before and after, and the lines added and removed are the same lines, apart from the new file's header and imports. No logic, no signature and no test changes. Two comments of internal/projectloader that named the old file now name the new one.

Part of #14081 (Lot 3): with this one, the imperative start path is fully removed.

🤖 Generated with Claude Code

waitDependencies, the polling of a depends_on condition (waitDependency,
waitDependencyReached and the per-condition checks), shouldWaitForDependency
and the container health probes they use leave service_containers.go for
dependency_wait.go, and their tests for dependency_wait_test.go. The
remaining clients of the waits are the plan's OpWaitCondition nodes,
restart, run and the --wait verification of up and start.

A pure move: every declaration, its comments included, is unchanged.

Part of docker#14081

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

The header of service_containers.go still listed the dependency waits among
what it covers.

Comments only.

Part of docker#14081

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

Two comments still located waitDependency's runtime fallback in
service_containers.go.

Comments only.

Part of docker#14081

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof
ndeloof requested review from a team as code owners October 27, 2026 11:13
@ndeloof
ndeloof enabled auto-merge (rebase) October 27, 2026 11:14

@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

@ndeloof
ndeloof merged commit 4d6f2db into docker:main Oct 27, 2026
62 of 64 checks passed
@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.35032% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/compose/dependency_wait.go 85.35% 19 Missing and 4 partials ⚠️

📢 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.

3 participants