Repository navigation
refactor(compose): move the dependency graph to internal/depgraph - #14410
Merged
Merged
Conversation
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
4 of 15 tasks
ndeloof
force-pushed
the
internal-depgraph
branch
from
October 29, 2026 07:23
6cc013a to
6dc6112
Compare
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
This is a clean package-extraction refactoring. The graph traversal logic, concurrency model, and semantics are faithfully preserved in internal/depgraph. All callers updated correctly.
Lower-confidence findings (not posted inline)
- [low] internal/depgraph/depgraph.go:162 — limitedErrgroup +1 convention undocumented (confidence: unverified low, not scored)
Thevisit()function passest.maxConcurrency + 1tolimitedErrgroup, which forwards it straight toSetLimit. The +1 accounts for the coordinator goroutine. This split convention is not documented; a future direct caller oflimitedErrgroup(ctx, 1)would unintentionally starve all workers. Consider adding a comment tolimitedErrgroupnoting the caller must include the coordinator slot in the argument. - [low] internal/depgraph/depgraph.go:119 — WithRootNodesAndDown doc comment ambiguous phrasing (confidence: unverified low, not scored)
The comment says "services depending on them" which can be read two ways. The implementation correctly returns transitive dependents (services that depend ON the roots). Clarifying to "services that depend on them (their transitive dependents)" would remove the ambiguity.
ndeloof
force-pushed
the
internal-depgraph
branch
from
October 29, 2026 09:22
6dc6112 to
34c31ba
Compare
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
ndeloof
force-pushed
the
internal-depgraph
branch
from
October 29, 2026 11:04
34c31ba to
2770883
Compare
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
ndeloof
force-pushed
the
internal-depgraph
branch
from
November 3, 2026 18:39
2770883 to
5ae1fb2
Compare
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
ndeloof
force-pushed
the
internal-depgraph
branch
from
November 4, 2026 17:07
5ae1fb2 to
7eab74e
Compare
3 tasks
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.
What this PR does, in one sentence
Moves the service dependency graph and its ordered traversal (
dependencies.go) out ofpkg/composeinto a standaloneinternal/depgraphpackage.Context
Graph,Vertex,InDependencyOrder,InReverseDependencyOrderand friends only depend on the compose-go project model and onpkg/apierrors, yet they live inside thepkg/composemonolith next to the engine code, which makes them look entangled with it. The only thing they borrowed from the rest of the package was the small bounded-errgroup helper, which now lives ininternal/concurrency(#14422).What the PR brings
internal/depgraphpackage (noBackend, no engine dependency) thatreconcile,down,stop,restartand the classic build reference qualified (depgraph.InDependencyOrder, …). Behaviour is unchanged; the tests moved with the code, with identical assertions.internal/concurrency: the traversal callsconcurrency.NewErrgroup, so no copy of the helper is needed. The "limit + 1" passed to it (one slot is held by the goroutine reading the node channel) is kept as is and now documented in a comment.depgraph.Optiontype, and the classic build, which used to set the unexportedmaxConcurrencyfield from a closure, uses a newdepgraph.WithMaxConcurrency(n)option instead.pkg/compose(and therefore from the/v5API surface; none is used anywhere else in this repository):ServiceStatus,ServiceStopped,ServiceStarted,Graph,Vertex,NewGraph,NewVertex,InDependencyOrder,InReverseDependencyOrder,WithRootNodesAndDown, and the methods ofGraphandVertex(AddVertex,AddEdge,Leaves,Roots,UpdateStatus,FilterChildren,FilterParents,HasCycles,GetParents,GetChildren).reconcile.gois touched only for identifier qualification, to keep conflicts with the open reconcile PRs minimal.Why this is the right next brick
Part of the #14396 series. It is a pure leaf of the dependency tree (nothing flows back from
internal/depgraphintopkg/compose) and is independent of the other extractions, so it can land in any order.Part of #14396
🤖 Generated with Claude Code