feat: stack name identity with zero-config filename fallback#1934
feat: stack name identity with zero-config filename fallback#1934
Conversation
Add tests that demonstrate the issue where ProcessStacks cannot find a component when the user specifies the manifest-level 'name' field as the stack argument. The test reproduces the scenario where: - Stack manifest has name: "my-explicit-stack" - atmos.yaml has name_template configured - User runs: atmos tf plan vpc -s my-explicit-stack - Expected: Component is found - Actual: Error "Could not find the component vpc in the stack" This affects all commands that call ProcessStacks: terraform, helmfile, packer, describe component, validate component, etc. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
Update findComponentInStacks to check against the manifest-level 'name' field when matching stacks. Previously, only ContextPrefix (derived from name_template or name_pattern) was checked, causing commands like `atmos tf plan vpc -s my-custom-name` to fail when the stack used a manifest name override. Stack matching now checks against: 1. ContextPrefix (from name_template/name_pattern) 2. Stack manifest name (the 'name' field, if present) 3. Stack filename (for backward compatibility) Closes #1932 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1934 +/- ##
==========================================
+ Coverage 74.01% 74.05% +0.04%
==========================================
Files 770 770
Lines 69326 69352 +26
==========================================
+ Hits 51313 51362 +49
+ Misses 14603 14581 -22
+ Partials 3410 3409 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Add JSON schema documentation for the stack-level 'name' field that allows explicit stack naming with highest precedence over name_template and name_pattern from atmos.yaml. Also documents the metadata.name field for component identity. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update `findComponentInStacks` to enforce that each stack has exactly ONE valid identifier based on precedence: 1. Explicit `name` field in manifest (highest priority) 2. Generated name from `name_template` or `name_pattern` 3. Stack filename (only when nothing else is configured) Previously, all three identifiers worked for the same stack, which caused confusion. Now, when a stack has an explicit `name` field, only that name is valid - using the filename or generated name will fail. Changes: - internal/exec/utils.go: Replace OR matching with single-identity rule - internal/exec/stack_manifest_name_test.go: Add tests verifying rejection - docs/prd/stack-name-identity.md: Document the specification 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
425c23d to
a6f0c05
Compare
📝 WalkthroughWalkthroughImplements a single canonical stack identity (precedence: manifest Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (user)
participant Process as ProcessStacks
participant Finder as findComponentInStacks
participant FS as Stacks (files/manifests)
participant Err as Error/Hint generator
CLI->>Process: invoke command with --stack <input>
Process->>Finder: enumerate stacks, pass atmos config
Finder->>FS: read each stack manifest/filename
FS-->>Finder: manifest data (name, name_template, name_pattern) / filename
alt manifest.name exists
Finder->>Finder: canonical = manifest.name
else name_template or name_pattern exists
Finder->>Finder: canonical = generated ContextPrefix
else
Finder->>Finder: canonical = filename (zero-config)
end
Finder-->>Process: return matched component(s) + filename→canonical map
alt match found
Process->>CLI: proceed with operation using canonical name
else no match
Process->>Err: build "invalid stack" error with suggestion from map
Err-->>CLI: "Error: invalid stack" + "Did you mean <canonical>?" hint
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (21)
🧰 Additional context used📓 Path-based instructions (7)tests/snapshots/**/*📄 CodeRabbit inference engine (CLAUDE.md)
Files:
website/**📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/*.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/{pkg,internal,cmd}/**/*.go📄 CodeRabbit inference engine (CLAUDE.md)
Files:
docs/prd/**/*.md📄 CodeRabbit inference engine (CLAUDE.md)
Files:
website/blog/*.mdx📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*_test.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
🧠 Learnings (63)📓 Common learnings📚 Learning: 2025-01-19T15:49:15.593ZApplied to files:
📚 Learning: 2025-09-13T16:39:20.007ZApplied to files:
📚 Learning: 2025-03-18T12:26:25.329ZApplied to files:
📚 Learning: 2024-12-07T16:16:13.038ZApplied to files:
📚 Learning: 2024-11-13T21:37:07.852ZApplied to files:
📚 Learning: 2025-12-13T03:21:35.786ZApplied to files:
📚 Learning: 2025-09-24T20:45:40.401ZApplied to files:
📚 Learning: 2025-02-03T05:57:18.407ZApplied to files:
📚 Learning: 2025-10-07T00:25:16.333ZApplied to files:
📚 Learning: 2025-02-14T23:12:38.030ZApplied to files:
📚 Learning: 2025-10-11T19:12:38.832ZApplied to files:
📚 Learning: 2025-02-11T08:21:33.143ZApplied to files:
📚 Learning: 2025-02-06T13:38:07.216ZApplied to files:
📚 Learning: 2025-09-10T17:34:52.568ZApplied to files:
📚 Learning: 2024-11-25T17:17:15.703ZApplied to files:
📚 Learning: 2025-02-19T05:50:35.853ZApplied to files:
📚 Learning: 2025-11-01T20:24:29.557ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2025-11-09T19:06:58.470ZApplied to files:
📚 Learning: 2025-01-09T19:53:29.847ZApplied to files:
📚 Learning: 2025-01-16T11:41:35.531ZApplied to files:
📚 Learning: 2024-12-01T00:33:20.298ZApplied to files:
📚 Learning: 2025-10-10T23:51:36.597ZApplied to files:
📚 Learning: 2025-09-10T21:17:55.273ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2026-01-09T04:49:35.038ZApplied to files:
📚 Learning: 2024-12-03T05:29:07.718ZApplied to files:
📚 Learning: 2025-12-24T04:29:23.938ZApplied to files:
📚 Learning: 2024-12-03T05:18:49.169ZApplied to files:
📚 Learning: 2024-12-11T18:40:12.808ZApplied to files:
📚 Learning: 2025-12-16T01:01:16.459ZApplied to files:
📚 Learning: 2025-08-16T23:32:40.412ZApplied to files:
📚 Learning: 2025-12-13T06:07:37.766ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2025-10-13T18:13:54.020ZApplied to files:
📚 Learning: 2024-10-20T00:41:57.135ZApplied to files:
📚 Learning: 2025-09-29T02:20:11.636ZApplied to files:
📚 Learning: 2025-12-21T04:10:29.030ZApplied to files:
📚 Learning: 2025-12-13T06:10:13.688ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2025-10-02T19:17:51.630ZApplied to files:
📚 Learning: 2025-12-13T06:07:34.794ZApplied to files:
📚 Learning: 2025-01-25T03:51:57.689ZApplied to files:
📚 Learning: 2025-10-08T06:48:07.499ZApplied to files:
📚 Learning: 2024-11-19T23:00:45.899ZApplied to files:
📚 Learning: 2024-12-07T16:19:01.683ZApplied to files:
📚 Learning: 2025-01-09T22:27:25.538ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2024-10-23T21:36:40.262ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-10-22T14:55:44.014ZApplied to files:
📚 Learning: 2025-11-11T03:47:59.576ZApplied to files:
📚 Learning: 2025-04-11T22:06:46.999ZApplied to files:
📚 Learning: 2025-08-15T14:43:41.030ZApplied to files:
📚 Learning: 2025-11-08T19:56:18.660ZApplied to files:
📚 Learning: 2025-09-13T18:06:07.674ZApplied to files:
📚 Learning: 2024-11-12T03:16:02.910ZApplied to files:
📚 Learning: 2024-11-24T19:13:10.287ZApplied to files:
📚 Learning: 2024-10-27T04:34:08.011ZApplied to files:
📚 Learning: 2024-10-20T00:57:53.500ZApplied to files:
🧬 Code graph analysis (1)internal/exec/stack_manifest_name_test.go (4)
🪛 LanguageTooldocs/prd/stack-name-identity.md[typographical] ~48-~48: Consider using a typographic opening quote here. (EN_QUOTES) [typographical] ~62-~62: Consider using a typographic opening quote here. (EN_QUOTES) [typographical] ~75-~75: Consider using a typographic opening quote here. (EN_QUOTES) [typographical] ~198-~198: Consider using a typographic opening quote here. (EN_QUOTES) website/blog/2026-01-06-stack-name-identity.mdx[typographical] ~22-~22: To join two clauses or introduce examples, consider using an em dash. (DASH_RULE) [typographical] ~24-~24: To join two clauses or introduce examples, consider using an em dash. (DASH_RULE) [typographical] ~25-~25: To join two clauses or introduce examples, consider using an em dash. (DASH_RULE) ⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (34)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Warning Release Documentation RequiredThis PR is labeled
|
1 similar comment
|
Warning Release Documentation RequiredThis PR is labeled
|
When no name, name_template, or name_pattern is configured, stacks are now identified by their filename. This enables newcomers to get started without any naming configuration. - Add filename fallback in processStackContextPrefix when no naming config - Add tests for filename-based identity (ProcessStacks and DescribeStacks) - Add blog post documenting stack name identity rules - Add "Filename-based stack identity" to DX roadmap (Q1 2026) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reframe the PRD from a bug-fix document to a requirements specification that defines how stack identity resolution works in Atmos. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When a user provides a filename for a stack that has an explicit name field set, the error now indicates "invalid stack" and suggests the correct canonical name, rather than the misleading "invalid component" message. Example: Stack `legacy-prod` not found. Did you mean `my-legacy-prod-stack`? 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…formatting - Use error builder pattern with WithHint instead of embedding suggestion in the error message - Update unit test to use errors.GetAllHints() for verification - Regenerate golden snapshots with new error format showing Hints section - Update PR description with new error output format The error now displays as: # Error **Error:** invalid stack ## Explanation Stack legacy-prod not found. ## Hints 💡 Did you mean my-legacy-prod-stack? 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add second hint suggesting 'atmos list stacks' to see available stacks - Update test expectations to check for both hints - Update golden snapshots with new hint output 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
internal/exec/utils.go (1)
43-43: Prefer passingatmosConfigto performance tracking.The function receives
atmosConfigas its first parameter, so pass it toperf.Trackinstead ofnilfor more accurate performance monitoring.🔎 Suggested change
- defer perf.Track(nil, "exec.ProcessComponentConfig")() + defer perf.Track(atmosConfig, "exec.ProcessComponentConfig")()Based on coding guidelines, all public functions should pass atmosConfig when available.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (15)
internal/exec/stack_manifest_name_test.gointernal/exec/utils.gotests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stdout.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stdout.goldentests/snapshots/TestCLICommands_atmos_list_stacks_(stack-manifest-name).stderr.goldentests/snapshots/TestCLICommands_atmos_list_stacks_(stack-manifest-name).stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_plan_vpc_-s_legacy-prod_(invalid).stderr.goldentests/snapshots/TestCLICommands_atmos_terraform_plan_vpc_-s_legacy-prod_(invalid).stdout.goldentests/test-cases/stack-manifest-name.yaml
✅ Files skipped from review due to trivial changes (7)
- tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stderr.golden
- tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stderr.golden
- tests/snapshots/TestCLICommands_atmos_terraform_plan_vpc_-s_legacy-prod_(invalid).stderr.golden
- tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.golden
- tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stdout.golden
- tests/snapshots/TestCLICommands_atmos_list_stacks_(stack-manifest-name).stdout.golden
- tests/snapshots/TestCLICommands_atmos_list_stacks_(stack-manifest-name).stderr.golden
🧰 Additional context used
📓 Path-based instructions (4)
tests/snapshots/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Never manually edit golden snapshot files - always use
-regenerate-snapshotsflag when updating test output
Files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: Use Viper for managing configuration, environment variables, and flags in CLI commands
Use interfaces for external dependencies to facilitate mocking and consider using testify/mock for creating mock implementations
All code must pass golangci-lint checks
Follow Go's error handling idioms: use meaningful error messages, wrap errors with context usingfmt.Errorf("context: %w", err), and consider using custom error types for domain-specific errors
Follow standard Go coding style: usegofmtandgoimportsto format code, prefer short descriptive variable names, use kebab-case for command-line flags, and snake_case for environment variables
Document all exported functions, types, and methods following Go's documentation conventions
Document complex logic with inline comments in Go code
Support configuration via files, environment variables, and flags following the precedence order: flags > environment variables > config file > defaults
Provide clear error messages to users, include troubleshooting hints when appropriate, and log detailed errors for debugging
**/*.go: All comments must end with periods (enforced bygodotlinter) in Go code
Organize imports into three groups separated by blank lines, sorted alphabetically: Go stdlib, 3rd-party (NOT cloudposse/atmos), then Atmos packages with maintained aliases (cfg,log,u,errUtils)
All errors MUST be wrapped using static errors defined inerrors/errors.go- useerrors.Joinfor combining errors,fmt.Errorfwith%wfor context, anderrors.Is()for error checking
Never manually create mocks - usego.uber.org/mock/mockgenwith//go:generatedirectives in Go code
Keep files small and focused - under 600 lines with one cmd/impl per file, co-locate tests, never use//revive:disable:file-length-limit
Use colors frompkg/ui/theme/colors.gofor all UI theming in Go code
Code must be compatible with Linux, macOS, and Windows - use SDKs over binaries, usefilepath.Join()instead of h...
Files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
**/{pkg,internal,cmd}/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
Add
defer perf.Track(atmosConfig, "pkg.FuncName")()plus blank line to all public functions, usingnilif no atmosConfig param - exceptions: trivial getters/setters, command constructors, simple factories, functions delegating to tracked functions
Files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Use table-driven tests for testing multiple scenarios in Go
Include integration tests for command flows and test CLI end-to-end when possible with test fixturesPrefer unit tests with mocks over integration tests - use interfaces and dependency injection for testability, generate mocks with
go.uber.org/mock/mockgen, use table-driven tests, target >80% coverage
Files:
internal/exec/stack_manifest_name_test.go
🧠 Learnings (43)
📓 Common learnings
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: docs/prd/tool-dependencies-integration.md:58-64
Timestamp: 2025-12-13T06:07:37.766Z
Learning: cloudposse/atmos: For PRD docs (docs/prd/*.md), markdownlint issues like MD040/MD010/MD034 can be handled in a separate documentation cleanup commit and should not block the current PR.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: errors/errors.go:184-203
Timestamp: 2025-12-13T06:10:13.688Z
Learning: cloudposse/atmos: For toolchain work, duplicate/unused error sentinels in errors/errors.go should be cleaned up in a separate refactor PR and not block feature PRs; canonical toolchain sentinels live under toolchain/registry with re-exports in toolchain/errors.go.
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: tests/fixtures/scenarios/atmos-auth/stacks/deploy/nonprod.yaml:3-4
Timestamp: 2025-09-24T20:45:40.401Z
Learning: In Atmos stack files, the correct syntax for importing other stack files is `import:` (singular), not `imports:` (plural). All stack files in the Atmos codebase consistently use `import:` followed by a list of paths to import.
Learnt from: haitham911
Repo: cloudposse/atmos PR: 731
File: internal/exec/validate_stacks.go:93-98
Timestamp: 2024-10-20T00:41:57.135Z
Learning: When downloading schema files in `internal/exec/validate_stacks.go`, use a consistent temporary file name to overwrite the file each time and avoid creating multiple temporary files.
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/test-cases/stack-manifest-name.yamlinternal/exec/stack_manifest_name_test.go
📚 Learning: 2025-02-14T23:12:38.030Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1061
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:8-8
Timestamp: 2025-02-14T23:12:38.030Z
Learning: Test snapshots in the Atmos project, particularly for dry run scenarios, may be updated during the development process, and temporary inconsistencies in their content should not be flagged as issues.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2024-12-01T00:33:20.298Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml:28-32
Timestamp: 2024-12-01T00:33:20.298Z
Learning: In `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos terraform output` is used in examples to demonstrate its usage, even though `!terraform.output` is the recommended approach according to the documentation.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/test-cases/stack-manifest-name.yaml
📚 Learning: 2024-11-25T17:17:15.703Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 797
File: pkg/list/atmos.yaml:213-214
Timestamp: 2024-11-25T17:17:15.703Z
Learning: The file `pkg/list/atmos.yaml` is primarily intended for testing purposes.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/test-cases/stack-manifest-name.yaml
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2025-12-13T03:21:35.786Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1813
File: cmd/terraform/shell.go:28-73
Timestamp: 2025-12-13T03:21:35.786Z
Learning: In Atmos, when calling cfg.InitCliConfig, you must first populate the schema.ConfigAndStacksInfo struct with global flag values using flags.ParseGlobalFlags(cmd, v) rather than passing an empty struct. The LoadConfig function (pkg/config/load.go) reads config selection fields (AtmosConfigFilesFromArg, AtmosConfigDirsFromArg, BasePath, ProfilesFromArg) directly from the ConfigAndStacksInfo struct, NOT from Viper. Passing an empty struct causes config selection flags (--base-path, --config, --config-path, --profile) to be silently ignored. Correct pattern: parse flags → populate struct → call InitCliConfig. See cmd/terraform/plan_diff.go for reference implementation.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldeninternal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2024-12-03T05:29:07.718Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: internal/exec/terraform_utils.go:145-146
Timestamp: 2024-12-03T05:29:07.718Z
Learning: In the Atmos project, a 5-minute timeout in the `execTerraformOutput` function is acceptable for retrieving `terraform output` for a component in a stack.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2025-12-24T04:29:23.938Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1891
File: pkg/ci/terraform/templates/apply.md:17-17
Timestamp: 2025-12-24T04:29:23.938Z
Learning: In the cloudposse/atmos repository, Terraform CI templates (pkg/ci/terraform/templates/*.md) are rendered using TerraformTemplateContext (defined in pkg/ci/terraform/context.go), not the base ci.TemplateContext. TerraformTemplateContext provides top-level fields: .Resources (ci.ResourceCounts), .HasChanges() method, and .HasDestroy field, which are correctly accessed directly in templates without a .Result prefix.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2024-12-03T05:18:49.169Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: internal/exec/terraform_utils.go:40-213
Timestamp: 2024-12-03T05:18:49.169Z
Learning: In the context of the Atmos project, it's acceptable for functions like `execTerraformOutput` to remain as single functions if they perform a single purpose, such as retrieving Terraform outputs for a component in a stack, even if the function is lengthy.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2024-12-11T18:40:12.808Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2024-11-13T21:37:07.852Z
Learnt from: Cerebrovinny
Repo: cloudposse/atmos PR: 764
File: internal/exec/describe_stacks.go:289-295
Timestamp: 2024-11-13T21:37:07.852Z
Learning: In the `internal/exec/describe_stacks.go` file of the `atmos` project written in Go, avoid extracting the stack name handling logic into a helper function within the `ExecuteDescribeStacks` method, even if the logic appears duplicated.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldeninternal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldeninternal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2025-08-15T14:43:41.030Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1352
File: pkg/store/artifactory_store_test.go:108-113
Timestamp: 2025-08-15T14:43:41.030Z
Learning: In test files for the atmos project, it's acceptable to ignore errors from os.Setenv/Unsetenv operations during test environment setup and teardown, as these are controlled test scenarios.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldeninternal/exec/stack_manifest_name_test.go
📚 Learning: 2025-09-24T20:45:40.401Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: tests/fixtures/scenarios/atmos-auth/stacks/deploy/nonprod.yaml:3-4
Timestamp: 2025-09-24T20:45:40.401Z
Learning: In Atmos stack files, the correct syntax for importing other stack files is `import:` (singular), not `imports:` (plural). All stack files in the Atmos codebase consistently use `import:` followed by a list of paths to import.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-10-11T19:12:38.832Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: tests/snapshots/TestCLICommands_atmos_workflow_invalid_step_type.stderr.golden:0-0
Timestamp: 2025-10-11T19:12:38.832Z
Learning: Usage Examples sections in error output are appropriate for command usage errors (incorrect syntax, missing arguments, invalid flags) but not for configuration validation errors (malformed workflow files, invalid settings in atmos.yaml). Configuration errors should focus on explaining what's wrong with the config, not command usage patterns.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-02-03T05:57:18.407Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/cmd_utils.go:121-148
Timestamp: 2025-02-03T05:57:18.407Z
Learning: The Atmos CLI should fail fast (exit) when encountering configuration errors, including command alias configuration issues, to prevent undefined behavior. Use LogErrorAndExit instead of returning errors in such cases.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-02-11T08:21:33.143Z
Learnt from: shirkevich
Repo: cloudposse/atmos PR: 1034
File: website/docs/core-concepts/projects/configuration/stores.mdx:173-177
Timestamp: 2025-02-11T08:21:33.143Z
Learning: The parameter for configuring stack path delimiter in store configurations is consistently named `stack_delimiter` (not `stacks_delimiter`) across all store types in Atmos.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-02-06T13:38:07.216Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 984
File: internal/exec/copy_glob.go:0-0
Timestamp: 2025-02-06T13:38:07.216Z
Learning: The `u.LogTrace` function in the `cloudposse/atmos` repository accepts `atmosConfig` as its first parameter, followed by the message string.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-09-10T17:34:52.568Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/providers/github/oidc.go:96-100
Timestamp: 2025-09-10T17:34:52.568Z
Learning: The ATMOS_ environment variable binding guideline applies to Atmos configuration variables, not external service-required environment variables like GitHub Actions OIDC variables (GITHUB_ACTIONS, ACTIONS_ID_TOKEN_*) which must use their standard names.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-12-16T01:01:16.459Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1868
File: tests/test-cases/auth-mock.yaml:243-245
Timestamp: 2025-12-16T01:01:16.459Z
Learning: In Atmos tests, the YAML tag !not has project-specific semantics: it negates the value in a way that affects skip conditions, e.g., os: !not windows means skip on Windows (not non-Windows). This is not standard YAML boolean negation. Treat this as a guideline for review: when a test-case YAML uses !not in skip conditions, verify that the skip logic aligns with the project's interpretation. This pattern applies to all YAML test-case files under tests/test-cases (and similar paths in this repo).
Applied to files:
tests/test-cases/stack-manifest-name.yaml
📚 Learning: 2025-10-08T06:48:07.499Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1602
File: internal/exec/stack_processor_utils.go:968-1003
Timestamp: 2025-10-08T06:48:07.499Z
Learning: The `FindComponentDependenciesLegacy` function in `internal/exec/stack_processor_utils.go` is legacy code that is not actively used and is kept only for backward compatibility purposes.
Applied to files:
internal/exec/utils.go
📚 Learning: 2024-11-19T23:00:45.899Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 795
File: internal/exec/stack_processor_utils.go:378-386
Timestamp: 2024-11-19T23:00:45.899Z
Learning: In the `ProcessYAMLConfigFile` function within `internal/exec/stack_processor_utils.go`, directory traversal in stack imports is acceptable and should not be restricted.
Applied to files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2025-09-29T02:20:11.636Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1540
File: internal/exec/validate_component.go:117-118
Timestamp: 2025-09-29T02:20:11.636Z
Learning: The ValidateComponent function in internal/exec/validate_component.go had its componentSection parameter type refined from `any` to `map[string]any` without adding new parameters. This is a type safety improvement, not a signature change requiring call site updates.
Applied to files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2024-10-20T00:41:57.135Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 731
File: internal/exec/validate_stacks.go:93-98
Timestamp: 2024-10-20T00:41:57.135Z
Learning: When downloading schema files in `internal/exec/validate_stacks.go`, use a consistent temporary file name to overwrite the file each time and avoid creating multiple temporary files.
Applied to files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2024-10-20T00:57:53.500Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 731
File: internal/exec/validate_stacks.go:0-0
Timestamp: 2024-10-20T00:57:53.500Z
Learning: In `internal/exec/validate_stacks.go`, when downloading the Atmos JSON Schema file to the temp directory, the temporary file is overwritten each time, so explicit removal is not necessary.
Applied to files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.
Applied to files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2026-01-04T00:55:21.720Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-04T00:55:21.720Z
Learning: Applies to **/{pkg,internal,cmd}/**/*.go : Add `defer perf.Track(atmosConfig, "pkg.FuncName")()` plus blank line to all public functions, using `nil` if no atmosConfig param - exceptions: trivial getters/setters, command constructors, simple factories, functions delegating to tracked functions
Applied to files:
internal/exec/utils.go
📚 Learning: 2025-12-21T04:10:29.030Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1891
File: internal/exec/describe_affected.go:468-468
Timestamp: 2025-12-21T04:10:29.030Z
Learning: In Go, package-level declarations (constants, variables, types, and functions) are visible to all files in the same package without imports. During reviews in cloudposse/atmos (and similar Go codebases), before suggesting to declare a new identifier, first check if it already exists in another file of the same package. If it exists, you can avoid adding a new declaration; if not, proceed with a proper package-level declaration.
Applied to files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Include integration tests for command flows and test CLI end-to-end when possible with test fixtures
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Use table-driven tests for testing multiple scenarios in Go
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-10-22T14:55:44.014Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1695
File: pkg/auth/manager.go:169-171
Timestamp: 2025-10-22T14:55:44.014Z
Learning: Go 1.20+ supports multiple %w verbs in fmt.Errorf, which returns an error implementing Unwrap() []error. This is valid and does not panic. Atmos uses Go 1.24.8 and configures errorlint with errorf-multi: true to validate this pattern.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-11-11T03:47:59.576Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/which_test.go:166-223
Timestamp: 2025-11-11T03:47:59.576Z
Learning: In the cloudposse/atmos repo, tests that manipulate environment variables should use testing.T.Setenv for automatic setup/teardown instead of os.Setenv/Unsetenv.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-04-11T22:06:46.999Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1147
File: internal/exec/validate_schema.go:42-57
Timestamp: 2025-04-11T22:06:46.999Z
Learning: The "ExecuteAtmosValidateSchemaCmd" function in internal/exec/validate_schema.go has been reviewed and confirmed to have acceptable cognitive complexity despite static analysis warnings. The function uses a clean structure with only three if statements for error handling and delegates complex operations to helper methods.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-11-08T19:56:18.660Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1697
File: internal/exec/oci_utils.go:0-0
Timestamp: 2025-11-08T19:56:18.660Z
Learning: In the Atmos codebase, when a function receives an `*schema.AtmosConfiguration` parameter, it should read configuration values from `atmosConfig.Settings` fields rather than using direct `os.Getenv()` or `viper.GetString()` calls. The Atmos pattern is: viper.BindEnv in cmd/root.go binds environment variables → Viper unmarshals into atmosConfig.Settings via mapstructure → business logic reads from the Settings struct. This provides centralized config management, respects precedence, and enables testability. Example: `atmosConfig.Settings.AtmosGithubToken` instead of `os.Getenv("ATMOS_GITHUB_TOKEN")` in functions like `getGHCRAuth` in internal/exec/oci_utils.go.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-12-13T06:10:13.688Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: errors/errors.go:184-203
Timestamp: 2025-12-13T06:10:13.688Z
Learning: cloudposse/atmos: For toolchain work, duplicate/unused error sentinels in errors/errors.go should be cleaned up in a separate refactor PR and not block feature PRs; canonical toolchain sentinels live under toolchain/registry with re-exports in toolchain/errors.go.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-09-13T18:06:07.674Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/list.go:39-42
Timestamp: 2025-09-13T18:06:07.674Z
Learning: In the cloudposse/atmos repository, for UI messages in the toolchain package, use utils.PrintfMessageToTUI instead of log.Error or fmt.Fprintln(os.Stderr, ...). Import pkg/utils with alias "u" to follow the established pattern.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2024-11-12T03:16:02.910Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 775
File: internal/exec/template_funcs_component.go:157-159
Timestamp: 2024-11-12T03:16:02.910Z
Learning: In the Go code for `componentFunc` in `internal/exec/template_funcs_component.go`, the function `cleanTerraformWorkspace` does not return errors, and it's acceptable if the file does not exist. Therefore, error handling for `cleanTerraformWorkspace` is not needed.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-01-09T22:27:25.538Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2024-12-12T15:17:45.245Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2024-12-12T15:17:45.245Z
Learning: In `examples/demo-atmos.d/atmos.d/tools/helmfile.yml`, when suggesting changes to `kubeconfig_path`, ensure that the values use valid Go template syntax.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2024-12-07T16:19:01.683Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
internal/exec/stack_manifest_name_test.go
🧬 Code graph analysis (1)
internal/exec/utils.go (2)
pkg/schema/schema.go (2)
AtmosConfiguration(54-100)ConfigAndStacksInfo(727-824)pkg/config/const.go (1)
NameSectionName(65-65)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Acceptance Tests (macos)
- GitHub Check: Acceptance Tests (linux)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Summary
🔇 Additional comments (6)
internal/exec/utils.go (3)
354-356: Nice zero-config naming fallback.This enables newcomers to use Atmos without configuring
name_templateorname_patternupfront. The filename becomes the canonical stack identity when nothing else is configured, which is intuitive and aligns with the single-identity precedence documented in the PRD.
379-437: Canonical name resolution logic is sound.The precedence hierarchy (manifest name → template/pattern → filename) is implemented correctly:
- Early extraction of manifest names enables suggestions even when components aren't found.
- The condition
ContextPrefix != stackNamecorrectly identifies when a template/pattern was applied versus when the filename fallback was used.- Both explicit names and template-derived names are tracked in
stackNameMappingsfor helpful error suggestions.
618-625: Helpful error with canonical name suggestion.The error handling correctly detects when a user provides a filename that maps to a different canonical name and suggests the correct identifier. The dual hints (suggesting the canonical name + pointing to
atmos list stacks) provide clear next steps for users.internal/exec/stack_manifest_name_test.go (3)
407-449: Excellent test coverage for manifest name precedence.This test validates that the manifest-level
namefield works correctly withProcessStacks, which was the core issue from #1932. The test setup, execution, and assertions are all well-structured.
480-559: Nice table-driven test for precedence rules.This test comprehensively validates all four levels of the naming precedence hierarchy (manifest name → name_template → name_pattern → filename). The test cases are clear and cover edge cases effectively.
776-809: Solid error validation with hint inspection.The test correctly verifies that
ErrInvalidStackis returned and inspects the hints usingerrors.GetAllHints. This ensures the error builder'sWithHintcalls produce the expected user-facing guidance.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
internal/exec/utils.go (1)
376-393: Consider extracting manifest name retrieval.The nested type assertions (lines 383-386) appear in both
findComponentInStacksand later inExecuteDescribeStacks. A small helper likegetStackManifestName(stackSection map[string]any) stringcould reduce duplication, though this is optional given the limited scope.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (15)
internal/exec/stack_manifest_name_test.gointernal/exec/utils.gotests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stdout.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stdout.goldentests/snapshots/TestCLICommands_atmos_list_stacks_(stack-manifest-name).stderr.goldentests/snapshots/TestCLICommands_atmos_list_stacks_(stack-manifest-name).stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_plan_vpc_-s_legacy-prod_(invalid).stderr.goldentests/snapshots/TestCLICommands_atmos_terraform_plan_vpc_-s_legacy-prod_(invalid).stdout.goldentests/test-cases/stack-manifest-name.yaml
✅ Files skipped from review due to trivial changes (6)
- tests/snapshots/TestCLICommands_atmos_list_stacks_(stack-manifest-name).stderr.golden
- tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stderr.golden
- tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stderr.golden
- tests/snapshots/TestCLICommands_atmos_terraform_plan_vpc_-s_legacy-prod_(invalid).stderr.golden
- tests/snapshots/TestCLICommands_atmos_list_stacks_(stack-manifest-name).stdout.golden
- tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stdout.golden
🧰 Additional context used
📓 Path-based instructions (4)
tests/snapshots/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Never manually edit golden snapshot files - always use
-regenerate-snapshotsflag when updating test output
Files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.golden
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: Use Viper for managing configuration, environment variables, and flags in CLI commands
Use interfaces for external dependencies to facilitate mocking and consider using testify/mock for creating mock implementations
All code must pass golangci-lint checks
Follow Go's error handling idioms: use meaningful error messages, wrap errors with context usingfmt.Errorf("context: %w", err), and consider using custom error types for domain-specific errors
Follow standard Go coding style: usegofmtandgoimportsto format code, prefer short descriptive variable names, use kebab-case for command-line flags, and snake_case for environment variables
Document all exported functions, types, and methods following Go's documentation conventions
Document complex logic with inline comments in Go code
Support configuration via files, environment variables, and flags following the precedence order: flags > environment variables > config file > defaults
Provide clear error messages to users, include troubleshooting hints when appropriate, and log detailed errors for debugging
**/*.go: All comments must end with periods (enforced bygodotlinter) in Go code
Organize imports into three groups separated by blank lines, sorted alphabetically: Go stdlib, 3rd-party (NOT cloudposse/atmos), then Atmos packages with maintained aliases (cfg,log,u,errUtils)
All errors MUST be wrapped using static errors defined inerrors/errors.go- useerrors.Joinfor combining errors,fmt.Errorfwith%wfor context, anderrors.Is()for error checking
Never manually create mocks - usego.uber.org/mock/mockgenwith//go:generatedirectives in Go code
Keep files small and focused - under 600 lines with one cmd/impl per file, co-locate tests, never use//revive:disable:file-length-limit
Use colors frompkg/ui/theme/colors.gofor all UI theming in Go code
Code must be compatible with Linux, macOS, and Windows - use SDKs over binaries, usefilepath.Join()instead of h...
Files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
**/{pkg,internal,cmd}/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
Add
defer perf.Track(atmosConfig, "pkg.FuncName")()plus blank line to all public functions, usingnilif no atmosConfig param - exceptions: trivial getters/setters, command constructors, simple factories, functions delegating to tracked functions
Files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Use table-driven tests for testing multiple scenarios in Go
Include integration tests for command flows and test CLI end-to-end when possible with test fixturesPrefer unit tests with mocks over integration tests - use interfaces and dependency injection for testability, generate mocks with
go.uber.org/mock/mockgen, use table-driven tests, target >80% coverage
Files:
internal/exec/stack_manifest_name_test.go
🧠 Learnings (45)
📓 Common learnings
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: docs/prd/tool-dependencies-integration.md:58-64
Timestamp: 2025-12-13T06:07:37.766Z
Learning: cloudposse/atmos: For PRD docs (docs/prd/*.md), markdownlint issues like MD040/MD010/MD034 can be handled in a separate documentation cleanup commit and should not block the current PR.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: errors/errors.go:184-203
Timestamp: 2025-12-13T06:10:13.688Z
Learning: cloudposse/atmos: For toolchain work, duplicate/unused error sentinels in errors/errors.go should be cleaned up in a separate refactor PR and not block feature PRs; canonical toolchain sentinels live under toolchain/registry with re-exports in toolchain/errors.go.
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/test-cases/stack-manifest-name.yamltests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.goldeninternal/exec/stack_manifest_name_test.go
📚 Learning: 2025-02-14T23:12:38.030Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1061
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:8-8
Timestamp: 2025-02-14T23:12:38.030Z
Learning: Test snapshots in the Atmos project, particularly for dry run scenarios, may be updated during the development process, and temporary inconsistencies in their content should not be flagged as issues.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.golden
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.golden
📚 Learning: 2024-11-25T17:17:15.703Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 797
File: pkg/list/atmos.yaml:213-214
Timestamp: 2024-11-25T17:17:15.703Z
Learning: The file `pkg/list/atmos.yaml` is primarily intended for testing purposes.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/test-cases/stack-manifest-name.yaml
📚 Learning: 2025-09-10T21:17:55.273Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/http_client_test.go:3-10
Timestamp: 2025-09-10T21:17:55.273Z
Learning: In the cloudposse/atmos repository, imports should never be changed as per samtholiya's coding guidelines.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.golden
📚 Learning: 2026-01-04T00:55:21.720Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-04T00:55:21.720Z
Learning: Applies to tests/snapshots/**/* : Never manually edit golden snapshot files - always use `-regenerate-snapshots` flag when updating test output
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2024-12-03T05:29:07.718Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: internal/exec/terraform_utils.go:145-146
Timestamp: 2024-12-03T05:29:07.718Z
Learning: In the Atmos project, a 5-minute timeout in the `execTerraformOutput` function is acceptable for retrieving `terraform output` for a component in a stack.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2024-12-01T00:33:20.298Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml:28-32
Timestamp: 2024-12-01T00:33:20.298Z
Learning: In `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos terraform output` is used in examples to demonstrate its usage, even though `!terraform.output` is the recommended approach according to the documentation.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/test-cases/stack-manifest-name.yaml
📚 Learning: 2025-12-13T03:21:35.786Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1813
File: cmd/terraform/shell.go:28-73
Timestamp: 2025-12-13T03:21:35.786Z
Learning: In Atmos, when calling cfg.InitCliConfig, you must first populate the schema.ConfigAndStacksInfo struct with global flag values using flags.ParseGlobalFlags(cmd, v) rather than passing an empty struct. The LoadConfig function (pkg/config/load.go) reads config selection fields (AtmosConfigFilesFromArg, AtmosConfigDirsFromArg, BasePath, ProfilesFromArg) directly from the ConfigAndStacksInfo struct, NOT from Viper. Passing an empty struct causes config selection flags (--base-path, --config, --config-path, --profile) to be silently ignored. Correct pattern: parse flags → populate struct → call InitCliConfig. See cmd/terraform/plan_diff.go for reference implementation.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.goldentests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldeninternal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2025-12-24T04:29:23.938Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1891
File: pkg/ci/terraform/templates/apply.md:17-17
Timestamp: 2025-12-24T04:29:23.938Z
Learning: In the cloudposse/atmos repository, Terraform CI templates (pkg/ci/terraform/templates/*.md) are rendered using TerraformTemplateContext (defined in pkg/ci/terraform/context.go), not the base ci.TemplateContext. TerraformTemplateContext provides top-level fields: .Resources (ci.ResourceCounts), .HasChanges() method, and .HasDestroy field, which are correctly accessed directly in templates without a .Result prefix.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2024-12-03T05:18:49.169Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: internal/exec/terraform_utils.go:40-213
Timestamp: 2024-12-03T05:18:49.169Z
Learning: In the context of the Atmos project, it's acceptable for functions like `execTerraformOutput` to remain as single functions if they perform a single purpose, such as retrieving Terraform outputs for a component in a stack, even if the function is lengthy.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldeninternal/exec/utils.gotests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.goldeninternal/exec/stack_manifest_name_test.go
📚 Learning: 2024-11-13T21:37:07.852Z
Learnt from: Cerebrovinny
Repo: cloudposse/atmos PR: 764
File: internal/exec/describe_stacks.go:289-295
Timestamp: 2024-11-13T21:37:07.852Z
Learning: In the `internal/exec/describe_stacks.go` file of the `atmos` project written in Go, avoid extracting the stack name handling logic into a helper function within the `ExecuteDescribeStacks` method, even if the logic appears duplicated.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldeninternal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2025-09-24T20:45:40.401Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: tests/fixtures/scenarios/atmos-auth/stacks/deploy/nonprod.yaml:3-4
Timestamp: 2025-09-24T20:45:40.401Z
Learning: In Atmos stack files, the correct syntax for importing other stack files is `import:` (singular), not `imports:` (plural). All stack files in the Atmos codebase consistently use `import:` followed by a list of paths to import.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.goldentests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.golden
📚 Learning: 2025-02-03T05:57:18.407Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/cmd_utils.go:121-148
Timestamp: 2025-02-03T05:57:18.407Z
Learning: The Atmos CLI should fail fast (exit) when encountering configuration errors, including command alias configuration issues, to prevent undefined behavior. Use LogErrorAndExit instead of returning errors in such cases.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-10-11T19:12:38.832Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: tests/snapshots/TestCLICommands_atmos_workflow_invalid_step_type.stderr.golden:0-0
Timestamp: 2025-10-11T19:12:38.832Z
Learning: Usage Examples sections in error output are appropriate for command usage errors (incorrect syntax, missing arguments, invalid flags) but not for configuration validation errors (malformed workflow files, invalid settings in atmos.yaml). Configuration errors should focus on explaining what's wrong with the config, not command usage patterns.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-02-11T08:21:33.143Z
Learnt from: shirkevich
Repo: cloudposse/atmos PR: 1034
File: website/docs/core-concepts/projects/configuration/stores.mdx:173-177
Timestamp: 2025-02-11T08:21:33.143Z
Learning: The parameter for configuring stack path delimiter in store configurations is consistently named `stack_delimiter` (not `stacks_delimiter`) across all store types in Atmos.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-02-06T13:38:07.216Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 984
File: internal/exec/copy_glob.go:0-0
Timestamp: 2025-02-06T13:38:07.216Z
Learning: The `u.LogTrace` function in the `cloudposse/atmos` repository accepts `atmosConfig` as its first parameter, followed by the message string.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-09-10T17:34:52.568Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/providers/github/oidc.go:96-100
Timestamp: 2025-09-10T17:34:52.568Z
Learning: The ATMOS_ environment variable binding guideline applies to Atmos configuration variables, not external service-required environment variables like GitHub Actions OIDC variables (GITHUB_ACTIONS, ACTIONS_ID_TOKEN_*) which must use their standard names.
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden
📚 Learning: 2025-10-08T06:48:07.499Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1602
File: internal/exec/stack_processor_utils.go:968-1003
Timestamp: 2025-10-08T06:48:07.499Z
Learning: The `FindComponentDependenciesLegacy` function in `internal/exec/stack_processor_utils.go` is legacy code that is not actively used and is kept only for backward compatibility purposes.
Applied to files:
internal/exec/utils.go
📚 Learning: 2024-11-19T23:00:45.899Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 795
File: internal/exec/stack_processor_utils.go:378-386
Timestamp: 2024-11-19T23:00:45.899Z
Learning: In the `ProcessYAMLConfigFile` function within `internal/exec/stack_processor_utils.go`, directory traversal in stack imports is acceptable and should not be restricted.
Applied to files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2025-09-29T02:20:11.636Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1540
File: internal/exec/validate_component.go:117-118
Timestamp: 2025-09-29T02:20:11.636Z
Learning: The ValidateComponent function in internal/exec/validate_component.go had its componentSection parameter type refined from `any` to `map[string]any` without adding new parameters. This is a type safety improvement, not a signature change requiring call site updates.
Applied to files:
internal/exec/utils.go
📚 Learning: 2025-10-13T18:13:54.020Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1622
File: pkg/perf/perf.go:140-184
Timestamp: 2025-10-13T18:13:54.020Z
Learning: In pkg/perf/perf.go, the `trackWithSimpleStack` function intentionally skips ownership checks at call stack depth > 1 to avoid expensive `getGoroutineID()` calls on every nested function. This is a performance optimization for the common single-goroutine execution case (most Atmos commands), accepting the rare edge case of potential metric corruption if multi-goroutine execution occurs at depth > 1. The ~19× performance improvement justifies this trade-off.
Applied to files:
internal/exec/utils.go
📚 Learning: 2024-10-20T00:41:57.135Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 731
File: internal/exec/validate_stacks.go:93-98
Timestamp: 2024-10-20T00:41:57.135Z
Learning: When downloading schema files in `internal/exec/validate_stacks.go`, use a consistent temporary file name to overwrite the file each time and avoid creating multiple temporary files.
Applied to files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2025-12-21T04:10:29.030Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1891
File: internal/exec/describe_affected.go:468-468
Timestamp: 2025-12-21T04:10:29.030Z
Learning: In Go, package-level declarations (constants, variables, types, and functions) are visible to all files in the same package without imports. During reviews in cloudposse/atmos (and similar Go codebases), before suggesting to declare a new identifier, first check if it already exists in another file of the same package. If it exists, you can avoid adding a new declaration; if not, proceed with a proper package-level declaration.
Applied to files:
internal/exec/utils.gointernal/exec/stack_manifest_name_test.go
📚 Learning: 2025-12-16T01:01:16.459Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1868
File: tests/test-cases/auth-mock.yaml:243-245
Timestamp: 2025-12-16T01:01:16.459Z
Learning: In Atmos tests, the YAML tag !not has project-specific semantics: it negates the value in a way that affects skip conditions, e.g., os: !not windows means skip on Windows (not non-Windows). This is not standard YAML boolean negation. Treat this as a guideline for review: when a test-case YAML uses !not in skip conditions, verify that the skip logic aligns with the project's interpretation. This pattern applies to all YAML test-case files under tests/test-cases (and similar paths in this repo).
Applied to files:
tests/test-cases/stack-manifest-name.yaml
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Include integration tests for command flows and test CLI end-to-end when possible with test fixtures
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Use table-driven tests for testing multiple scenarios in Go
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-10-22T14:55:44.014Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1695
File: pkg/auth/manager.go:169-171
Timestamp: 2025-10-22T14:55:44.014Z
Learning: Go 1.20+ supports multiple %w verbs in fmt.Errorf, which returns an error implementing Unwrap() []error. This is valid and does not panic. Atmos uses Go 1.24.8 and configures errorlint with errorf-multi: true to validate this pattern.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-11-11T03:47:59.576Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/which_test.go:166-223
Timestamp: 2025-11-11T03:47:59.576Z
Learning: In the cloudposse/atmos repo, tests that manipulate environment variables should use testing.T.Setenv for automatic setup/teardown instead of os.Setenv/Unsetenv.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-04-11T22:06:46.999Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1147
File: internal/exec/validate_schema.go:42-57
Timestamp: 2025-04-11T22:06:46.999Z
Learning: The "ExecuteAtmosValidateSchemaCmd" function in internal/exec/validate_schema.go has been reviewed and confirmed to have acceptable cognitive complexity despite static analysis warnings. The function uses a clean structure with only three if statements for error handling and delegates complex operations to helper methods.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-08-15T14:43:41.030Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1352
File: pkg/store/artifactory_store_test.go:108-113
Timestamp: 2025-08-15T14:43:41.030Z
Learning: In test files for the atmos project, it's acceptable to ignore errors from os.Setenv/Unsetenv operations during test environment setup and teardown, as these are controlled test scenarios.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-11-08T19:56:18.660Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1697
File: internal/exec/oci_utils.go:0-0
Timestamp: 2025-11-08T19:56:18.660Z
Learning: In the Atmos codebase, when a function receives an `*schema.AtmosConfiguration` parameter, it should read configuration values from `atmosConfig.Settings` fields rather than using direct `os.Getenv()` or `viper.GetString()` calls. The Atmos pattern is: viper.BindEnv in cmd/root.go binds environment variables → Viper unmarshals into atmosConfig.Settings via mapstructure → business logic reads from the Settings struct. This provides centralized config management, respects precedence, and enables testability. Example: `atmosConfig.Settings.AtmosGithubToken` instead of `os.Getenv("ATMOS_GITHUB_TOKEN")` in functions like `getGHCRAuth` in internal/exec/oci_utils.go.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-12-13T06:10:13.688Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: errors/errors.go:184-203
Timestamp: 2025-12-13T06:10:13.688Z
Learning: cloudposse/atmos: For toolchain work, duplicate/unused error sentinels in errors/errors.go should be cleaned up in a separate refactor PR and not block feature PRs; canonical toolchain sentinels live under toolchain/registry with re-exports in toolchain/errors.go.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-09-13T18:06:07.674Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/list.go:39-42
Timestamp: 2025-09-13T18:06:07.674Z
Learning: In the cloudposse/atmos repository, for UI messages in the toolchain package, use utils.PrintfMessageToTUI instead of log.Error or fmt.Fprintln(os.Stderr, ...). Import pkg/utils with alias "u" to follow the established pattern.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2024-11-12T03:16:02.910Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 775
File: internal/exec/template_funcs_component.go:157-159
Timestamp: 2024-11-12T03:16:02.910Z
Learning: In the Go code for `componentFunc` in `internal/exec/template_funcs_component.go`, the function `cleanTerraformWorkspace` does not return errors, and it's acceptable if the file does not exist. Therefore, error handling for `cleanTerraformWorkspace` is not needed.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2025-01-09T22:27:25.538Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2024-10-20T00:57:53.500Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 731
File: internal/exec/validate_stacks.go:0-0
Timestamp: 2024-10-20T00:57:53.500Z
Learning: In `internal/exec/validate_stacks.go`, when downloading the Atmos JSON Schema file to the temp directory, the temporary file is overwritten each time, so explicit removal is not necessary.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2024-12-12T15:17:45.245Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2024-12-12T15:17:45.245Z
Learning: In `examples/demo-atmos.d/atmos.d/tools/helmfile.yml`, when suggesting changes to `kubeconfig_path`, ensure that the values use valid Go template syntax.
Applied to files:
internal/exec/stack_manifest_name_test.go
📚 Learning: 2024-12-07T16:19:01.683Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
internal/exec/stack_manifest_name_test.go
🧬 Code graph analysis (1)
internal/exec/utils.go (2)
pkg/schema/schema.go (1)
ConfigAndStacksInfo(727-824)pkg/config/const.go (1)
NameSectionName(65-65)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Summary
🔇 Additional comments (9)
tests/snapshots/TestCLICommands_atmos_describe_stacks_(stack-manifest-name).stderr.golden (1)
1-5: Snapshot looks correct.This captures the expected error when
describe stacksruns withoutname_patternconfigured. Aligns with the disabled Test 5 instack-manifest-name.yamlthat documents this requirement.tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_legacy-prod_(invalid_-_should_suggest_correct_name).stderr.golden (1)
1-14: Good error UX.The snapshot captures helpful guidance: identifies the invalid stack, suggests the canonical name, and points to
atmos list stacks. This directly addresses the PR objective of actionable hints.tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden (1)
1-186: Validates zero-config filename fallback.The snapshot confirms that when no
name,name_template, orname_patternis configured, the filename (no-name-prod) becomes the canonical stack identity. This is core to the PR's zero-config goal.tests/test-cases/stack-manifest-name.yaml (1)
1-137: Solid test coverage for stack identity rules.The test suite covers the key scenarios:
- Canonical name visibility in
list stacks- Component discovery by explicit name and filename
- Rejection paths with helpful error messages
Test 5 being disabled with documentation is appropriate given the
name_patternrequirement fordescribe stacks.internal/exec/stack_manifest_name_test.go (2)
407-449: Key test for issue #1932.This test validates that
ProcessStackscorrectly finds components when the manifest-levelnameis used. Direct coverage for the linked issue's requirement.
766-809: Good error hint validation.The test verifies both hints are present with exact content. Using
errors.GetAllHintsfrom cockroachdb/errors properly exercises the error chain.internal/exec/utils.go (3)
354-356: Enables zero-config naming.Setting
ContextPrefix = stackNamewhen no naming config exists lets the filename serve as the canonical identity. Clean implementation of the fallback.
420-432: Clear precedence implementation.The switch statement directly mirrors the documented precedence: manifest name → template/pattern → filename. The condition
ContextPrefix != stackNamecorrectly distinguishes template-generated names from fallback.
616-625: Helpful error path.When a user provides a filename that maps to a different canonical name, they get a specific suggestion rather than a generic "not found" error. Good UX.
|
@coderabbitai full review please |
|
@aknysh: I'll conduct a full review of the PR now. ✅ Actions performedFull review triggered. |
|
@aknysh: I'll conduct a full review of the PR now. 🧠 Learnings used✅ Actions performedFull review triggered. |
|
These changes were released in v1.204.0-rc.3. |
what
ProcessStacksto recognize the stack manifestnamefield when matching stacksnamefieldwhy
Issue 1: Manifest name not recognized
When a stack manifest has
name: "my-explicit-stack", users expect to use that name in commands:Previously this failed with "Could not find the component vpc in the stack".
Issue 2: Multiple names worked (incorrect)
After the initial fix, ALL of these worked for the same stack:
This is incorrect - a stack should have exactly ONE valid identifier.
Issue 3: Misleading error message
When using an invalid stack name (e.g., filename when explicit name exists), the error said "invalid component" instead of "invalid stack":
New: Zero-config for newcomers
When no
name,name_template, orname_patternis configured, stacks are now identified by their filename. This lets newcomers get started without any naming configuration:# Just works! atmos terraform plan vpc -s prodStack Name Identity Rule
Each stack has exactly ONE valid identifier based on precedence:
namefield in manifestname_templateresultname_patternresultEvidence
atmos list stacks - shows canonical names
Note:
my-legacy-prod-stackis shown (explicit name), notlegacy-prod(filename).atmos describe component vpc -s no-name-prod - filename works when no naming config
{ "atmos_component": "vpc", "atmos_stack": "no-name-prod", "atmos_stack_file": "no-name-prod", "stack": "no-name-prod", "workspace": "no-name-prod" }atmos describe component vpc -s my-legacy-prod-stack - explicit name works
{ "atmos_component": "vpc", "atmos_stack": "my-legacy-prod-stack", "atmos_stack_file": "legacy-prod", "atmos_manifest": "legacy-prod", "stack": "my-legacy-prod-stack", "workspace": "my-legacy-prod-stack" }Note:
atmos_stackismy-legacy-prod-stack(explicit name), whileatmos_stack_fileshowslegacy-prod(the actual filename).atmos describe component vpc -s legacy-prod - FAILS with helpful suggestions
This is correct -
legacy-prod.yamlhasname: my-legacy-prod-stack, so only that identifier is valid. The error now correctly identifies this as an invalid stack (not component) and provides hints suggesting the correct name and how to list available stacks.atmos terraform plan vpc -s legacy-prod - FAILS with helpful suggestions
Changes
errors/errors.go: AddErrInvalidStacksentinel errorinternal/exec/utils.go: Enforce single-identity matching infindComponentInStacks; return helpful error with suggestion when filename is used for stack with explicit name; enable filename fallback inprocessStackContextPrefixinternal/exec/stack_manifest_name_test.go: Add tests for identity enforcement, filename fallback, and improved error messagestests/test-cases/stack-manifest-name.yaml: Add CLI smoke tests with golden snapshots for stack name identitypkg/datafetcher/schema/atmos/manifest/1.0.json: Add schema documentation fornamefielddocs/prd/stack-name-identity.md: PRD documenting the specification (status: Implemented)website/blog/2026-01-06-stack-name-identity.mdx: Blog post documenting the changeswebsite/src/data/roadmap.js: Add "Filename-based stack identity" to DX roadmapReferences
Summary by CodeRabbit
New Features
Documentation
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.