fix(cli): stop reads only composeProjectName so a broken config can still stop the stack - #26
Merged
Merged
Conversation
…till stop the stack
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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
Closes #25
stopvalidated the full config before shelling out to Docker Compose, so anyconfig error left a running stack that the tool could not bring down. Tearing
the stack down only needs the Compose project name, so
stopnow reads justthat field.
Changes
stopis dispatched beforeloadConfig()and tears the stack down withdocker compose --project-name <name> down --remove-orphans, which finds thecontainers by project label without compose files, env files, or profiles.
parseComposeProjectName(pure) andloadComposeProjectNameinsrc/config.js: onlycomposeProjectNameis validated; everything else,including the version gate, is ignored.
stopStackByProjectNameinsrc/compose.js; the docker spawn logic isextracted into a shared
runDockerhelper reused byrunDockerCompose.stopremoved from the config-reading commands in the lifecyclediagram, plus a note under CLI reference explaining the behavior.
Acceptance criteria
Suggested from the issue's expected behavior (it has no formal AC list):
stopstops the stack when the config is broken butcomposeProjectNameis a valid non-empty stringstopfails with the usual config error whencomposeProjectNameis missing or invalidTest plan
Automated tests
scripts/config-validation.test.js: 4 new cases forparseComposeProjectName(valid config, config that full validation rejects, missing field, empty field).
Run with
npm test(30 passing).Manual verification
"version": 0plus an unknown field and a validcomposeProjectName,stopruns the compose down and exits 0.composeProjectNameempty or missing,stopprints the config errorand exits 1.
Breaking changes
None.
Checklist
Screenshots
None.