Skip to content

feat(container): persistent container component kind + compositions - #2645

Merged
Andriy Knysh (aknysh) merged 9 commits into
mainfrom
osterman/container-component-type
Jun 24, 2026
Merged

Andriy Knysh (aknysh) merged 9 commits into
mainfrom
osterman/container-component-type

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Jun 21, 2026 •

Copy link
Copy Markdown
Member

what

Adds a stack-scoped, Atmos-native container component kind — one component is one persistent service — plus first-class compositions membership.

  • Lifecycle (atmos container <verb> <component> -s <stack>): build, push, pull, run, up, ps, logs, exec, restart, stop, rm, down. Long-running containers are discovered by labels derived from the canonical instance address <stack>/container/<component> (name atmos-<stack>-container-<component>), not local state files. up/run build the image first when vars.build-style build: is set and the image is missing.
  • First-class config — image, build, run are top-level component sections (reusing the workflow container-step structs ContainerBuildStep/ContainerRunStep), not nested under vars. Container app env comes from the component env: section.
  • atmos container list shows per-instance running state (running/stopped/unknown), discovered by label. The generic atmos list components lists containers as a component type without container-specific status — consistent with terraform/ansible (there is no atmos terraform list/atmos ansible list).
  • Compositions — a first-class composition: membership field + a top-level compositions: section (closed for membership, open for fulfillment). Operating a component with undeclared membership is a hard error; atmos composition validate <name> -s <stack> reports fulfilled vs. not-provided services.
  • Deep merge — the custom-component fallback now runs metadata.inherits inheritance + generic deep-merge of all top-level keys, so container honors catalog/abstract defaults like built-in kinds. Abstract components are rejected for execution and filtered from listings.
  • Extends the describe-component auto-detect and the describe/list type whitelist for container (and fixes the pre-existing ansible gap in list components).

why

Containers should be first-class, addressable component instances like terraform/helmfile/packer/ansible, and atmos list components should show whether each is running. A set of container components grouped by a composition is "our own Compose" with no compose.yaml. Implements docs/prd/container-components.md.

references

  • PRD: docs/prd/container-components.md, docs/prd/compositions.md
  • Examples: examples/container-component/, examples/compositions/
  • Docs: website/docs/cli/commands/container/, website/docs/components/container.mdx
  • Contributor skill: .claude/skills/atmos-core-component-development/

Note

Stacked on osterman/container-step-prd (the container step), not main. Changelog/roadmap are not required for this base (the gate is main-only); they'll go on the PR that brings the container feature to main.

🤖 Generated with Claude Code

@atmos-pro

atmos-pro Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@github-actions github-actions Bot added the size/l Large size PR label Jun 21, 2026
@mergify

mergify Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@github-actions

github-actions Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@mergify mergify Bot added stacked Stacked needs-cloudposse Needs Cloud Posse assistance labels Jun 21, 2026
@osterman Erik Osterman (Cloud Posse) (osterman) added the minor New features that do not break anything label Jun 21, 2026
@osterman

Copy link
Copy Markdown
Member Author

CodeRabbit (@coderabbitai) full review

@coderabbitai

coderabbitai Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 98237ad4-c6b9-4c4c-bb58-52b9cfa76963

📥 Commits

Reviewing files that changed from the base of the PR and between 4fe20c4 and 31ce958.

📒 Files selected for processing (3)
  • errors/errors.go
  • pkg/schema/schema.go
  • website/src/data/roadmap.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • errors/errors.go
  • pkg/schema/schema.go
  • website/src/data/roadmap.js

📝 Walkthrough

Walkthrough

This PR adds first-class container components, a composition validate command, shared container runtime helpers, container-aware stack/schema processing, bulk and log operations, and updated examples, docs, tests, and CLI help output.

Changes

Container component type and composition validation

Layer / File(s) Summary
CLI surface and command wiring
cmd/composition/*, cmd/container/*, cmd/root.go, tests/snapshots/*, website/docs/cli/commands/container/*
Adds the composition and container commands, subcommand wiring, completions, root registration, and updated CLI help/docs snapshots.
Container provider and executors
pkg/component/container/*
Adds container spec decoding, provider dispatch, bulk selection, lifecycle operations, listing, logs, runtime helpers, and tests/mocks.
Composition runtime and container primitives
pkg/composition/*, pkg/container/*, pkg/devcontainer/*, pkg/io/line_prefix_writer.go, pkg/ui/*, pkg/flags/interactive.go, pkg/list/extract/components.go, pkg/runner/step/container_run.go, go.mod
Adds composition validation/reporting, container identity/lifecycle/runtime helpers, shell/attach primitives, interactive selection, UI formatting helpers, label namespace updates, and supporting tests.
Stack processing and container schema
internal/exec/*, pkg/datafetcher/schema/*, pkg/config/const.go, pkg/schema/*, errors/errors.go
Extends stack processing and manifest coverage for components.container and compositions, adds custom inheritance resolution, and updates related constants, schema types, and errors.
Schema, docs, and release artifacts
examples/*, website/docs/*, website/blog/*, docs/prd/*, .claude/skills/*, website/src/data/roadmap.js
Adds container/composition examples, public docs, PRD guidance, a blog post, roadmap updates, and contributor instructions.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AtmosContainer as atmos container up
  participant ContainerProvider as ContainerComponentProvider
  participant Runtime as container runtime

  User->>AtmosContainer: up api -s local
  AtmosContainer->>ContainerProvider: Execute(up, stack, component)
  ContainerProvider->>Runtime: ImageInspect
  Runtime-->>ContainerProvider: image state
  ContainerProvider->>Runtime: Build/Create/Start
  Runtime-->>ContainerProvider: container result
  ContainerProvider-->>AtmosContainer: status output
  AtmosContainer-->>User: command result
Loading
sequenceDiagram
  participant User
  participant CompositionCmd as atmos composition validate
  participant CompositionExecutor as ExecuteValidate
  participant CompositionPackage as pkg/composition
  participant UI as UI output

  User->>CompositionCmd: validate storefront -s dev
  CompositionCmd->>CompositionExecutor: buildConfigAndStacksInfo
  CompositionExecutor->>CompositionPackage: collectMembers
  CompositionPackage-->>CompositionExecutor: members
  CompositionExecutor->>CompositionPackage: Validate
  CompositionPackage-->>CompositionExecutor: Report
  CompositionExecutor->>UI: renderReport
  UI-->>User: fulfilled / not provided / unknown
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • cloudposse/atmos#1614: Both PRs modify the custom inheritance path around metadata.inherits handling so inherited component metadata isn’t overwritten during deep-merge resolution.
  • cloudposse/atmos#2204: Both PRs modify the internal/exec describe-stacks pipeline; this PR extends it for components.container, and that PR refactors the same path.
  • cloudposse/atmos#2602: This PR’s log follow/Ctrl-C handling depends on the interrupt-suspension behavior introduced there.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 39.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(container): persistent container component kind + compositions' directly describes the main changes—introducing containers as a component kind and adding compositions support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch osterman/container-component-type

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 20

🧹 Nitpick comments (5)
website/docs/cli/commands/container/usage.mdx (1)

23-23: 💤 Low value

Use curly quotes for quoted phrases in prose.

LanguageTool suggests using typographic (smart) quotes in "your own Compose" instead of straight quotes. Update to "your own Compose" for consistency with professional documentation style.

🤖 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 `@website/docs/cli/commands/container/usage.mdx` at line 23, Replace the
straight quotes around the phrase "your own Compose" with curly quotes
(typographic smart quotes) to match professional documentation standards. The
phrase currently uses straight double quotes and should be changed to use
opening and closing curly quotes instead.
pkg/composition/composition_test.go (1)

22-37: ⚡ Quick win

Convert this multi-scenario test to a table-driven structure.

This block currently mixes four scenarios in one flow; table-driven cases will make failures sharper and future cases cheaper to add.

As per coding guidelines, "**/*_test.go: Use table-driven tests for testing multiple scenarios in Go."

🤖 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 `@pkg/composition/composition_test.go` around lines 22 - 37, The
TestValidateMembership function currently mixes four test scenarios in a single
linear flow, making it harder to identify which specific case fails and harder
to add new test cases. Refactor this function to use a table-driven test pattern
by defining a slice of test case structs (each containing inputs like
serviceName, compositionName, and expectedError, along with a descriptive name),
then iterate through each case using t.Run to execute the ValidateMembership
call and verify the expected error condition. This will make individual test
failures sharper and make it cheaper to add future test cases.

Source: Coding guidelines

pkg/component/container/executor_test.go (1)

211-223: ⚡ Quick win

Add the complementary restart test for a non-running container.

You verify the stop-then-start branch; please also verify the branch where stop does not run when status is not running.

As per coding guidelines: “Include negative-path tests for recovery logic … verify the recovery does NOT trigger when condition X is absent.”

🤖 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 `@pkg/component/container/executor_test.go` around lines 211 - 223, Add a
complementary test function to verify the negative-path behavior of
ExecuteRestart when the container is not running. Create a new test that sets up
a mock Runtime with a non-running container status (by calling runningInfo()
with appropriate parameters or a different status), and then verify the
gomock.InOrder expectations that List is called first, Stop is NOT called, and
Start is called directly. This ensures the restart logic correctly skips the
stop operation when the container is not already running, complementing the
existing TestExecuteRestart_StopsThenStarts test.

Source: Coding guidelines

cmd/container/container_test.go (1)

10-56: ⚡ Quick win

Initialize command tests with cmd.NewTestKit(t) for RootCmd-state hygiene.

Please add the standard test kit setup in these command tests to align with the repo’s command-test isolation pattern.

As per coding guidelines: “cmd/**/*_test.go: ALWAYS use cmd.NewTestKit(t) for cmd tests to auto-clean RootCmd state.”

