Repository navigation
feat: error on unknown service name in up instead of hanging - #139
Merged
Cyb3rDudu merged 1 commit intoJul 23, 2026
Merged
Conversation
Contributor
|
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
1 task
Mcrich23
pushed a commit
that referenced
this pull request
Nov 10, 2026
* Add pull subcommand to fetch service images from a compose file Pulls each resolved service's image, skipping build-only services (no image key) and images already present locally — mirroring the already-present match logic up uses (exact, registry-prefixed, or short reference). Passes the service's platform: through when set. Resolves the project through the shared ComposeProjectOptions (#138) and fails fast on unknown service names per the #139 contract. * fix(pull): always pull, resolve image variables, and pull only requested services - Drop the already-present shortcut: refreshing a moving tag like :latest is the point of an explicit pull (up's implicit pull keeps the shortcut). - Resolve ${VAR}/${VAR:-default} placeholders in image references from the environment file before pulling — a literal ${...} is not a valid registry reference. - Pull only the requested services' images: the shared selection expands depends_on for up's sake, so explicit requests are narrowed back to the named services, with --include-deps to opt into the expanded set (matching docker compose pull). Extracts pullTargets/resolvedImage as pure functions with unit coverage for dependency narrowing, --include-deps, variable resolution and defaults, and build-only services.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
Lists the compose project's containers in an aligned NAME/IMAGE/STATUS/PORTS table, showing only running containers unless -a/--all is passed. Containers are matched primarily by the com.docker.compose.project/service labels stamped since Mcrich23#126 (reliable across naming modes), falling back to the candidate container names for containers created before the labels existed. Resolves the project through the shared ComposeProjectOptions (Mcrich23#138) and fails fast on unknown service names with the noSuchService contract Mcrich23#139 established for up.
Mcrich23
pushed a commit
that referenced
this pull request
Nov 14, 2026
* Add ps subcommand to list project containers Lists the compose project's containers in an aligned NAME/IMAGE/STATUS/PORTS table, showing only running containers unless -a/--all is passed. Containers are matched primarily by the com.docker.compose.project/service labels stamped since #126 (reliable across naming modes), falling back to the candidate container names for containers created before the labels existed. Resolves the project through the shared ComposeProjectOptions (#138) and fails fast on unknown service names with the noSuchService contract #139 established for up. * fix(ps): limit the name fallback to unlabeled containers A container labeled for a different project could be included when its name collided with one of our candidate names (e.g. project demo + service web-x produce the candidate demo-web-x, which is also the name project demo-web gives its service x). Labels are now authoritative whenever present; the candidate-name fallback applies only to containers without compose labels (created before #126 stamped them). Extracts the selection into ComposePs.select, generic over the container representation, with unit coverage for project filtering, service filtering, the unlabeled fallback, and stopped-container visibility with and without --all.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
Implements exec SERVICE COMMAND [ARG...] like docker compose exec: resolves the single requested service through the shared ComposeProjectOptions (Mcrich23#138), finds its container by the com.docker.compose project/service labels (candidate-name fallback for pre-label containers; a container labeled for another project is never selected), verifies it is running, and shells out to container exec with the terminal's stdio inherited so interactive sessions (-i/-t) work. Maps the shared process flags (user, workdir, env, env-file) onto container exec; --index is accepted as a docker parity no-op since replicas are unsupported. Fails fast on unknown service names per the Mcrich23#139 contract.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
Streams container logs for the project's services concurrently, each line prefixed with its padded, color-coded service name (--no-color / --no-log-prefix to disable; the palette matches up's). Supports --follow and --tail. --follow is long-only because -f is owned tool-wide by --file. Resolves the project through the shared ComposeProjectOptions (Mcrich23#138), fails fast on unknown service names per the Mcrich23#139 contract, and shows only the named services on explicit requests (dependencies are not pulled in, matching docker compose logs). Containers are matched by the com.docker.compose project/service labels with a candidate-name fallback for pre-label containers. Adds a shared streamSubprocess helper for line-streaming a child process; ComposeUp keeps its private equivalent for now — unifying them is deferred while several open PRs rework ComposeUp's process handling.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
Lists each service's backing image as SERVICE/REPOSITORY/TAG, deriving the repository and tag from service.image (or the built <service>:latest tag for build-only services) and best-effort cross-referencing ClientImage.list() for IMAGE ID and SIZE. Resolves the project through the shared ComposeProjectOptions (Mcrich23#138), fails fast on unknown service names per the Mcrich23#139 contract, and reuses the ps table renderer.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
Implements exec SERVICE COMMAND [ARG...] like docker compose exec: resolves the single requested service through the shared ComposeProjectOptions (Mcrich23#138), finds its container by the com.docker.compose project/service labels (candidate-name fallback for pre-label containers; a container labeled for another project is never selected), verifies it is running, and shells out to container exec with the terminal's stdio inherited so interactive sessions (-i/-t) work. Maps the shared process flags (user, workdir, env, env-file) onto container exec; --index is accepted as a docker parity no-op since replicas are unsupported. Fails fast on unknown service names per the Mcrich23#139 contract.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
Streams container logs for the project's services concurrently, each line prefixed with its padded, color-coded service name (--no-color / --no-log-prefix to disable; the palette matches up's). Supports --follow and --tail. --follow is long-only because -f is owned tool-wide by --file. Resolves the project through the shared ComposeProjectOptions (Mcrich23#138), fails fast on unknown service names per the Mcrich23#139 contract, and shows only the named services on explicit requests (dependencies are not pulled in, matching docker compose logs). Containers are matched by the com.docker.compose project/service labels with a candidate-name fallback for pre-label containers. Adds a shared streamSubprocess helper for line-streaming a child process; ComposeUp keeps its private equivalent for now — unifying them is deferred while several open PRs rework ComposeUp's process handling.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
stop halts running service containers without removing them, in reverse dependency order and honoring each service's stop_grace_period (Mcrich23#150); start boots them back up in dependency order via container start. Both resolve the project through the shared ComposeProjectOptions, find containers with the shared label-first matching rule, fail fast on unknown service names per the Mcrich23#139 contract, and act only on explicitly named services (dependencies are not expanded, matching docker compose stop/start).
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
restart stops each service container in place — honoring its stop_grace_period (Mcrich23#150) — and boots it again via container start, in dependency order. kill force-stops containers with a signal (-s/--signal, SIGKILL by default; names accepted with or without the SIG prefix, or numeric), in reverse dependency order. Both resolve the project through the shared ComposeProjectOptions, find containers with the shared label-first matching rule, fail fast on unknown service names per the Mcrich23#139 contract, and act only on explicitly named services, matching docker compose restart/kill.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
stop halts running service containers without removing them, in reverse dependency order and honoring each service's stop_grace_period (Mcrich23#150); start boots them back up in dependency order via container start. Both resolve the project through the shared ComposeProjectOptions, find containers with the shared label-first matching rule, fail fast on unknown service names per the Mcrich23#139 contract, and act only on explicitly named services (dependencies are not expanded, matching docker compose stop/start).
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
Streams container logs for the project's services concurrently, each line prefixed with its padded, color-coded service name (--no-color / --no-log-prefix to disable; the palette matches up's). Supports --follow and --tail. --follow is long-only because -f is owned tool-wide by --file. Resolves the project through the shared ComposeProjectOptions (Mcrich23#138), fails fast on unknown service names per the Mcrich23#139 contract, and shows only the named services on explicit requests (dependencies are not pulled in, matching docker compose logs). Containers are matched by the com.docker.compose project/service labels with a candidate-name fallback for pre-label containers. Adds a shared streamSubprocess helper for line-streaming a child process; ComposeUp keeps its private equivalent for now — unifying them is deferred while several open PRs rework ComposeUp's process handling.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
Implements exec SERVICE COMMAND [ARG...] like docker compose exec: resolves the single requested service through the shared ComposeProjectOptions (Mcrich23#138), finds its container by the com.docker.compose project/service labels (candidate-name fallback for pre-label containers; a container labeled for another project is never selected), verifies it is running, and shells out to container exec with the terminal's stdio inherited so interactive sessions (-i/-t) work. Maps the shared process flags (user, workdir, env, env-file) onto container exec; --index is accepted as a docker parity no-op since replicas are unsupported. Fails fast on unknown service names per the Mcrich23#139 contract.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 14, 2026
restart stops each service container in place — honoring its stop_grace_period (Mcrich23#150) — and boots it again via container start, in dependency order. kill force-stops containers with a signal (-s/--signal, SIGKILL by default; names accepted with or without the SIG prefix, or numeric), in reverse dependency order. Both resolve the project through the shared ComposeProjectOptions, find containers with the shared label-first matching rule, fail fast on unknown service names per the Mcrich23#139 contract, and act only on explicitly named services, matching docker compose restart/kill.
This was referenced Nov 14, 2026
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 25, 2026
Implements exec SERVICE COMMAND [ARG...] like docker compose exec: resolves the single requested service through the shared ComposeProjectOptions (Mcrich23#138), finds its container by the com.docker.compose project/service labels (candidate-name fallback for pre-label containers; a container labeled for another project is never selected), verifies it is running, and shells out to container exec with the terminal's stdio inherited so interactive sessions (-i/-t) work. Maps the shared process flags (user, workdir, env, env-file) onto container exec; --index is accepted as a docker parity no-op since replicas are unsupported. Fails fast on unknown service names per the Mcrich23#139 contract.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 25, 2026
Streams container logs for the project's services concurrently, each line prefixed with its padded, color-coded service name (--no-color / --no-log-prefix to disable; the palette matches up's). Supports --follow and --tail. --follow is long-only because -f is owned tool-wide by --file. Resolves the project through the shared ComposeProjectOptions (Mcrich23#138), fails fast on unknown service names per the Mcrich23#139 contract, and shows only the named services on explicit requests (dependencies are not pulled in, matching docker compose logs). Containers are matched by the com.docker.compose project/service labels with a candidate-name fallback for pre-label containers. Adds a shared streamSubprocess helper for line-streaming a child process; ComposeUp keeps its private equivalent for now — unifying them is deferred while several open PRs rework ComposeUp's process handling.
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 25, 2026
stop halts running service containers without removing them, in reverse dependency order and honoring each service's stop_grace_period (Mcrich23#150); start boots them back up in dependency order via container start. Both resolve the project through the shared ComposeProjectOptions, find containers with the shared label-first matching rule, fail fast on unknown service names per the Mcrich23#139 contract, and act only on explicitly named services (dependencies are not expanded, matching docker compose stop/start).
adrum
added a commit
to adrum/Container-Compose
that referenced
this pull request
Nov 25, 2026
restart stops each service container in place — honoring its stop_grace_period (Mcrich23#150) — and boots it again via container start, in dependency order. kill force-stops containers with a signal (-s/--signal, SIGKILL by default; names accepted with or without the SIG prefix, or numeric), in reverse dependency order. Both resolve the project through the shared ComposeProjectOptions, find containers with the shared label-first matching rule, fail fast on unknown service names per the Mcrich23#139 contract, and act only on explicitly named services, matching docker compose restart/kill.
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.