feat: error on unknown service name in up instead of hanging - #139
Merged
Cyb3rDudu merged 1 commit intoJul 23, 2026
Merged
Conversation
Collaborator
|
Rebased onto latest main (includes #129 + #138) and pushed to the PR branch. Changes vs original PR:
All 236 static tests pass (0 failures). |
`container-compose up <service>` silently selected nothing when <service> was not defined in the compose file (a typo, or a service removed from the file). In foreground mode `up` then blocked forever in `runForegroundUntilStopped`, waiting on containers that were never created — so a mistyped service name looked like a hang. Validate requested service names up front and fail with `no such service: <name>`, matching `docker compose up <svc>`. Adds `ComposeError.noSuchService` and unit tests for `Service.validateRequestedServices`.
Cyb3rDudu
force-pushed
the
feat/no-such-service-validation
branch
from
July 23, 2026 03:04
04f8d77 to
e22aaf0
Compare
Cyb3rDudu
approved these changes
Jul 23, 2026
This was referenced Jul 28, 2026
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.
Summary
container-compose up <service>silently selected nothing when<service>wasn't defined in the compose file (a typo, or a service that was renamed/removed). In foreground mode (upwithout-d), it then blocked forever inrunForegroundUntilStopped, waiting on containers that were never created — so a mistyped service name looked like a hang.This validates requested service names up front and fails fast with
no such service: <name>, matchingdocker compose up <svc>.Reproduce (before)
After
Verified end-to-end against a real ~30-service compose file: the unknown name now errors immediately, and a valid service name proceeds unchanged.
Changes
ComposeError.noSuchService(String)→"no such service: <name>".Service.validateRequestedServices(_:against:)and call it inComposeUp.run()right after the service list is built (before profile selection).Container-Compose-StaticTestscovering: all-exist passes, empty request passes, unknown throws, the error wording, and first-unknown-wins.Tests
swift test --filter Container_Compose_StaticTests→ 215 tests, 20 suites, 0 failures (same command the CI runs).No behavior change for valid service names; purely additive validation.