🤖 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 `@cmd/container/container_test.go` around lines 10 - 56, The command tests
TestContainerCommandProvider, TestContainerCommandStructure,
TestContainerSubcommandsRequireComponent, and TestStackFlagIsPersistent are
missing the standard test kit initialization that ensures proper RootCmd state
isolation between tests. Add cmd.NewTestKit(t) at the beginning of each of these
test functions to follow the repository's command-test isolation pattern and
ensure proper cleanup of shared state.

Source: Coding guidelines

pkg/component/container/executor.go (1)

3-3: Pin mockgen to v0.6.0 to match the rest of the codebase.

The directive uses @latest, which makes generated mocks non-reproducible. Most of the repository pins to @v0.6.0; align this file to that version.

🤖 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 `@pkg/component/container/executor.go` at line 3, The go:generate directive in
the executor.go file uses `@latest` for the mockgen version, which causes
non-reproducible builds and is inconsistent with the rest of the codebase.
Replace `@latest` with `@v0.6.0` in the mockgen go:generate comment to match the
pinned version used elsewhere in the repository and ensure reproducible mock
generation.
🤖 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 `@cmd/composition/composition.go`:
- Around line 91-93: The current implementation of the stack flag resolution at
lines 91-93 only checks the direct Cobra flag value, causing it to miss stack
values from environment variables and configuration files. Implement the full
configuration precedence chain by first attempting to resolve stack from the
Cobra flag, then falling back to environment variables if the flag is empty,
then to configuration file sources, and finally to defaults. Ensure the
info.Stack field is properly populated following the flags > environment
variables > config file > defaults precedence order.

In `@cmd/container/completions.go`:
- Around line 57-62: The container completion function is fetching all stacks
and all component types by passing empty strings to ExecuteDescribeStacks and
FilterAndListComponents, which allows it to suggest components from wrong stacks
or non-container types. Instead of passing an empty string as the second
parameter to ExecuteDescribeStacks, pass the actual stack name from the
completion context. Similarly, instead of passing an empty string as the first
parameter to FilterAndListComponents, pass "container" or the appropriate
component kind to ensure only matching components are returned for suggestions.

In `@cmd/container/verbs.go`:
- Around line 42-57: The help text for the container command definitions
(buildCmd, pushCmd, pullCmd, runCmd, upCmd) currently reference legacy key paths
using the `vars.*` notation which conflicts with the current container config
model. Update the long description strings for all these command definitions to
use first-class keys from the current container config model instead of
referencing `vars.build`, `vars.image`, and `vars.run`, removing the legacy
`vars.` prefix while maintaining the descriptive intent of each command's
documentation.
- Around line 18-20: Remove the FParseErrWhitelist configuration that allows
unknown flags from the newVerbCmd() function where it is currently set globally
for all commands. Instead, add this FParseErrWhitelist setting only to the
execCmd where it is actually needed to support passing arbitrary flags through
to the container after the `--` separator. This ensures that flag validation
remains active for other commands like build, push, pull, and run to catch typos
and invalid flags.

In `@cmd/list/components.go`:
- Around line 235-259: The enrichContainerRunningStatus function currently uses
context.Background() which ignores CLI cancellation and deadlines. Modify the
function signature to accept context.Context as the first parameter, then
replace the context.Background() call with the passed context parameter. Update
the function call to enrichContainerRunningStatus (near line 235) to pass the
command context instead of creating a new background context inside the
function.

