fix(config): make shutdownAction defaults explicit in config resolution#259
Conversation
✅ Deploy Preview for devsydev canceled.
|
📝 WalkthroughWalkthroughAdds post-merge defaulting for ChangesShutdownAction Defaulting
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Apply spec-compliant defaults at the end of MergeConfiguration when shutdownAction is unset: "stopCompose" for Docker Compose configs, "stopContainer" for image/Dockerfile configs. Preserves explicit config values that were being lost when image metadata had no override.
Add read-configuration e2e tests verifying shutdownAction defaults: - Image-based config defaults to "stopContainer" - Docker Compose config defaults to "stopCompose" - Explicit "none" value is preserved unchanged
e247b11 to
c496f35
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@e2e/tests/readconfiguration/testdata-shutdown-action-compose/.devcontainer.json`:
- Line 3: The devcontainer.json "service" key value is mismatched with the
docker-compose service name; update the "service" entry in .devcontainer.json
from "app" to the exact compose service key "app1" so it matches the service
defined in docker-compose.yml (ensure the "service" property equals "app1" used
by the compose fixture).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c852e5d3-20e0-442b-906d-9987ada292a0
📒 Files selected for processing (7)
e2e/tests/readconfiguration/readconfiguration.goe2e/tests/readconfiguration/testdata-shutdown-action-compose/.devcontainer.jsone2e/tests/readconfiguration/testdata-shutdown-action-compose/docker-compose.ymle2e/tests/readconfiguration/testdata-shutdown-action-explicit/.devcontainer.jsone2e/tests/readconfiguration/testdata-shutdown-action/.devcontainer.jsonpkg/devcontainer/config/merge.gopkg/devcontainer/config/merge_test.go
✅ Files skipped from review due to trivial changes (3)
- e2e/tests/readconfiguration/testdata-shutdown-action/.devcontainer.json
- e2e/tests/readconfiguration/testdata-shutdown-action-explicit/.devcontainer.json
- e2e/tests/readconfiguration/testdata-shutdown-action-compose/docker-compose.yml
🚧 Files skipped from review as they are similar to previous changes (2)
- pkg/devcontainer/config/merge_test.go
- pkg/devcontainer/config/merge.go
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "dockerComposeFile": "docker-compose.yml", | |||
| "service": "app" | |||
There was a problem hiding this comment.
Service name must match the compose service key
Line 3 should match the exact service key in docker-compose.yml. Current CI failure (service 'app1' configured in devcontainer.json not found) indicates this fixture set is still mismatched, so the compose-based e2e case won’t run reliably until aligned.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@e2e/tests/readconfiguration/testdata-shutdown-action-compose/.devcontainer.json`
at line 3, The devcontainer.json "service" key value is mismatched with the
docker-compose service name; update the "service" entry in .devcontainer.json
from "app" to the exact compose service key "app1" so it matches the service
defined in docker-compose.yml (ensure the "service" property equals "app1" used
by the compose fixture).
Summary
shutdownActioninMergeConfiguration:"stopCompose"for Docker Compose-based configs,"stopContainer"for image/Dockerfile-based configsshutdownActionvalues that were previously lost when image metadata provided no overrideread-configuration --include-merged-configuration) validating defaults and explicit preservationSpec Reference
Per the devcontainer JSON reference:
Valid values:
"none","stopContainer","stopCompose"The implementation in
merge.go:143-152matches this spec exactly:shutdownActionis set in the devcontainer config, it is preserveddockerComposeFileis configured, defaults to"stopCompose""stopContainer"Summary by CodeRabbit
New Features
Tests