In `@examples/compositions/README.md`:
- Around line 74-77: In the documentation text spanning lines 74-77, locate the
section with "component commands" and the semicolon before "`atmos list
components` shows their running state." Add a comma before the clause that
begins with "`atmos list`" to improve the readability and flow of the sentence,
making it grammatically clearer where the thought transition occurs.

In `@internal/exec/stack_processor_custom_inheritance_test.go`:
- Around line 35-41: The test in the block starting with the comment "Inherited
run.ports from the base" verifies that the ports slice has length 1, but does
not assert the actual values of the elements within it. After the require.Len
assertion on the ports variable, add additional assertions to verify the content
of at least the first element in the ports slice by checking its actual value
against the expected content. This ensures the merged slice contains not just
the correct cardinality but also the correct data.

In `@internal/exec/stack_processor_process_stacks.go`:
- Around line 874-877: The customComponentInheritsBases function currently
returns no bases when metadata.inherits is malformed or not a list, masking
validation errors. Modify customComponentInheritsBases to validate that
metadata.inherits is a list when present, and return an error if it is not
properly formatted. Update the call sites (around lines 874-877 and lines
912-922) to check the returned error and return it immediately instead of
silently ignoring validation failures, ensuring malformed inheritance
configurations are properly reported rather than silently skipped.

In `@pkg/component/container/container_test.go`:
- Around line 83-92: Update the ValidateComponent test cases to match the new
first-class key contract for the container schema. In the test cases where
vars.image and vars.build are currently nested under vars, move these properties
to be top-level keys in the component configuration map. The test calls at lines
85-88 and 89-92 should be updated so that image and build are direct properties
of the map passed to ValidateComponent, not nested within a vars sub-map.

In `@pkg/component/container/container.go`:
- Around line 90-98: The ValidateComponent function is checking for the legacy
schema where image and build are nested under the vars key (vars.image and
vars.build), but the new schema places these keys at the top level of the
config. Remove the vars extraction and validation logic, and instead check
directly in the config map for the presence of top-level "image" and "build"
keys using the same type assertion and existence checking pattern, ensuring the
error message accurately reflects that the component requires either a top-level
image or build configuration.

In `@pkg/component/container/executor_test.go`:
- Around line 63-65: The test verifies that c.Ports has exactly one element
using require.Len(t, c.Ports, 1), but it does not assert the actual content of
that port binding, allowing regressions to go undetected. After the len check
for c.Ports, add an assertion that validates the actual port binding value or
configuration at c.Ports[0] (or appropriate accessor based on the Ports
structure), similar to how the test asserts the values of c.Env["PORT"] and
c.Labels[ctr.LabelInstance]. This ensures both that the correct number of ports
exist and that their values are as expected.

In `@pkg/component/container/executor.go`:
- Around line 124-125: Update the error message on lines 124-125 in the
container executor to reference the first-class key `build` instead of the
legacy path `vars.build`. Change the error text from mentioning `vars.build` to
simply `build`. Apply the same change to the similar error messages at lines
467-471 to ensure consistency across all error messages that reference
configuration keys, replacing all references to `vars.build` and `vars.image`
with their first-class equivalents `build` and `image`.
- Around line 452-455: In the ImageInspect error handling block in the
executor.go file around line 452-455, the current logic treats all errors from
runtime.ImageInspect as "image not found" and falls through to build. Instead,
differentiate between error types: check if the error is specifically an
image-not-found error and only then fall through to the build logic; for all
other errors (transport, auth, runtime failures), return the error immediately.
Preserve the existing behavior where no error means the image exists locally and
nil is returned.

In `@pkg/composition/executor.go`:
- Around line 18-111: Add dedicated unit tests in
pkg/composition/composition_test.go to cover the new executor functions:
ExecuteValidate, collectMembers, collectStackMembers, claimsComposition, and
renderReport. These tests should verify stack traversal and data structure
handling, deduplication and sorting behavior in collectMembers, type assertion
safety in collectStackMembers and claimsComposition, and UI output formatting in
renderReport. Include test cases for edge cases such as missing sections,
invalid data types, and empty results to meet the minimum 80% test coverage
requirement.

In `@pkg/container/lifecycle.go`:
- Around line 123-126: The issue is that when runtime.Start fails in the
container lifecycle code, the cleanup attempt via runtime.Remove silently
discards any error it might encounter, potentially leaving an orphan container
without visibility into the failure. Capture the error returned from the
runtime.Remove call instead of discarding it with the blank identifier, then use
errors.Join to combine both the Start error and the Remove error if it occurs,
and include the combined error information in the fmt.Errorf return statement to
ensure operators can see both failures.

In `@pkg/datafetcher/schema/atmos/manifest/1.0.json`:
- Around line 461-474: The composition object schema currently permits empty
compositions without declaring the required service set. Add a required array to
the composition object definition that includes "services" to enforce that each
composition must explicitly declare which services may claim membership. This
ensures the validator cannot pass validation without the essential service set
configuration.
- Around line 417-421: The container_component_manifest definition in the schema
currently does not support the !include directive, while other
*_component_manifest definitions in this same schema file do support it. Update
the container_component_manifest definition to add !include support by using a
oneOf pattern that allows it to be either the object definition (with type and
additionalProperties) or a reference pattern matching how other component
manifests in the file support !include directives. This will make the schema
consistent across all component manifest types.

In `@website/docs/cli/commands/container/usage.mdx`:
- Around line 54-55: In the documentation text describing the up and run
commands, update the references to use the correct top-level component
configuration paths instead of nested under vars. Replace `vars.build` with
`build:` and replace `vars.image` with `image:` to match the actual YAML schema
structure where build and image are first-class sibling sections alongside
composition and env, not nested properties under vars.

In `@website/docs/components/components-overview.mdx`:
- Around line 105-113: The components-overview.mdx file now includes Container
as a supported component type in the table alongside Terraform/OpenTofu,
Helmfile, Packer, and Ansible. However, the "Next Steps" navigation section on
the same page does not include a link to the Container component documentation,
creating an inconsistency in navigation. Add a link entry for the Container
component in the "Next Steps" section of the page to match the structure and
provide consistent navigation for all five component types introduced in the
main table.

In `@website/docs/components/container.mdx`:
- Around line 56-62: The line containing `atmos container ps|logs|exec api -s
dev` uses shorthand notation that is not directly copy/paste executable and may
confuse users. Replace this single line with three separate, explicit command
lines showing each operation independently: one for `atmos container ps api -s
dev`, one for `atmos container logs api -s dev`, and one for `atmos container
exec api -s dev`. This ensures users can copy and paste each command directly
without interpretation errors.

---

Nitpick comments:
In `@cmd/container/container_test.go`:
- Around line 10-56: The command tests TestContainerCommandProvider,
TestContainerCommandStructure, TestContainerSubcommandsRequireComponent, and
TestStackFlagIsPersistent are missing the standard test kit initialization that
ensures proper RootCmd state isolation between tests. Add cmd.NewTestKit(t) at
the beginning of each of these test functions to follow the repository's
command-test isolation pattern and ensure proper cleanup of shared state.

In `@pkg/component/container/executor_test.go`:
- Around line 211-223: Add a complementary test function to verify the
negative-path behavior of ExecuteRestart when the container is not running.
Create a new test that sets up a mock Runtime with a non-running container
status (by calling runningInfo() with appropriate parameters or a different
status), and then verify the gomock.InOrder expectations that List is called
first, Stop is NOT called, and Start is called directly. This ensures the
restart logic correctly skips the stop operation when the container is not
already running, complementing the existing TestExecuteRestart_StopsThenStarts
test.

In `@pkg/component/container/executor.go`:
- Line 3: The go:generate directive in the executor.go file uses `@latest` for the
mockgen version, which causes non-reproducible builds and is inconsistent with
the rest of the codebase. Replace `@latest` with `@v0.6.0` in the mockgen
go:generate comment to match the pinned version used elsewhere in the repository
and ensure reproducible mock generation.

In `@pkg/composition/composition_test.go`:
- Around line 22-37: The TestValidateMembership function currently mixes four
test scenarios in a single linear flow, making it harder to identify which
specific case fails and harder to add new test cases. Refactor this function to
use a table-driven test pattern by defining a slice of test case structs (each
containing inputs like serviceName, compositionName, and expectedError, along
with a descriptive name), then iterate through each case using t.Run to execute
the ValidateMembership call and verify the expected error condition. This will
make individual test failures sharper and make it cheaper to add future test
cases.

In `@website/docs/cli/commands/container/usage.mdx`:
- Line 23: Replace the straight quotes around the phrase "your own Compose" with
curly quotes (typographic smart quotes) to match professional documentation
standards. The phrase currently uses straight double quotes and should be
changed to use opening and closing curly quotes instead.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d994bf78-dcc7-4789-8c8f-eb4eef9b1b7d

📥 Commits

Reviewing files that changed from the base of the PR and between b890cd8 and 34cad75.

📒 Files selected for processing (57)
  • .claude/skills/atmos-components
  • .claude/skills/atmos-core-component-development/SKILL.md
  • cmd/composition/composition.go
  • cmd/container/completions.go
  • cmd/container/container.go
  • cmd/container/container_test.go
  • cmd/container/flags.go
  • cmd/container/verbs.go
  • cmd/list/components.go
  • cmd/root.go
  • docs/prd/container-components.md
  • errors/errors.go
  • examples/compositions/README.md
  • examples/compositions/atmos.yaml
  • examples/compositions/stacks/deploy/dev.yaml
  • examples/compositions/stacks/deploy/local.yaml
  • examples/container-component/Dockerfile
  • examples/container-component/README.md
  • examples/container-component/atmos.yaml
  • examples/container-component/stacks/deploy/local.yaml
  • internal/exec/describe_component.go
  • internal/exec/describe_stacks.go
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/stack_processor_custom_inheritance_test.go
  • internal/exec/stack_processor_process_stacks.go
  • pkg/component/container/config.go
  • pkg/component/container/config_test.go
  • pkg/component/container/container.go
  • pkg/component/container/container_test.go
  • pkg/component/container/executor.go
  • pkg/component/container/executor_test.go
  • pkg/component/container/mock_runtime_test.go
  • pkg/composition/composition.go
  • pkg/composition/composition_test.go
  • pkg/composition/executor.go
  • pkg/config/const.go
  • pkg/container/common.go
  • pkg/container/identity.go
  • pkg/container/identity_test.go
  • pkg/container/lifecycle.go
  • pkg/container/lifecycle_test.go
  • pkg/container/runtime.go
  • pkg/container/sandbox.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • pkg/list/extract/components.go
  • pkg/list/extract/mock_runtime_test.go
  • pkg/list/extract/running_status.go
  • pkg/list/extract/running_status_test.go
  • pkg/schema/container_config.go
  • pkg/schema/schema.go
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
  • tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
  • tests/snapshots/TestCLICommands_help_flag_works.stdout.golden
  • website/docs/cli/commands/container/_category_.json
  • website/docs/cli/commands/container/usage.mdx
  • website/docs/components/components-overview.mdx
  • website/docs/components/container.mdx
💤 Files with no reviewable changes (1)
  • .claude/skills/atmos-components

Comment thread cmd/composition/composition.go Resolved
Comment thread cmd/container/completions.go Resolved
Comment thread cmd/container/verbs.go Resolved
Comment thread cmd/container/verbs.go Resolved
Comment thread cmd/list/components.go Resolved
Comment thread website/docs/components/container.mdx Resolved
Erik Osterman (Cloud Posse) (osterman) added a commit that referenced this pull request Jun 21, 2026
Apply CodeRabbit review fixes for PR #2645 (container component type +
compositions) and fix the failing Acceptance Tests.

First-class image/build contract:
- ValidateComponent and its tests check top-level image/build (not vars.*)
- executor error text and verb help/usage docs use first-class keys

Correctness/robustness:
- lifecycle.Up joins the cleanup error when Start fails (no orphan masking)
- ensureImage only builds on a genuine missing image; export and reuse
  IsImageMissingError so transport/auth/daemon errors surface
- composition + container resolve stack via viper (flag > env > config)
- container component completion filters by stack and container type
- scope FParseErrWhitelist to `exec` only so other verbs catch typos
- customComponentInheritsBases errors on malformed metadata.inherits

Schema:
- container_component_manifest accepts !include via oneOf
- compositions require non-empty, unique services
- classify ContainerSectionName in the schema-coverage ratchet

Tests/docs:
- assert port-binding values (not just length); add composition executor
  unit tests and a negative-path inherits test; docstrings on new exports
- doc fixes (comma, explicit ps/logs/exec commands, Next Steps link)

CI:
- regenerate TestCLICommands/atmos_non-existent snapshot to include the
  new composition and container commands

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@codecov

codecov Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.64655% with 299 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.30%. Comparing base (2c6912a) to head (31ce958).

Files with missing lines Patch % Lines
pkg/component/container/executor.go 78.36% 40 Missing and 34 partials ⚠️
pkg/component/container/container.go 54.45% 41 Missing and 5 partials ⚠️
pkg/component/container/logs.go 75.19% 22 Missing and 10 partials ⚠️
pkg/flags/interactive.go 12.50% 28 Missing ⚠️
pkg/container/lifecycle.go 80.00% 16 Missing and 10 partials ⚠️
cmd/container/container.go 83.11% 8 Missing and 5 partials ⚠️
internal/exec/stack_processor_process_stacks.go 80.32% 6 Missing and 6 partials ⚠️
pkg/component/container/config.go 94.25% 5 Missing and 5 partials ⚠️
cmd/composition/composition.go 74.28% 8 Missing and 1 partial ⚠️
pkg/component/container/list.go 93.79% 6 Missing and 2 partials ⚠️
... and 7 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2645      +/-   ##
==========================================
+ Coverage   80.25%   80.30%   +0.05%     
==========================================
  Files        1372     1387      +15     
  Lines      129684   131357    +1673     
==========================================
+ Hits       104081   105492    +1411     
- Misses      19835    20007     +172     
- Partials     5768     5858      +90     
Flag Coverage Δ
unittests 80.30% <82.64%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/container/flags.go 100.00% <100.00%> (ø)
cmd/root.go 71.37% <ø> (ø)
errors/errors.go 100.00% <ø> (ø)
internal/exec/describe_component.go 79.03% <100.00%> (+0.93%) ⬆️
internal/exec/describe_stacks.go 98.26% <100.00%> (+0.03%) ⬆️
...ternal/exec/describe_stacks_component_processor.go 95.88% <100.00%> (+0.01%) ⬆️
pkg/composition/composition.go 100.00% <100.00%> (ø)
pkg/composition/executor.go 100.00% <100.00%> (ø)
pkg/container/common.go 95.83% <100.00%> (+1.47%) ⬆️
pkg/container/ephemeral.go 95.67% <100.00%> (+0.02%) ⬆️
... and 27 more

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added size/xl Extra large size PR and removed size/l Large size PR labels Jun 21, 2026
@mergify

mergify Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

@mergify mergify Bot added conflict This PR has conflicts and removed conflict This PR has conflicts labels Jun 21, 2026
@mergify

mergify Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

@mergify mergify Bot added the conflict This PR has conflicts label Jun 22, 2026
Add a stack-scoped, Atmos-native `container` component kind: one component is
one persistent service. Atmos owns the image artifact (build/push/pull) and a
long-running named container lifecycle (list/up/ps/logs/exec/restart/stop/rm/down),
discovered by labels derived from the canonical component instance address
(`<stack>/container/<component>`) rather than local state files.

- pkg/container: identity (canonical labels, RuntimeName, DiscoveryFilter) +
  named lifecycle (Up/Down/FindInstance), sharing the sanitizer with sandbox.go.
- pkg/component/container: provider + executor for the verbs; first-class config
  (`image`/`build`/`run` reuse the workflow container-step structs, NOT `vars`);
  build-before-start; abstract components rejected.
- cmd/container + cmd/composition: thin CommandProvider command groups.
- `atmos container list` shows per-instance running state (label discovery). The
  generic `atmos list components` lists containers as a component type uniformly,
  without container-specific status (consistent with terraform/ansible).
- compositions: first-class `composition:` membership + `compositions:` section;
  hard error on undeclared membership; `atmos composition validate` soft report.
- Custom-component fallback now runs metadata.inherits inheritance + generic
  deep-merge of all top-level keys, so container honors catalog/abstract defaults.
- describe component auto-detect + describe/list type whitelist extended for
  container (and the pre-existing ansible gap in list components).
- Examples (container-component, compositions), docs, JSON schema, and a new
  atmos-core-component-development contributor skill.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Apply CodeRabbit review fixes for PR #2645 (container component type +
compositions) and fix the failing Acceptance Tests.

First-class image/build contract:
- ValidateComponent and its tests check top-level image/build (not vars.*)
- executor error text and verb help/usage docs use first-class keys

Correctness/robustness:
- lifecycle.Up joins the cleanup error when Start fails (no orphan masking)
- ensureImage only builds on a genuine missing image; export and reuse
  IsImageMissingError so transport/auth/daemon errors surface
- composition + container resolve stack via viper (flag > env > config)
- container component completion filters by stack and container type
- scope FParseErrWhitelist to `exec` only so other verbs catch typos
- customComponentInheritsBases errors on malformed metadata.inherits

Schema:
- container_component_manifest accepts !include via oneOf
- compositions require non-empty, unique services
- classify ContainerSectionName in the schema-coverage ratchet

Tests/docs:
- assert port-binding values (not just length); add composition executor
  unit tests and a negative-path inherits test; docstrings on new exports
- doc fixes (comma, explicit ps/logs/exec commands, Next Steps link)

CI:
- regenerate TestCLICommands/atmos_non-existent snapshot to include the
  new composition and container commands

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the two legacy label namespaces (com.cloudposse.atmos.* for
container-component instances and com.atmos.* for workflow sandboxes,
container steps, and devcontainers) with a single tools.atmos.* namespace
so the label vocabulary is consistent repo-wide.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add multi-component and interactive operation to the container component
lifecycle, mirroring docker compose, plus several UX fixes.

Bulk operation:
- build/push/pull/up/start/restart/stop/rm/down accept no component and
  operate on --all (optionally --stack-scoped) or via an interactive picker
  (stack, then multi-select of components). Continue-on-error with an
  aggregated summary; teardown verbs (down/stop/rm) run in reverse order.
- Reuse describeStacks + collectContainerInstances for target discovery;
  per-target dispatch reuses the existing single-component executors.

logs --all / --follow:
- logs takes an optional component plus --all/--follow/--tail. Multi-follow
  streams concurrently with a colored, centered, uppercased per-component
  label (log-level-badge style via pkg/ui/theme.ComponentLabelStyle), built
  on pkg/io.NewLinePrefixWriterRaw; degrades to [NAME] without color.
- Ctrl-C stops gracefully: suspends Atmos's global interrupt-exit
  (pkg/signals) and prints a friendly closing line instead of exiting 130.

start verb:
- Add `start` to resume an existing stopped container in place (inverse of
  stop; unlike up it never creates/recreates), restoring up/down + start/stop
  symmetry.

ps + list:
- `ps` no longer requires a component; with none it lists all components'
  running state (like `list`, optionally --stack-filtered).
- Fix list/ps column alignment: render the colored status dot outside
  tabwriter (its ANSI codes inflated the byte-counted column width).

Other:
- Spinners on lifecycle ops (build/push/pull/up/start/restart/stop/rm/down),
  matching the devcontainer UX.
- Fix the --stack flag being dropped for single-component invocations by
  rebinding the executing command's flags to Viper in runVerb.
- Give --tail a no-opt default so bare `--tail` does not swallow the next flag.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`atmos container push <component>` (and `push --all`) now pushes every entry
in `build.tags` instead of only the single top-level `image`. Because the build
already applies each tag to the image locally, listing registry-qualified tags
in `build.tags` ships the image to multiple registries in one operation. Pushes
run in order and fail fast; with no `build.tags`, push falls back to `image`
(unchanged behavior).

- pkg/component/container/config.go: ContainerSpec.PushRefs() returns the deduped,
  order-preserving build tags, else the single image.
- pkg/component/container/executor.go: ExecutePush fans out over PushRefs()
  (per-ref spinner, fail-fast, dry-run lists each ref).
- docs: dedicated "Push to multiple registries" section in the container usage
  page, plus Usage/Configuration/Examples mentions.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add Docker-Compose-style `run.healthcheck` and `run.restart` as first-class
container component properties, so users no longer need the raw `run.run_args`
passthrough. Health status is now surfaced in `atmos container ps`/`list`.

- `restart: { policy, max_retries }` -> docker/podman --restart=<policy>[:<n>]
- `healthcheck:` mirrors Compose (test string/list with NONE|CMD|CMD-SHELL,
  interval/timeout/retries/start_period/start_interval/disable) -> --health-*
  / --no-healthcheck
- ps/list gain a HEALTH column, parsed for free from the existing ps .Status
  string (no extra runtime call) in both docker and podman paths
- restart policy and healthcheck durations validated up front with friendly
  errors instead of opaque runtime failures
- JSON manifest schema, the container-component example, and the usage docs
  document the new settings

Adding the Health field to container.Info / instanceRow grew those structs, so
a few existing by-value range/param copies are switched to indexing/pointers to
satisfy gocritic (sandbox.go, podman.go, logs.go).

Plumbing mirrors the existing ports/mounts flow: schema.ContainerRunStep ->
ContainerSpec mappers/ValidateRun -> NamedConfig -> CreateConfig ->
addHealthAndRestart flag emitter.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Apply still-valid CodeRabbit findings; skip the rest with rationale.

Correctness/robustness:
- container: IsContainerRunning tokenizes status (no false match on
  "not running"); identity labels are now authoritative over caller
  labels in buildNamedCreateConfig (label-based discovery stays intact)
- container: CommandArgs tokenizes run.command with google/shlex so
  quoted args survive in ExecuteUp; errors on malformed quoting
- container logs: only "no running container" is skippable
  (new ErrNoRunningContainer sentinel); real discovery failures
  aggregate and surface; follow errors wrap a static sentinel
- ui: guard negative index in FormatComponentLabel and
  ComponentLabelStyle to avoid a negative-modulus panic
- stacks: non-string metadata.inherits items now error instead of
  being silently dropped
- schema: compositions accepts !include like peer sections

Tests/docs/cleanup:
- fail-loud fixture check; "not running" regression case; both-direction
  label isolation; ShellOptions IO propagation; ShellOptions test names;
  table-driven composition arg test; push stub Shell fails loudly;
  pin mockgen to v0.6.0; correct stale describe_stacks comment; e.g.,

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

Warning

Release Documentation Required

This PR is labeled minor or major and requires documentation updates:

  • Changelog entry - Add a blog post in website/blog/YYYY-MM-DD-feature-name.mdx
  • Roadmap update - Update website/src/data/roadmap.js with the new milestone

Alternatively: If this change doesn't require release documentation, remove the minor or major label.

@mergify mergify Bot removed the conflict This PR has conflicts label Jun 24, 2026
@github-actions

Copy link
Copy Markdown

Warning

Release Documentation Required

This PR is labeled minor or major and requires documentation updates:

  • Changelog entry - Add a blog post in website/blog/YYYY-MM-DD-feature-name.mdx
  • Roadmap update - Update website/src/data/roadmap.js with the new milestone

Alternatively: If this change doesn't require release documentation, remove the minor or major label.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 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 `@pkg/component/container/config.go`:
- Line 9: Replace the legacy mapstructure import statement in the config.go
file. Change the import path from "github.com/mitchellh/mapstructure" to
"github.com/go-viper/mapstructure/v2" to align with the rest of the codebase.
This ensures consistency across all imports since both versions are already in
go.mod and have compatible APIs.

In `@pkg/component/container/executor.go`:
- Around line 320-331: The ExecuteDown function and related destructive
lifecycle functions (ExecuteRestart, ExecuteStart, ExecuteStop, ExecuteRm) do
not check the r.dryRun flag before executing container mutations, unlike build,
push, pull, run, and up functions which already handle this. Add an early-return
pattern at the beginning of each of these destructive lifecycle functions:
immediately after getting the runtime and config (after the r2 call), check if
r.dryRun is true and return nil early to prevent any actual container changes.
This should be applied consistently to ExecuteDown, ExecuteRestart,
ExecuteStart, ExecuteStop, and ExecuteRm.
- Around line 94-117: The runtime method is passing only r.envList to the SetEnv
call, which causes the host environment variables to be completely replaced
instead of merged when applyCommandEnv processes the command environment. To fix
this, in the runtime method where setter.SetEnv(r.envList) is called, merge
r.envList with the host OS environment variables (obtainable via os.Environ())
so that component-specific environment variables are combined with essential
host variables like HOME, DOCKER_HOST, and proxy settings, then pass the merged
environment list to setter.SetEnv instead of just r.envList alone.

In `@pkg/component/container/list.go`:
- Around line 109-110: The inline comment on the continue statement in the
isAbstractComponent check is missing a period at the end. Add a period to the
end of the comment "abstract components are blueprints, not deployable
instances" to comply with Go coding guidelines that require all comments to end
with periods.

In `@pkg/runner/step/container_push_test.go`:
- Around line 17-73: The pushRuntime struct in container_push_test.go is a
hand-written test double that should be replaced with a generated mock. Remove
the entire pushRuntime struct definition and all its method implementations
(Build, Create, Start, Stop, Remove, Inspect, List, Exec, Shell, Attach, Pull,
Tag, Push, ImageInspect, Logs, Info). Instead, add a //go:generate directive at
the top of the file to use mockgen from go.uber.org/mock to generate a mock for
the container runtime interface, then update the test code to use the generated
mock with explicit expectations for the Tag and Push methods rather than relying
on manual call tracking.

In `@pkg/schema/workflow.go`:
- Around line 10-12: The ErrInvalidWorkflowContainer error is currently defined
locally in the schema package but must be moved to the central error registry
for consistency with the coding guidelines. Remove the
ErrInvalidWorkflowContainer variable declaration from workflow.go and add it to
the central errors registry file, then update any usages in workflow.go to
import and reference the error from the central registry instead of the local
definition.
- Around line 108-121: The ContainerHealthCheck struct has a Test field typed as
[]string with standard YAML tags, but the documentation indicates it should
accept both scalar strings and sequences. Implement a custom UnmarshalYAML
method for the ContainerHealthCheck struct (following the pattern used in the
existing WorkflowContainer.UnmarshalYAML) that handles unmarshaling the Test
field as either a scalar string or a sequence, converting scalar values into
single-element slices before assignment. Additionally, add regression tests that
verify both scalar (bare string) and list forms of the test field unmarshal
correctly.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bfb1e0b7-d7b0-42e1-a5af-afef1bd2cba1

📥 Commits

Reviewing files that changed from the base of the PR and between 163c9a5 and 9175f6a.

📒 Files selected for processing (101)
  • .claude/skills/atmos-components
  • .claude/skills/atmos-core-component-development/SKILL.md
  • agent-skills/skills/atmos-devcontainer/SKILL.md
  • cmd/composition/composition.go
  • cmd/composition/composition_test.go
  • cmd/container/completions.go
  • cmd/container/completions_fixture_test.go
  • cmd/container/completions_test.go
  • cmd/container/container.go
  • cmd/container/container_test.go
  • cmd/container/dispatch_test.go
  • cmd/container/flags.go
  • cmd/container/verbs.go
  • cmd/root.go
  • docs/prd/container-components.md
  • docs/prd/devcontainer-command.md
  • docs/prd/devcontainer-naming-convention.md
  • errors/errors.go
  • examples/compositions/README.md
  • examples/compositions/atmos.yaml
  • examples/compositions/stacks/deploy/dev.yaml
  • examples/compositions/stacks/deploy/local.yaml
  • examples/container-component/Dockerfile
  • examples/container-component/README.md
  • examples/container-component/atmos.yaml
  • examples/container-component/stacks/deploy/local.yaml
  • go.mod
  • internal/exec/describe_component.go
  • internal/exec/describe_stacks.go
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/stack_processor_custom_inheritance_test.go
  • internal/exec/stack_processor_process_stacks.go
  • pkg/component/container/bulk.go
  • pkg/component/container/bulk_test.go
  • pkg/component/container/config.go
  • pkg/component/container/config_test.go
  • pkg/component/container/container.go
  • pkg/component/container/container_test.go
  • pkg/component/container/executor.go
  • pkg/component/container/executor_extra_test.go
  • pkg/component/container/executor_start_test.go
  • pkg/component/container/executor_test.go
  • pkg/component/container/health_restart_test.go
  • pkg/component/container/list.go
  • pkg/component/container/list_test.go
  • pkg/component/container/logs.go
  • pkg/component/container/logs_test.go
  • pkg/component/container/mock_runtime_test.go
  • pkg/component/container/push_test.go
  • pkg/composition/composition.go
  • pkg/composition/composition_test.go
  • pkg/composition/executor.go
  • pkg/composition/executor_test.go
  • pkg/composition/executor_validate_test.go
  • pkg/config/const.go
  • pkg/container/common.go
  • pkg/container/common_test.go
  • pkg/container/docker.go
  • pkg/container/docker_test.go
  • pkg/container/ephemeral.go
  • pkg/container/ephemeral_test.go
  • pkg/container/health_restart_test.go
  • pkg/container/identity.go
  • pkg/container/identity_test.go
  • pkg/container/lifecycle.go
  • pkg/container/lifecycle_extra_test.go
  • pkg/container/lifecycle_test.go
  • pkg/container/mock_runtime_test.go
  • pkg/container/podman.go
  • pkg/container/podman_test.go
  • pkg/container/runtime.go
  • pkg/container/sandbox.go
  • pkg/container/sandbox_test.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • pkg/datafetcher/schema_section_coverage_test.go
  • pkg/devcontainer/lifecycle_attach.go
  • pkg/devcontainer/lifecycle_attach_test.go
  • pkg/devcontainer/mock_runtime_test.go
  • pkg/devcontainer/naming.go
  • pkg/flags/interactive.go
  • pkg/flags/interactive_test.go
  • pkg/io/line_prefix_writer.go
  • pkg/io/line_prefix_writer_test.go
  • pkg/list/extract/components.go
  • pkg/runner/step/container_push_test.go
  • pkg/runner/step/container_run.go
  • pkg/schema/container_config.go
  • pkg/schema/schema.go
  • pkg/schema/workflow.go
  • pkg/ui/formatter.go
  • pkg/ui/formatter_test.go
  • pkg/ui/theme/log_styles.go
  • pkg/ui/theme/log_styles_test.go
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
  • tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • tests/snapshots/TestCLICommands_help_flag_works.stdout.golden
  • website/docs/cli/commands/container/_category_.json
  • website/docs/cli/commands/container/usage.mdx
  • website/docs/components/components-overview.mdx
  • website/docs/components/container.mdx
💤 Files with no reviewable changes (9)
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
  • .claude/skills/atmos-components
  • website/docs/cli/commands/container/category.json
  • tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • website/docs/components/container.mdx
  • tests/snapshots/TestCLICommands_help_flag_works.stdout.golden
  • website/docs/components/components-overview.mdx
  • website/docs/cli/commands/container/usage.mdx
✅ Files skipped from review due to trivial changes (13)
  • examples/container-component/atmos.yaml
  • pkg/container/sandbox_test.go
  • cmd/container/completions_test.go
  • pkg/container/ephemeral_test.go
  • pkg/io/line_prefix_writer_test.go
  • agent-skills/skills/atmos-devcontainer/SKILL.md
  • examples/container-component/README.md
  • examples/compositions/atmos.yaml
  • pkg/runner/step/container_run.go
  • docs/prd/devcontainer-naming-convention.md
  • docs/prd/devcontainer-command.md
  • pkg/config/const.go
  • pkg/component/container/mock_runtime_test.go
🚧 Files skipped from review as they are similar to previous changes (62)
  • pkg/devcontainer/mock_runtime_test.go
  • examples/compositions/stacks/deploy/dev.yaml
  • cmd/container/flags.go
  • examples/container-component/Dockerfile
  • pkg/schema/container_config.go
  • pkg/list/extract/components.go
  • pkg/composition/executor_validate_test.go
  • pkg/ui/formatter.go
  • pkg/ui/theme/log_styles_test.go
  • cmd/root.go
  • pkg/flags/interactive_test.go
  • pkg/container/ephemeral.go
  • pkg/devcontainer/lifecycle_attach.go
  • pkg/devcontainer/naming.go
  • pkg/devcontainer/lifecycle_attach_test.go
  • cmd/container/completions_fixture_test.go
  • pkg/component/container/bulk.go
  • cmd/composition/composition_test.go
  • internal/exec/describe_stacks_component_processor.go
  • pkg/datafetcher/schema_section_coverage_test.go
  • cmd/container/container_test.go
  • pkg/component/container/executor_start_test.go
  • examples/compositions/stacks/deploy/local.yaml
  • pkg/component/container/container_test.go
  • pkg/ui/theme/log_styles.go
  • internal/exec/stack_processor_custom_inheritance_test.go
  • cmd/container/completions.go
  • pkg/container/sandbox.go
  • pkg/io/line_prefix_writer.go
  • pkg/flags/interactive.go
  • pkg/composition/composition_test.go
  • pkg/component/container/push_test.go
  • pkg/composition/executor.go
  • cmd/container/container.go
  • cmd/container/verbs.go
  • pkg/composition/executor_test.go
  • pkg/component/container/list_test.go
  • pkg/container/runtime.go
  • pkg/component/container/executor_extra_test.go
  • cmd/composition/composition.go
  • internal/exec/describe_stacks.go
  • pkg/container/docker_test.go
  • pkg/container/lifecycle_test.go
  • pkg/component/container/config_test.go
  • cmd/container/dispatch_test.go
  • pkg/ui/formatter_test.go
  • pkg/schema/schema.go
  • pkg/component/container/logs_test.go
  • pkg/component/container/container.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • pkg/container/mock_runtime_test.go
  • pkg/component/container/bulk_test.go
  • pkg/container/lifecycle.go
  • pkg/composition/composition.go
  • pkg/container/identity.go
  • internal/exec/describe_component.go
  • pkg/container/identity_test.go
  • pkg/container/podman_test.go
  • pkg/component/container/logs.go
  • pkg/container/common_test.go
  • internal/exec/stack_processor_process_stacks.go
  • pkg/component/container/executor_test.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 7

🤖 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 `@pkg/component/container/config.go`:
- Line 9: Replace the legacy mapstructure import statement in the config.go
file. Change the import path from "github.com/mitchellh/mapstructure" to
"github.com/go-viper/mapstructure/v2" to align with the rest of the codebase.
This ensures consistency across all imports since both versions are already in
go.mod and have compatible APIs.

In `@pkg/component/container/executor.go`:
- Around line 320-331: The ExecuteDown function and related destructive
lifecycle functions (ExecuteRestart, ExecuteStart, ExecuteStop, ExecuteRm) do
not check the r.dryRun flag before executing container mutations, unlike build,
push, pull, run, and up functions which already handle this. Add an early-return
pattern at the beginning of each of these destructive lifecycle functions:
immediately after getting the runtime and config (after the r2 call), check if
r.dryRun is true and return nil early to prevent any actual container changes.
This should be applied consistently to ExecuteDown, ExecuteRestart,
ExecuteStart, ExecuteStop, and ExecuteRm.
- Around line 94-117: The runtime method is passing only r.envList to the SetEnv
call, which causes the host environment variables to be completely replaced
instead of merged when applyCommandEnv processes the command environment. To fix
this, in the runtime method where setter.SetEnv(r.envList) is called, merge
r.envList with the host OS environment variables (obtainable via os.Environ())
so that component-specific environment variables are combined with essential
host variables like HOME, DOCKER_HOST, and proxy settings, then pass the merged
environment list to setter.SetEnv instead of just r.envList alone.

In `@pkg/component/container/list.go`:
- Around line 109-110: The inline comment on the continue statement in the
isAbstractComponent check is missing a period at the end. Add a period to the
end of the comment "abstract components are blueprints, not deployable
instances" to comply with Go coding guidelines that require all comments to end
with periods.

In `@pkg/runner/step/container_push_test.go`:
- Around line 17-73: The pushRuntime struct in container_push_test.go is a
hand-written test double that should be replaced with a generated mock. Remove
the entire pushRuntime struct definition and all its method implementations
(Build, Create, Start, Stop, Remove, Inspect, List, Exec, Shell, Attach, Pull,
Tag, Push, ImageInspect, Logs, Info). Instead, add a //go:generate directive at
the top of the file to use mockgen from go.uber.org/mock to generate a mock for
the container runtime interface, then update the test code to use the generated
mock with explicit expectations for the Tag and Push methods rather than relying
on manual call tracking.

In `@pkg/schema/workflow.go`:
- Around line 10-12: The ErrInvalidWorkflowContainer error is currently defined
locally in the schema package but must be moved to the central error registry
for consistency with the coding guidelines. Remove the
ErrInvalidWorkflowContainer variable declaration from workflow.go and add it to
the central errors registry file, then update any usages in workflow.go to
import and reference the error from the central registry instead of the local
definition.
- Around line 108-121: The ContainerHealthCheck struct has a Test field typed as
[]string with standard YAML tags, but the documentation indicates it should
accept both scalar strings and sequences. Implement a custom UnmarshalYAML
method for the ContainerHealthCheck struct (following the pattern used in the
existing WorkflowContainer.UnmarshalYAML) that handles unmarshaling the Test
field as either a scalar string or a sequence, converting scalar values into
single-element slices before assignment. Additionally, add regression tests that
verify both scalar (bare string) and list forms of the test field unmarshal
correctly.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bfb1e0b7-d7b0-42e1-a5af-afef1bd2cba1

📥 Commits

Reviewing files that changed from the base of the PR and between 163c9a5 and 9175f6a.

📒 Files selected for processing (101)
  • .claude/skills/atmos-components
  • .claude/skills/atmos-core-component-development/SKILL.md
  • agent-skills/skills/atmos-devcontainer/SKILL.md
  • cmd/composition/composition.go
  • cmd/composition/composition_test.go
  • cmd/container/completions.go
  • cmd/container/completions_fixture_test.go
  • cmd/container/completions_test.go
  • cmd/container/container.go
  • cmd/container/container_test.go
  • cmd/container/dispatch_test.go
  • cmd/container/flags.go
  • cmd/container/verbs.go
  • cmd/root.go
  • docs/prd/container-components.md
  • docs/prd/devcontainer-command.md
  • docs/prd/devcontainer-naming-convention.md
  • errors/errors.go
  • examples/compositions/README.md
  • examples/compositions/atmos.yaml
  • examples/compositions/stacks/deploy/dev.yaml
  • examples/compositions/stacks/deploy/local.yaml
  • examples/container-component/Dockerfile
  • examples/container-component/README.md
  • examples/container-component/atmos.yaml
  • examples/container-component/stacks/deploy/local.yaml
  • go.mod
  • internal/exec/describe_component.go
  • internal/exec/describe_stacks.go
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/stack_processor_custom_inheritance_test.go
  • internal/exec/stack_processor_process_stacks.go
  • pkg/component/container/bulk.go
  • pkg/component/container/bulk_test.go
  • pkg/component/container/config.go
  • pkg/component/container/config_test.go
  • pkg/component/container/container.go
  • pkg/component/container/container_test.go
  • pkg/component/container/executor.go
  • pkg/component/container/executor_extra_test.go
  • pkg/component/container/executor_start_test.go
  • pkg/component/container/executor_test.go
  • pkg/component/container/health_restart_test.go
  • pkg/component/container/list.go
  • pkg/component/container/list_test.go
  • pkg/component/container/logs.go
  • pkg/component/container/logs_test.go
  • pkg/component/container/mock_runtime_test.go
  • pkg/component/container/push_test.go
  • pkg/composition/composition.go
  • pkg/composition/composition_test.go
  • pkg/composition/executor.go
  • pkg/composition/executor_test.go
  • pkg/composition/executor_validate_test.go
  • pkg/config/const.go
  • pkg/container/common.go
  • pkg/container/common_test.go
  • pkg/container/docker.go
  • pkg/container/docker_test.go
  • pkg/container/ephemeral.go
  • pkg/container/ephemeral_test.go
  • pkg/container/health_restart_test.go
  • pkg/container/identity.go
  • pkg/container/identity_test.go
  • pkg/container/lifecycle.go
  • pkg/container/lifecycle_extra_test.go
  • pkg/container/lifecycle_test.go
  • pkg/container/mock_runtime_test.go
  • pkg/container/podman.go
  • pkg/container/podman_test.go
  • pkg/container/runtime.go
  • pkg/container/sandbox.go
  • pkg/container/sandbox_test.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • pkg/datafetcher/schema_section_coverage_test.go
  • pkg/devcontainer/lifecycle_attach.go
  • pkg/devcontainer/lifecycle_attach_test.go
  • pkg/devcontainer/mock_runtime_test.go
  • pkg/devcontainer/naming.go
  • pkg/flags/interactive.go
  • pkg/flags/interactive_test.go
  • pkg/io/line_prefix_writer.go
  • pkg/io/line_prefix_writer_test.go
  • pkg/list/extract/components.go
  • pkg/runner/step/container_push_test.go
  • pkg/runner/step/container_run.go
  • pkg/schema/container_config.go
  • pkg/schema/schema.go
  • pkg/schema/workflow.go
  • pkg/ui/formatter.go
  • pkg/ui/formatter_test.go
  • pkg/ui/theme/log_styles.go
  • pkg/ui/theme/log_styles_test.go
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
  • tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • tests/snapshots/TestCLICommands_help_flag_works.stdout.golden
  • website/docs/cli/commands/container/_category_.json
  • website/docs/cli/commands/container/usage.mdx
  • website/docs/components/components-overview.mdx
  • website/docs/components/container.mdx
💤 Files with no reviewable changes (9)
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
  • .claude/skills/atmos-components
  • website/docs/cli/commands/container/category.json
  • tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • website/docs/components/container.mdx
  • tests/snapshots/TestCLICommands_help_flag_works.stdout.golden
  • website/docs/components/components-overview.mdx
  • website/docs/cli/commands/container/usage.mdx
✅ Files skipped from review due to trivial changes (13)
  • examples/container-component/atmos.yaml
  • pkg/container/sandbox_test.go
  • cmd/container/completions_test.go
  • pkg/container/ephemeral_test.go
  • pkg/io/line_prefix_writer_test.go
  • agent-skills/skills/atmos-devcontainer/SKILL.md
  • examples/container-component/README.md
  • examples/compositions/atmos.yaml
  • pkg/runner/step/container_run.go
  • docs/prd/devcontainer-naming-convention.md
  • docs/prd/devcontainer-command.md
  • pkg/config/const.go
  • pkg/component/container/mock_runtime_test.go
🚧 Files skipped from review as they are similar to previous changes (62)
  • pkg/devcontainer/mock_runtime_test.go
  • examples/compositions/stacks/deploy/dev.yaml
  • cmd/container/flags.go
  • examples/container-component/Dockerfile
  • pkg/schema/container_config.go
  • pkg/list/extract/components.go
  • pkg/composition/executor_validate_test.go
  • pkg/ui/formatter.go
  • pkg/ui/theme/log_styles_test.go
  • cmd/root.go
  • pkg/flags/interactive_test.go
  • pkg/container/ephemeral.go
  • pkg/devcontainer/lifecycle_attach.go
  • pkg/devcontainer/naming.go
  • pkg/devcontainer/lifecycle_attach_test.go
  • cmd/container/completions_fixture_test.go
  • pkg/component/container/bulk.go
  • cmd/composition/composition_test.go
  • internal/exec/describe_stacks_component_processor.go
  • pkg/datafetcher/schema_section_coverage_test.go
  • cmd/container/container_test.go
  • pkg/component/container/executor_start_test.go
  • examples/compositions/stacks/deploy/local.yaml
  • pkg/component/container/container_test.go
  • pkg/ui/theme/log_styles.go
  • internal/exec/stack_processor_custom_inheritance_test.go
  • cmd/container/completions.go
  • pkg/container/sandbox.go
  • pkg/io/line_prefix_writer.go
  • pkg/flags/interactive.go
  • pkg/composition/composition_test.go
  • pkg/component/container/push_test.go
  • pkg/composition/executor.go
  • cmd/container/container.go
  • cmd/container/verbs.go
  • pkg/composition/executor_test.go
  • pkg/component/container/list_test.go
  • pkg/container/runtime.go
  • pkg/component/container/executor_extra_test.go
  • cmd/composition/composition.go
  • internal/exec/describe_stacks.go
  • pkg/container/docker_test.go
  • pkg/container/lifecycle_test.go
  • pkg/component/container/config_test.go
  • cmd/container/dispatch_test.go
  • pkg/ui/formatter_test.go
  • pkg/schema/schema.go
  • pkg/component/container/logs_test.go
  • pkg/component/container/container.go
  • pkg/datafetcher/schema/atmos/manifest/1.0.json
  • pkg/container/mock_runtime_test.go
  • pkg/component/container/bulk_test.go
  • pkg/container/lifecycle.go
  • pkg/composition/composition.go
  • pkg/container/identity.go
  • internal/exec/describe_component.go
  • pkg/container/identity_test.go
  • pkg/container/podman_test.go
  • pkg/component/container/logs.go
  • pkg/container/common_test.go
  • internal/exec/stack_processor_process_stacks.go
  • pkg/component/container/executor_test.go
🛑 Comments failed to post (7)
pkg/component/container/config.go (1)

9-9: 🎯 Functional Correctness | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Imports in config.go:"
rg -n '"github.com/(mitchellh/mapstructure|go-viper/mapstructure/v2)"' pkg/component/container/config.go

echo
echo "Declared mapstructure modules:"
rg -n 'mapstructure' go.mod go.sum

Repository: cloudposse/atmos

Length of output: 879


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "All mapstructure imports in codebase:"
rg -n 'github\.com/(mitchellh/mapstructure|go-viper/mapstructure)' --type go | head -20

echo ""
echo "Files importing mapstructure by version:"
rg 'github\.com/(mitchellh/mapstructure|go-viper/mapstructure)' --type go -l | while read file; do
  echo "File: $file"
  rg 'github\.com/(mitchellh/mapstructure|go-viper/mapstructure)' "$file" | head -1
done

Repository: cloudposse/atmos

Length of output: 192


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Searching for all mapstructure imports:"
rg 'mapstructure' --type go -l

echo ""
echo "Count of files mentioning mapstructure:"
rg 'mapstructure' --type go -l | wc -l

Repository: cloudposse/atmos

Length of output: 202


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Direct grep for mapstructure in Go files:"
grep -r "mapstructure" --include="*.go" . 2>/dev/null | grep -E "import|github.com" | head -10

echo ""
echo "Check if config.go actually uses mapstructure (not just imports):"
grep -A 20 "mapstructure" pkg/component/container/config.go | head -15

Repository: cloudposse/atmos

Length of output: 1627


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Check for actual mapstructure usage in config.go:"
grep -E "mapstructure\." pkg/component/container/config.go

echo ""
echo "Line count and full imports section of config.go:"
head -20 pkg/component/container/config.go

Repository: cloudposse/atmos

Length of output: 850


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Lines in config.go where mapstructure is actually used:"
grep -n "mapstructure\." pkg/component/container/config.go

echo ""
echo "Check mapstructure API between v1 and v2:"
echo "V1 path: github.com/mitchellh/mapstructure"
echo "V2 path: github.com/go-viper/mapstructure/v2"
echo ""
echo "Import style check - how v2 is used in other files:"
grep -A 2 "github.com/go-viper/mapstructure/v2" ./internal/exec/stack_processor_utils.go | head -10

Repository: cloudposse/atmos

Length of output: 649


Update the mapstructure import to match the rest of the codebase.

The file imports the legacy github.com/mitchellh/mapstructure v1 path, but every other file in the codebase (errors/, internal/exec/, etc.) has migrated to github.com/go-viper/mapstructure/v2. Since both versions are in go.mod and the API is compatible, update line 9 to import github.com/go-viper/mapstructure/v2 for consistency.

🤖 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 `@pkg/component/container/config.go` at line 9, Replace the legacy mapstructure
import statement in the config.go file. Change the import path from
"github.com/mitchellh/mapstructure" to "github.com/go-viper/mapstructure/v2" to
align with the rest of the codebase. This ensures consistency across all imports
since both versions are already in go.mod and have compatible APIs.
pkg/component/container/executor.go (2)

94-117: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Preserve the host environment for Docker/Podman subprocesses.

Line 116 passes only r.envList to the runtime. Since applyCommandEnv replaces cmd.Env when non-empty, any component with env: drops host values like HOME, DOCKER_HOST, proxy vars, or runtime auth env from the Docker/Podman CLI process.

Suggested fix
 import (
 	"context"
 	"fmt"
+	"os"
 	"strings"
 	"time"
@@
 	if setter, ok := runtime.(ctr.EnvSetter); ok {
-		setter.SetEnv(r.envList)
+		setter.SetEnv(append(os.Environ(), r.envList...))
 	}
🤖 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 `@pkg/component/container/executor.go` around lines 94 - 117, The runtime
method is passing only r.envList to the SetEnv call, which causes the host
environment variables to be completely replaced instead of merged when
applyCommandEnv processes the command environment. To fix this, in the runtime
method where setter.SetEnv(r.envList) is called, merge r.envList with the host
OS environment variables (obtainable via os.Environ()) so that
component-specific environment variables are combined with essential host
variables like HOME, DOCKER_HOST, and proxy settings, then pass the merged
environment list to setter.SetEnv instead of just r.envList alone.

320-331: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Honor dry-run before destructive lifecycle actions.

r.dryRun is handled for build, push, pull, run, and up, but down, restart, start, stop, and rm still call runtime stop/start/remove paths. A dry-run should not mutate containers, and ideally should not require runtime discovery.

Suggested pattern
 func ExecuteDown(ctx context.Context, info *schema.ConfigAndStacksInfo) error {
 	defer perf.Track(nil, "container.ExecuteDown")()
 
-	r, runtime, err := r2(ctx, info)
+	r, err := prepare(info)
 	if err != nil {
 		return err
 	}
+	if r.dryRun {
+		ui.Infof("[dry-run] down %s", r.component)
+		return nil
+	}
+	runtime, err := r.runtime(ctx)
+	if err != nil {
+		return err
+	}
 	return spinner.ExecWithSpinner(

Apply the same early-return pattern to restart, start, stop, and rm.

Also applies to: 388-467

🤖 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 `@pkg/component/container/executor.go` around lines 320 - 331, The ExecuteDown
function and related destructive lifecycle functions (ExecuteRestart,
ExecuteStart, ExecuteStop, ExecuteRm) do not check the r.dryRun flag before
executing container mutations, unlike build, push, pull, run, and up functions
which already handle this. Add an early-return pattern at the beginning of each
of these destructive lifecycle functions: immediately after getting the runtime
and config (after the r2 call), check if r.dryRun is true and return nil early
to prevent any actual container changes. This should be applied consistently to
ExecuteDown, ExecuteRestart, ExecuteStart, ExecuteStop, and ExecuteRm.
pkg/component/container/list.go (1)

109-110: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the inline comment punctuation.

Line 110 should end with a period.

Suggested fix
-				continue // abstract components are blueprints, not deployable instances
+				continue // Abstract components are blueprints, not deployable instances.

As per coding guidelines, all Go comments must end with periods.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

			if isAbstractComponent(compData) {
				continue // Abstract components are blueprints, not deployable instances.
🤖 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 `@pkg/component/container/list.go` around lines 109 - 110, The inline comment
on the continue statement in the isAbstractComponent check is missing a period
at the end. Add a period to the end of the comment "abstract components are
blueprints, not deployable instances" to comply with Go coding guidelines that
require all comments to end with periods.

Source: Coding guidelines

pkg/runner/step/container_push_test.go (1)

17-73: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Replace manual pushRuntime with a generated mock.

This hand-written test double is likely to drift and can mask unexpected method calls. Please switch to a mockgen-generated runtime mock and explicit expectations.

As per coding guidelines, "Generate mocks with go.uber.org/mock/mockgen using //go:generate directives. Never manual mocks."

🤖 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 `@pkg/runner/step/container_push_test.go` around lines 17 - 73, The pushRuntime
struct in container_push_test.go is a hand-written test double that should be
replaced with a generated mock. Remove the entire pushRuntime struct definition
and all its method implementations (Build, Create, Start, Stop, Remove, Inspect,
List, Exec, Shell, Attach, Pull, Tag, Push, ImageInspect, Logs, Info). Instead,
add a //go:generate directive at the top of the file to use mockgen from
go.uber.org/mock to generate a mock for the container runtime interface, then
update the test code to use the generated mock with explicit expectations for
the Tag and Push methods rather than relying on manual call tracking.

Source: Coding guidelines

pkg/schema/workflow.go (2)

10-12: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Move ErrInvalidWorkflowContainer to the central error registry.

This sentinel is declared locally in pkg/schema; policy requires static errors to live in errors/errors.go and be wrapped from there for consistency.

As per coding guidelines, "All errors MUST be wrapped using static errors defined in errors/errors.go... NEVER use dynamic errors directly."

🤖 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 `@pkg/schema/workflow.go` around lines 10 - 12, The ErrInvalidWorkflowContainer
error is currently defined locally in the schema package but must be moved to
the central error registry for consistency with the coding guidelines. Remove
the ErrInvalidWorkflowContainer variable declaration from workflow.go and add it
to the central errors registry file, then update any usages in workflow.go to
import and reference the error from the central registry instead of the local
definition.

Source: Coding guidelines


108-121: 🎯 Functional Correctness | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

In gopkg.in/yaml.v3, when unmarshalling YAML into a struct field of type []string, does a scalar value like test: "curl -f http://localhost || exit 1" decode successfully or return an error?

💡 Result:

In gopkg.in/yaml.v3, unmarshalling a YAML scalar value (such as a string) into a struct field of type []string will return an error [1][2]. The library expects a YAML sequence (e.g., [item1, item2] or block format) when unmarshalling into a slice type [3][2]. If you provide a single scalar value instead of a sequence, the unmarshaller will fail because it cannot decode the scalar into the slice [2]. For instance, if your YAML is test: "curl -f http://localhost || exit 1", and the corresponding struct field is Test []string, the operation will report a type mismatch error (e.g., "cannot unmarshal!!str into []string") [1][2]. To successfully decode both single values and sequences into the same struct field, you would need to implement the Unmarshaler interface for that field or type, allowing custom logic to handle both scalar and sequence nodes manually [1].

Citations:


🏁 Script executed:

# Search for ContainerHealthCheck in the codebase to find its definition and any custom unmarshaling
rg -A 20 "type ContainerHealthCheck" pkg/schema/workflow.go

# Search for UnmarshalYAML or Unmarshaler implementations for this type
rg -B 5 -A 15 "func.*ContainerHealthCheck.*Unmarshal" pkg/schema/

# Search for test files related to workflow.go or healthcheck
fd -e test.go -e _test.go pkg/schema/ | head -20

Repository: cloudposse/atmos

Length of output: 2802


🏁 Script executed:

# Search for test cases involving healthcheck and "test" field
rg -i "healthcheck|test.*:" pkg/schema/ -A 3 -B 3 --type go | head -100

Repository: cloudposse/atmos

Length of output: 6427


🏁 Script executed:

# Look for any YAML processing or custom decoding logic in schema package
ast-grep outline pkg/schema/workflow.go | grep -i health

Repository: cloudposse/atmos

Length of output: 355


🏁 Script executed:

# Search for UnmarshalYAML method on ContainerHealthCheck
rg "func.*ContainerHealthCheck.*UnmarshalYAML" pkg/schema/ -A 10

# Also search for any custom unmarshaling on the Test field
rg "func.*Test.*UnmarshalYAML" pkg/schema/ -A 10

# Search more broadly for Unmarshaler implementations in workflow.go
rg "UnmarshalYAML|Unmarshal" pkg/schema/workflow.go -B 2 -A 10

Repository: cloudposse/atmos

Length of output: 14792


🏁 Script executed:

# Check workflow_container_test.go for healthcheck tests
wc -l pkg/schema/workflow_container_test.go
head -100 pkg/schema/workflow_container_test.go

Repository: cloudposse/atmos

Length of output: 1941


🏁 Script executed:

# Search for actual healthcheck test YAML with test field
rg -A 5 "healthcheck:" pkg/schema/workflow_container_test.go

Repository: cloudposse/atmos

Length of output: 154


🏁 Script executed:

# Read the full workflow_container_test.go to see all tests
cat -n pkg/schema/workflow_container_test.go

Repository: cloudposse/atmos

Length of output: 2376


🏁 Script executed:

# Search for healthcheck in all test files
rg "healthcheck" pkg/schema/ -i --type go

Repository: cloudposse/atmos

Length of output: 855


🏁 Script executed:

# Check if there's any custom unmarshaling logic for healthcheck or the Test field
ast-grep outline pkg/schema/workflow.go --match "ContainerHealthCheck"

Repository: cloudposse/atmos

Length of output: 301


🏁 Script executed:

# Check if mapstructure is used for decoding and if it has different behavior
rg "mapstructure" pkg/schema/workflow.go -B 2 -A 2

# Search for any preprocessing or custom decoding of workflow data
rg "ContainerHealthCheck" pkg/ --type go -B 3 -A 3

# Look for any mapstructure-based decoding in the codebase
fd -e "*.go" -x grep -l "mapstructure.*Decode\|mapstructure.*UnmarshalYAML" {} \;

Repository: cloudposse/atmos

Length of output: 30576


🏁 Script executed:

# Check if there are integration tests or examples using healthcheck
fd -e "*.yaml" -e "*.yml" . | xargs grep -l "healthcheck" 2>/dev/null | head -5

Repository: cloudposse/atmos

Length of output: 154


🏁 Script executed:

# Look for any UnmarshalYAML on the Test field or in neighboring code
rg "UnmarshalYAML" pkg/schema/workflow.go -B 5 -A 20

# Also check if there's mapstructure customization
rg "DecodeHook\|TextUnmarshaler\|UnmarshalText" pkg/schema/ -i --type go

# Check the container component for any custom decoding
cat -n pkg/component/container/config.go | head -50

Repository: cloudposse/atmos

Length of output: 3157


🏁 Script executed:

# Test creating a simple YAML with scalar test field to verify behavior
python3 << 'PY'
import subprocess
import tempfile
import os

# Create a minimal Go test to check actual behavior
test_code = '''package main

import (
	"fmt"
	"gopkg.in/yaml.v3"
)

type ContainerHealthCheck struct {
	Test []string `yaml:"test"`
}

func main() {
	// Test 1: scalar value
	yamlScalar := `+"`test: \"curl -f http://localhost || exit 1\"`"+`
	var hc1 ContainerHealthCheck
	err1 := yaml.Unmarshal([]byte(yamlScalar), &hc1)
	if err1 != nil {
		fmt.Printf("Scalar test FAILED: %v\n", err1)
	} else {
		fmt.Printf("Scalar test PASSED: %v\n", hc1.Test)
	}

	// Test 2: list value
	yamlList := `+"`test: [\"curl\", \"-f\", \"http://localhost\"]`"+`
	var hc2 ContainerHealthCheck
	err2 := yaml.Unmarshal([]byte(yamlList), &hc2)
	if err2 != nil {
		fmt.Printf("List test FAILED: %v\n", err2)
	} else {
		fmt.Printf("List test PASSED: %v\n", hc2.Test)
	}
}
'''

# Write to a temp file and try to run (this will fail in sandbox, but we can see the code)
print("Test code that would verify scalar vs list decoding:")
print(test_code)
PY

Repository: cloudposse/atmos

Length of output: 929


Add custom UnmarshalYAML to handle scalar healthcheck.test values.

The comment documents that test may be a bare string, but the field is typed as []string with standard yaml tags. Without custom unmarshaling logic, yaml.v3 will fail when given a scalar (e.g., test: "curl -f http://localhost || exit 1"). The codebase already demonstrates this pattern with WorkflowContainer.UnmarshalYAML. Implement the same for ContainerHealthCheck to accept both scalar and sequence forms, converting scalars to single-element slices. Add regression tests for both scalar and list input.

🤖 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 `@pkg/schema/workflow.go` around lines 108 - 121, The ContainerHealthCheck
struct has a Test field typed as []string with standard YAML tags, but the
documentation indicates it should accept both scalar strings and sequences.
Implement a custom UnmarshalYAML method for the ContainerHealthCheck struct
(following the pattern used in the existing WorkflowContainer.UnmarshalYAML)
that handles unmarshaling the Test field as either a scalar string or a
sequence, converting scalar values into single-element slices before assignment.
Additionally, add regression tests that verify both scalar (bare string) and
list forms of the test field unmarshal correctly.

…tone

PR #2645 is labeled `minor`, so the release-docs gate requires a changelog
entry and a roadmap update for the user-facing container component kind +
compositions feature.

- Add website/blog/2026-06-23-container-components.mdx (slug: container-components)
- Mark the "Container components with component-instance lifecycle" and
  "Atmos compositions as system boundaries" milestones as shipped in the
  Container Composition & Local Development initiative (pr: 2645,
  changelog: container-components); recompute progress 29% -> 57%

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
website/src/data/roadmap.js (1)

314-316: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Add PR 2645 to the initiative-level prs list.

Two shipped milestones now reference pr: 2645, but this initiative’s prs array still only contains 2607. Keeping these in sync avoids metadata drift in roadmap rendering.

Suggested fix
       prs: [
         { number: 2607, title: 'feat: native Kubernetes components with GitOps deployment-repo delivery' },
+        { number: 2645, title: 'feat: container components and compositions support' },
       ],
🤖 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 `@website/src/data/roadmap.js` around lines 314 - 316, The prs array in this
initiative currently only contains PR 2607, but two shipped milestones reference
PR 2645. Add PR 2645 as a new object entry to the prs array alongside the
existing 2607 entry, including the PR number and an appropriate title, to keep
the metadata synchronized and prevent drift in roadmap rendering.
🤖 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.

Outside diff comments:
In `@website/src/data/roadmap.js`:
- Around line 314-316: The prs array in this initiative currently only contains
PR 2607, but two shipped milestones reference PR 2645. Add PR 2645 as a new
object entry to the prs array alongside the existing 2607 entry, including the
PR number and an appropriate title, to keep the metadata synchronized and
prevent drift in roadmap rendering.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c14d22c8-b28c-410b-bd8d-64c14c518dbd

📥 Commits

Reviewing files that changed from the base of the PR and between 9175f6a and 4fe20c4.

📒 Files selected for processing (2)
  • website/blog/2026-06-23-container-components.mdx
  • website/src/data/roadmap.js

@aknysh
Andriy Knysh (aknysh) merged commit c3ab183 into main Jun 24, 2026
64 checks passed
@atmos-pro

atmos-pro Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@aknysh
Andriy Knysh (aknysh) deleted the osterman/container-component-type branch June 24, 2026 03:00
@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Jun 24, 2026
@github-actions

Copy link
Copy Markdown

Warning

Release Documentation Required

This PR is labeled minor or major and requires documentation updates:

  • Changelog entry - Add a blog post in website/blog/YYYY-MM-DD-feature-name.mdx
  • Roadmap update - Update website/src/data/roadmap.js with the new milestone

Alternatively: If this change doesn't require release documentation, remove the minor or major label.

@github-actions

Copy link
Copy Markdown

These changes were released in v1.222.0-rc.9.

This branch was successfully deployed

1 active deployment
preview — 31ce9582 Deployed Jun 24, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New features that do not break anything size/xl Extra large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants