Repository navigation
feat: Add metadata inheritance and metadata.name for workspace key prefix - #1812
Conversation
Introduces a design proposal for making metadata fields inheritable from base components, solving the versioned component state management problem. Key changes: - New `stacks.inherit.metadata` configuration option (default: true) - All metadata fields inherit except `metadata.inherits` - New `metadata.name` field for logical component identity - Updated workspace_key_prefix auto-generation to use metadata.name This enables DRY patterns for versioned components where the logical identity (for state keys) can be defined once in a base component and inherited by all derived components. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Introduces a design proposal for using metadata.name as the logical component identity in workspace_key_prefix auto-generation. Key points: - New metadata.name field represents logical component identity - Priority: explicit config > metadata.name > metadata.component > Atmos name - Fully backwards compatible - falls back to current behavior if not set - Solves versioned component state stability problem - Works with metadata inheritance for DRY configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…efix This implements the metadata inheritance feature and workspace_key_prefix calculation improvements: - Add `stacks.inherit.metadata` configuration option (default: true) - Make metadata inheritable from base components (except `metadata.inherits`) - Add `metadata.name` field for logical component identity - Update workspace_key_prefix auto-generation priority: 1. Explicit backend config 2. metadata.name (new) 3. metadata.component 4. Atmos component name This enables versioned component patterns where state remains stable across version upgrades (e.g., vpc/v1 -> vpc/v2) when using metadata.name. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Add metadata to list of inherited sections in inheritance docs - Document stacks.inherit.metadata configuration option - Update folder-based versioning to use metadata.name pattern - Remove incorrect settings.workspace_key_prefix examples - Add blog posts for metadata inheritance and stable workspace keys 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…e_key_prefix pattern - Add explicit convention that metadata.name should use top-level component folder - Document convention in blog post and version management docs - Replace manual workspace_key_prefix patterns with inherited metadata.name in: - git-flow-branches-as-channels.mdx (catalog inheritance pattern) - release-tracks-channels.mdx (both track organization approaches) - terraform-workspace.mdx (add recommended section before advanced) - version-management/index.mdx (best practices) - continuous-version-deployment.mdx (planned divergence examples) - strict-version-pinning.mdx (catalog pattern for versioned components) - folder-based-versioning.mdx (convention callout) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
Warning Rate limit exceededAndriy Knysh (@aknysh) has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 7 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds metadata inheritance (enabled by default) and a new Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
website/docs/design-patterns/version-management/continuous-version-deployment.mdx (1)
236-244: Please drop the old workspace_key_prefix guidanceThe example still tells readers to set
settings.workspace_key_prefix, which is the manual pattern this PR is retiring. To stay consistent, show the stable identity viametadata.name(or inherit from the catalog base) and remove the explicit prefix override. That keeps the doc aligned with the new metadata.name convention.vpc: metadata: - component: vpc-experiment # Pin dev to experiment - settings: - workspace_key_prefix: "vpc" # Keep stable across experiments + name: vpc # Stable identity across experiments + component: vpc-experiment # Pin dev to experiment
🧹 Nitpick comments (3)
pkg/schema/schema.go (1)
438-445: Stacks inheritance surface and default metadata behavior are well-shapedThe
Stacks.Inheritstruct plusStacksInherit.IsMetadataInheritanceEnabled()giving a default oftruelines up cleanly with the docs (“enabled by default, opt-out via atmos.yaml”) and keeps the config surface explicit while preserving sane zero-values.If you ever want extra nil-safety, you could switch the receiver to a value to allow
var s *StacksInheritcallers without risking a panic:-func (s *StacksInherit) IsMetadataInheritanceEnabled() bool { - if s.Metadata == nil { +func (s StacksInherit) IsMetadataInheritanceEnabled() bool { + if s.Metadata == nil { return true } - return *s.Metadata + return *s.Metadata }Also applies to: 447-462
docs/prd/metadata-inheritance.md (2)
26-26: Minor wording simplification.The phrase "each component must define" is slightly redundant since ownership is implied. Consider: "each component must explicitly define its own metadata" → "metadata cannot be inherited from base components."
352-352: Add missing punctuation.Line 352 (the
Exclude metadata.inherits...bullet) is missing a period at the end of the paragraph following the code block.Apply this minor fix:
- - Exclude `metadata.inherits` from being inherited + - Exclude `metadata.inherits` from being inherited.
📜 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 (20)
docs/prd/metadata-inheritance.md(1 hunks)docs/prd/workspace-key-prefixes.md(1 hunks)internal/exec/stack_processor_backend.go(4 hunks)internal/exec/stack_processor_backend_test.go(2 hunks)internal/exec/stack_processor_merge.go(3 hunks)internal/exec/stack_processor_process_stacks_helpers.go(1 hunks)internal/exec/stack_processor_process_stacks_helpers_inheritance.go(2 hunks)internal/exec/stack_processor_utils.go(1 hunks)pkg/datafetcher/schema/stacks/stack-config/1.0.json(2 hunks)pkg/schema/schema.go(2 hunks)website/blog/2025-11-21-metadata-inheritance.mdx(1 hunks)website/blog/2025-11-21-metadata-name-workspace-keys.mdx(1 hunks)website/docs/cli/commands/terraform/terraform-workspace.mdx(1 hunks)website/docs/core-concepts/stacks/inheritance/inheritance.mdx(3 hunks)website/docs/design-patterns/version-management/continuous-version-deployment.mdx(2 hunks)website/docs/design-patterns/version-management/folder-based-versioning.mdx(6 hunks)website/docs/design-patterns/version-management/git-flow-branches-as-channels.mdx(3 hunks)website/docs/design-patterns/version-management/index.mdx(1 hunks)website/docs/design-patterns/version-management/release-tracks-channels.mdx(2 hunks)website/docs/design-patterns/version-management/strict-version-pinning.mdx(1 hunks)
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
📚 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/stack_processor_process_stacks_helpers.gointernal/exec/stack_processor_backend.gointernal/exec/stack_processor_process_stacks_helpers_inheritance.gointernal/exec/stack_processor_merge.go
📚 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/stack_processor_process_stacks_helpers.gointernal/exec/stack_processor_backend.gointernal/exec/stack_processor_utils.gointernal/exec/stack_processor_merge.go
📚 Learning: 2024-12-08T14:26:16.972Z
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 828
File: pkg/schema/schema.go:98-100
Timestamp: 2024-12-08T14:26:16.972Z
Learning: The `ListConfig` columns array in the `Components` struct can be empty.
Applied to files:
internal/exec/stack_processor_process_stacks_helpers.go
📚 Learning: 2024-11-02T15:35:09.958Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 759
File: internal/exec/terraform.go:366-368
Timestamp: 2024-11-02T15:35:09.958Z
Learning: In `internal/exec/terraform.go`, the workspace cleaning code under both the general execution path and within the `case "init":` block is intentionally duplicated because the code execution paths are different. The `.terraform/environment` file should be deleted before executing `terraform init` in both scenarios to ensure a clean state.
Applied to files:
website/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/design-patterns/version-management/folder-based-versioning.mdx
📚 Learning: 2024-12-03T03:49:30.395Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx:104-110
Timestamp: 2024-12-03T03:49:30.395Z
Learning: In the documentation for `!terraform.output`, warnings about template variable availability are already covered in other sections, so no need to suggest adding them here.
Applied to files:
website/docs/cli/commands/terraform/terraform-workspace.mdx
📚 Learning: 2025-08-29T20:57:35.423Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1433
File: cmd/theme_list.go:33-36
Timestamp: 2025-08-29T20:57:35.423Z
Learning: In the Atmos codebase, avoid using viper.SetEnvPrefix("ATMOS") with viper.AutomaticEnv() because canonical environment variable names are not exclusive to Atmos and could cause conflicts. Instead, use selective environment variable binding through the setEnv function in pkg/config/load.go with bindEnv(v, "config.key", "ENV_VAR_NAME") for specific environment variables.
Applied to files:
website/docs/cli/commands/terraform/terraform-workspace.mdx
📚 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:
website/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/design-patterns/version-management/release-tracks-channels.mdx
📚 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:
website/blog/2025-11-21-metadata-inheritance.mdxdocs/prd/metadata-inheritance.mdinternal/exec/stack_processor_utils.gowebsite/docs/core-concepts/stacks/inheritance/inheritance.mdx
📚 Learning: 2025-11-10T23:23:39.771Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/registry/aqua/aqua_test.go:417-442
Timestamp: 2025-11-10T23:23:39.771Z
Learning: In Atmos toolchain AquaRegistry, tests should not hit real GitHub. Use the options pattern via WithGitHubBaseURL to inject an httptest server URL and make GetLatestVersion/GetAvailableVersions deterministic.
Applied to files:
internal/exec/stack_processor_backend_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_processor_backend.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/stack_processor_utils.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:
internal/exec/stack_processor_utils.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:
internal/exec/stack_processor_utils.go
🧬 Code graph analysis (3)
internal/exec/stack_processor_backend_test.go (1)
pkg/schema/schema.go (1)
AtmosConfiguration(53-94)
internal/exec/stack_processor_utils.go (3)
pkg/schema/schema.go (1)
Stacks(438-445)pkg/config/const.go (1)
InheritsSectionName(102-102)pkg/merge/merge.go (1)
Merge(389-427)
internal/exec/stack_processor_merge.go (3)
pkg/schema/schema.go (1)
Stacks(438-445)pkg/merge/merge.go (1)
Merge(389-427)pkg/config/const.go (1)
MetadataSectionName(75-75)
🪛 GitHub Actions: Website Preview Build
website/blog/2025-11-21-metadata-name-workspace-keys.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
website/docs/cli/commands/terraform/terraform-workspace.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
website/docs/design-patterns/version-management/continuous-version-deployment.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
website/blog/2025-11-21-metadata-inheritance.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
website/docs/design-patterns/version-management/folder-based-versioning.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
website/docs/design-patterns/version-management/index.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
website/docs/design-patterns/version-management/git-flow-branches-as-channels.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
website/docs/core-concepts/stacks/inheritance/inheritance.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
website/docs/design-patterns/version-management/strict-version-pinning.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
website/docs/design-patterns/version-management/release-tracks-channels.mdx
[error] 1-1: Build failed: Docusaurus reported broken links during locale en build. Broken link: /changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. Command: 'npm run build:site' (exit code 1).
🪛 LanguageTool
docs/prd/workspace-key-prefixes.md
[typographical] ~66-~66: Consider using a typographic opening quote here.
Context: ...e metadata-inheritance.md) - Represents "what this component IS" vs "where its co...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic close quote here.
Context: ...md) - Represents "what this component IS" vs "where its code lives" ### Updated ...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic opening quote here.
Context: ... Represents "what this component IS" vs "where its code lives" ### Updated Calcu...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic close quote here.
Context: ...s component IS" vs "where its code lives" ### Updated Calculation Logic **New p...
(EN_QUOTES)
[style] ~246-~246: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...endDefaults()similarly forprefix. Update setAzureBackendKey()similarly fork...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
website/docs/design-patterns/version-management/git-flow-branches-as-channels.mdx
[typographical] ~192-~192: Consider using a typographic opening quote here.
Context: ...erits name: vpc → workspace_key_prefix: "vpc" vars: name: "dev-use1...
(EN_QUOTES)
[typographical] ~192-~192: Consider using a typographic close quote here.
Context: ...s name: vpc → workspace_key_prefix: "vpc" vars: name: "dev-use1-vpc...
(EN_QUOTES)
[typographical] ~232-~232: Consider using a typographic opening quote here.
Context: ...erits name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-use...
(EN_QUOTES)
[typographical] ~232-~232: Consider using a typographic close quote here.
Context: ...s name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-use1-vp...
(EN_QUOTES)
docs/prd/metadata-inheritance.md
[style] ~26-~26: Since ownership is already implied, this phrasing may be redundant.
Context: ...d entirely - each component must define its own metadata. ### Problems This Causes ##...
(PRP_OWN)
[grammar] ~352-~352: Please add a punctuation mark at the end of paragraph.
Context: ... Exclude metadata.inherits from being inherited 2. Modify `internal/exec/stack_process...
(PUNCTUATION_PARAGRAPH_END)
website/docs/design-patterns/version-management/strict-version-pinning.mdx
[typographical] ~128-~128: Consider using a typographic opening quote here.
Context: ...erits name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-vpc...
(EN_QUOTES)
[typographical] ~128-~128: Consider using a typographic close quote here.
Context: ...s name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-vpc" ...
(EN_QUOTES)
[typographical] ~130-~130: Consider using a typographic opening quote here.
Context: ...prefix: "vpc" vars: name: "prod-vpc" cidr_block: "10.0.0.0/...
(EN_QUOTES)
[typographical] ~130-~130: Consider using a typographic close quote here.
Context: ...vpc" vars: name: "prod-vpc" cidr_block: "10.0.0.0/16" ``` <...
(EN_QUOTES)
[typographical] ~131-~131: Consider using a typographic opening quote here.
Context: ... name: "prod-vpc" cidr_block: "10.0.0.0/16" ``` ### 2. Maintai...
(EN_QUOTES)
[typographical] ~131-~131: Consider using a typographic close quote here.
Context: ...od-vpc" cidr_block: "10.0.0.0/16" ``` ### 2. Maintain Stable Wor...
(EN_QUOTES)
⏰ 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). (2)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Summary
🔇 Additional comments (24)
pkg/datafetcher/schema/stacks/stack-config/1.0.json (1)
506-509:metadata.namefield and updatedcustomdocs look consistent with inheritance behaviorAdding
metadata.nameas a logical identity for workspace key generation and clarifying thatmetadata.custominherits whenstacks.inherit.metadatais enabled matches the new stacks inheritance model and is backwards compatible (optional field, no new required keys).Also applies to: 550-551
pkg/schema/schema.go (1)
836-851: BaseComponentMetadata field nicely completes the base component config shapeAdding
BaseComponentMetadataalongside vars/settings/env/auth/providers/hooks keeps the base-component surface symmetric withComponentProcessorResultand gives you a clear slot to carry inherited metadata through the pipeline.website/blog/2025-11-21-metadata-name-workspace-keys.mdx (1)
1-60: Post reads well; please re-check the/blog/metadata-inheritancelink against the preview buildThe explanation and examples around using
metadata.nameas the stable top-level folder identity are clear and match the new convention. Given the reported Docusaurus error about/blog/metadata-inheritance, once this and the companion post are in place, please re-run the website build to confirm that link is now resolved (and adjust any changelog entry if it still points at a mismatched path).website/blog/2025-11-21-metadata-inheritance.mdx (1)
1-61: Nice concise overview of metadata inheritance; verify it clears the previously broken linkThe before/after YAML makes the behavior change obvious, and the config snippet for disabling
stacks.inherit.metadataaligns with the newStacksInheritAPI. Since the build previously reported/blog/metadata-inheritanceas missing, this file should fix that; please rerun the site build to confirm the broken-link check is now clean.internal/exec/stack_processor_process_stacks_helpers.go (1)
48-86: AddingBaseComponentMetadatato ComponentProcessorResult is consistent with the new metadata flowThreading
BaseComponentMetadatathroughComponentProcessorResultmatches the schema-sideBaseComponentConfigchange and gives inheritance helpers a proper place to stash merged base metadata without affecting existing fields.internal/exec/stack_processor_process_stacks_helpers_inheritance.go (2)
18-29: Wiring BaseComponentMetadata alongside other base maps looks consistentInitializing
result.BaseComponentMetadatawith the same capacity hint as vars/settings/env/auth keeps the pattern consistent and avoids nil-map edge cases when later merging.
193-203: Propagating BaseComponentMetadata out of BaseComponentConfig is the right placeAssigning
result.BaseComponentMetadata = baseComponentConfig.BaseComponentMetadatahere mirrors how other base sections are surfaced and keeps all inheritance-derived data flowing through the same struct.website/docs/core-concepts/stacks/inheritance/inheritance.mdx (1)
49-73: Metadata inheritance docs read clearly and match the new behaviorThe “What Gets Inherited” table plus the
:::info Metadata Inheritanceblock do a nice job of spelling out that metadata is inherited while excludingmetadata.inherits, and the small wording tweaks in the Single/Multiple/Multilevel sections keep the story consistent without overloading the reader. Thestacks.inherit.metadata: falseexample is also a helpful escape hatch for older stacks.Also applies to: 81-83, 251-253, 394-395
website/docs/design-patterns/version-management/index.mdx (1)
231-256: Best-practice shift to metadata.name for stable keys is coherentUsing
metadata.nameas the stable identity and keeping version info inmetadata.componentwhile flagging versionedworkspace_key_prefixpatterns as WRONG lines up well with the new backend behavior and should make upgrades much less brittle. The example YAML and cross-link to folder-based versioning are tight and actionable.website/docs/cli/commands/terraform/terraform-workspace.mdx (1)
55-85: Nice, this puts the simple metadata.name pattern before the advanced templatingThe catalog + prod stack example makes it obvious how
metadata.namedrives a stableworkspace_key_prefixwithout extra config, and parking the Go-templateworkspace_key_prefixunder an “Advanced” heading keeps that escape hatch available without encouraging it as the default. This matches the backend semantics you’re testing around metadata.name.Also, CI is currently failing on a Docusaurus broken link:
/changelog/metadata-name-workspace-keys -> /blog/metadata-inheritance. It doesn’t appear in this file, but you’ll want to update or remove that link elsewhere before merging.Also applies to: 87-98
internal/exec/stack_processor_merge.go (1)
136-152: Metadata inheritance merge and wiring into backend look solidUsing
finalComponentMetadataas the merge of base + component metadata (with component last) matches the documented “component wins” behavior, and threading that same merged map into both the publicMetadatasection andterraformBackendConfig.componentMetadatakeeps backend defaults (e.g., metadata.name-based workspace prefixes) aligned with what users see in the processed stack. The conditional onIsMetadataInheritanceEnabled()plus a non-empty base map keeps the fast path cheap.Also applies to: 161-163, 169-180
internal/exec/stack_processor_backend_test.go (1)
14-28: Good coverage for metadata.name-driven workspace key behaviorAdding
componentMetadatato the test matrix and asserting priority/fallback rules across S3/GCS/Azure (incl. slash normalization, explicitworkspace_key_prefixprecedence, and empty/absent name cases) gives strong confidence that the new backend logic matches the documented semantics. Normalizing nil metadata to an empty map in the test harness is also a nice touch to keep the call shape predictable.Also applies to: 235-347, 354-366
website/docs/design-patterns/version-management/folder-based-versioning.mdx (4)
103-165: Catalog inheritance pattern is well-documented and clear.The introduction of the catalog-based base component with
metadata.nameeffectively demonstrates how to stabilize workspace keys across version changes. The YAML structure is correct, and the inheritance pattern usingmetadata.inheritsis properly explained.
208-216: Metadata.name convention clearly established.The tip section effectively communicates the convention that
metadata.nameshould use the top-level component folder name. The examples make the pattern predictable and easy to follow.
272-303: Rollback strategy leverages catalog inheritance well.The section correctly shows how updating the base catalog component automatically propagates to all derived components. The zero-downtime rollback explanation is valuable context.
1-400: Review comment is inaccurate—the file doesn't contain the cited broken link.The search found no
/blog/metadata-inheritancelinks in the reviewed filefolder-based-versioning.mdx. The link actually exists in the blog postwebsite/blog/2025-11-21-metadata-name-workspace-keys.mdx(line 18), and that link target is valid—the destination blog postwebsite/blog/2025-11-21-metadata-inheritance.mdxexists. No action needed on the file under review.Likely an incorrect or invalid review comment.
website/docs/design-patterns/version-management/release-tracks-channels.mdx (3)
112-127: Catalog base definitions establish clear metadata inheritance pattern across both track organizations.Both "Tracks Per Component" and "Track-First Organization" approaches properly define base catalog components with
metadata.namefor logical identity. This makes the pattern consistent regardless of folder organization choice.Also applies to: 218-233
129-153: Stack-level component inheritance correctly leverages catalog metadata.Both production stack examples show proper usage of
metadata.inheritsto pull from base defaults, with clear comments explaining thatworkspace_key_prefixis inherited frommetadata.name. This reinforces the pattern established in file 1.Also applies to: 235-259
1-300: The review comment references non-existent broken links.After comprehensive search across the codebase, the link
/changelog/metadata-name-workspace-keys→/blog/metadata-inheritancedoes not exist in eitherrelease-tracks-channels.mdxorfolder-based-versioning.mdx.The only occurrence of
/blog/metadata-inheritanceexists in a separate blog post file (website/blog/2025-11-21-metadata-name-workspace-keys.mdx), where it is a valid link. The files cited in the review contain no such broken link pattern.All verified internal links in both documentation files are properly formed and reference valid paths.
Likely an incorrect or invalid review comment.
docs/prd/metadata-inheritance.md (5)
1-120: PRD effectively articulates the problem and proposed solution.The problem statement clearly explains why metadata inheritance is needed: preventing silent state loss during component version upgrades and enabling DRY metadata patterns. The proposed solution with
stacks.inherit.metadataconfiguration and the newmetadata.namefield is well-reasoned and backward-compatible.
121-165: Workspace key priority logic is clear and well-documented.The four-level priority (explicit prefix > metadata.name > metadata.component > Atmos name) is sensible and gives users appropriate control. The convention of setting
metadata.nameto the top-level folder name makes the pattern predictable.
166-282: Use cases comprehensively cover real-world scenarios.All four use cases—versioned components, release tracks, governance patterns, and multi-instance components—demonstrate practical value of the feature. The examples are clear and properly annotated with expected outcomes.
283-324: Breaking change analysis is thorough and honest.The assessment that breakage risk is low (because metadata wasn't previously inherited) is sound. Providing both a config-level opt-out and field-level overrides gives users adequate migration paths.
325-392: Implementation plan provides clear direction for backend team.Schema changes, processing updates, and JSON schema modifications are all specified. The plan correctly identifies the three key processing areas: stack utilities, merge logic, and backend defaults.
…ession Fix regression in `atmos list instances` where all component instances were being filtered out due to inheriting `metadata.type: abstract` from base components. ## Changes **Code fixes:** - Exclude `metadata.type: abstract` from metadata inheritance in stack_processor_utils.go - Abstract is a base component designation that should not propagate to child components - Other metadata.type values (e.g., 'real', custom types) continue to be inherited - Update code comments to clarify both 'inherits' and 'type: abstract' exclusions **Documentation updates:** - Update metadata-inheritance.md PRD to document the exclusion - Update inheritance.mdx website docs with clear explanation - Clarify that child components inheriting from abstract components are concrete implementations ## Test Results - TestCLICommands/atmos_list_instances - PASS - TestCLICommands/atmos_list_instances_no_tty - PASS - All internal/exec tests - PASS - Abstract component tests - PASS ## Impact - atmos list instances now correctly returns all non-abstract component instances - Base abstract components retain metadata.type: abstract - Child components do not inherit the abstract type designation - Other metadata fields continue to be inherited as designed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add extensive unit tests for metadata.name inheritance and metadata.type: abstract exclusion. ## What Changed - Added `internal/exec/metadata_inheritance_test.go` with 653 lines of comprehensive tests - Fixed broken changelog link in metadata-name-workspace-keys blog post ## Test Coverage Added ### 6 Major Test Functions (24+ test cases): 1. **TestMetadataNameInheritance** - Verifies metadata.name inheritance from base components and usage in workspace_key_prefix calculation 2. **TestMetadataTypeAbstractExclusion** - Confirms metadata.type: abstract is NOT inherited (prevents child components from becoming abstract) 3. **TestMetadataInheritsNotInherited** - Validates metadata.inherits is not inherited (it's the meta-property) 4. **TestMetadataInheritanceConfiguration** - Tests stacks.inherit.metadata flag (enabled/disabled) 5. **TestMetadataDeepMerge** - Verifies deep merging of nested metadata fields 6. **TestVersionedComponentUpgrade** - Validates PRIMARY use case from PRD (stable state paths across version upgrades) ## Coverage Improvement **Before**: ~40% coverage - Backend configuration with metadata.name tested - Abstract component handling tested - Missing: inheritance behavior, configuration flags, PRD use cases **After**: ~75-85% coverage (estimated) - All critical functionality tested - Edge cases covered - Primary use case validated - Configuration flags tested ## Test Results All tests PASS: - 24 new test cases added - All existing tests still pass (no regressions) - Website builds successfully ## Why This Matters The PR implemented metadata inheritance and metadata.name features but was missing critical test coverage for: - metadata.name inheritance from base components - metadata.type: abstract exclusion (commit af24538) - stacks.inherit.metadata configuration flag - Versioned component upgrade scenario (primary PRD use case) These tests ensure the feature works as documented and prevents regressions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
internal/exec/metadata_inheritance_test.go (1)
587-617: Test helper accuracy concern: filterBaseMetadata differs from production code.The test helper
filterBaseMetadata(lines 603-617) filters metadata fields before merging, but the production code in stack_processor_merge.go (lines 136-152) comments that filtering is "already excluded during collection" - which happens in stack_processor_utils.go (lines 1724-1748).However, your test helper implements the filtering correctly and matches the production logic in stack_processor_utils.go. The test approach is valid.
Minor suggestion: Add a comment explaining that this helper replicates the filtering logic from
processBaseComponentConfigInternalin stack_processor_utils.go for testing purposes, to make the relationship explicit.Apply this diff to clarify the helper's purpose:
-// filterBaseMetadata filters base metadata to exclude 'inherits' and 'type: abstract'. +// filterBaseMetadata filters base metadata to exclude 'inherits' and 'type: abstract'. +// This replicates the filtering logic from processBaseComponentConfigInternal in stack_processor_utils.go. func filterBaseMetadata(baseMetadata map[string]any) map[string]any {
📜 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 (6)
docs/prd/metadata-inheritance.md(1 hunks)internal/exec/metadata_inheritance_test.go(1 hunks)internal/exec/stack_processor_merge.go(3 hunks)internal/exec/stack_processor_utils.go(1 hunks)website/blog/2025-11-21-metadata-name-workspace-keys.mdx(1 hunks)website/docs/core-concepts/stacks/inheritance/inheritance.mdx(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- website/blog/2025-11-21-metadata-name-workspace-keys.mdx
- website/docs/core-concepts/stacks/inheritance/inheritance.mdx
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
📚 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/stack_processor_merge.gointernal/exec/stack_processor_utils.gointernal/exec/metadata_inheritance_test.go
📚 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:
docs/prd/metadata-inheritance.md
📚 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/stack_processor_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/stack_processor_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/stack_processor_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/metadata_inheritance_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/metadata_inheritance_test.go
📚 Learning: 2024-11-02T15:35:09.958Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 759
File: internal/exec/terraform.go:366-368
Timestamp: 2024-11-02T15:35:09.958Z
Learning: In `internal/exec/terraform.go`, the workspace cleaning code under both the general execution path and within the `case "init":` block is intentionally duplicated because the code execution paths are different. The `.terraform/environment` file should be deleted before executing `terraform init` in both scenarios to ensure a clean state.
Applied to files:
internal/exec/metadata_inheritance_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:
internal/exec/metadata_inheritance_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:
internal/exec/metadata_inheritance_test.go
📚 Learning: 2025-11-11T03:47:45.878Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/add_test.go:67-77
Timestamp: 2025-11-11T03:47:45.878Z
Learning: In the cloudposse/atmos codebase, tests should prefer t.Setenv for environment variable setup/teardown instead of os.Setenv/Unsetenv to ensure test-scoped isolation.
Applied to files:
internal/exec/metadata_inheritance_test.go
🧬 Code graph analysis (3)
internal/exec/stack_processor_merge.go (3)
pkg/schema/schema.go (1)
Stacks(438-445)pkg/merge/merge.go (1)
Merge(389-427)pkg/config/const.go (1)
MetadataSectionName(75-75)
internal/exec/stack_processor_utils.go (3)
pkg/schema/schema.go (1)
Stacks(438-445)pkg/config/const.go (1)
InheritsSectionName(102-102)pkg/merge/merge.go (1)
Merge(389-427)
internal/exec/metadata_inheritance_test.go (3)
pkg/schema/schema.go (2)
Stacks(438-445)StacksInherit(448-453)internal/exec/stack_processor_process_stacks_helpers.go (1)
ComponentProcessorResult(48-86)pkg/config/const.go (1)
InheritsSectionName(102-102)
🪛 LanguageTool
docs/prd/metadata-inheritance.md
[style] ~26-~26: Since ownership is already implied, this phrasing may be redundant.
Context: ...d entirely - each component must define its own metadata. ### Problems This Causes ##...
(PRP_OWN)
[grammar] ~354-~354: Please add a punctuation mark at the end of paragraph.
Context: ... Exclude metadata.inherits from being inherited 2. Modify `internal/exec/stack_process...
(PUNCTUATION_PARAGRAPH_END)
⏰ 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 (windows)
- GitHub Check: Acceptance Tests (macos)
- GitHub Check: Acceptance Tests (linux)
- GitHub Check: Summary
🔇 Additional comments (7)
internal/exec/stack_processor_merge.go (1)
136-152: LGTM! Metadata inheritance implementation follows established patterns.The metadata merging logic correctly:
- Gates on
IsMetadataInheritanceEnabled()for opt-out behavior- Follows the same merge order as other sections (base → component, component wins)
- Passes the final merged metadata to backend processing
One clarification: The comment states that
inheritsandtype: abstractare "already excluded during collection." Verify this happens in the base component processing path (lines 1724-1748 in stack_processor_utils.go), where the filtering actually occurs. The comment is accurate but refers to logic in a different file.docs/prd/metadata-inheritance.md (2)
103-122: LGTM! Inheritance behavior is clearly documented.The inheritance table and special exclusions section accurately reflect the implementation:
metadata.inheritsis excluded (it's the meta-property defining inheritance)metadata.type: abstractis excluded (base component designation)- Other fields are inherited and can be overridden
This matches the filtering logic in internal/exec/stack_processor_utils.go lines 1730-1741.
143-167: Documentation accurately reflects implementation—no changes needed.The priority order in the PRD matches the backend processing logic exactly. The explicit
backend.s3.workspace_key_prefixis checked first (line 87); if present and non-empty, the block is skipped entirely, preserving the user override. The fallback chain then follows:metadata.name(line 90),metadata.component(line 92), then the Atmos component name default (line 88). This same pattern is consistently applied to S3, GCS, and Azure backends.internal/exec/stack_processor_utils.go (1)
1724-1748: LGTM! Base component metadata filtering and merging is correct.The implementation properly:
- Filters out
metadata.inherits(line 1732) - the meta-property defining inheritance- Excludes
type: abstract(lines 1736-1740) - base component designation- Merges the filtered base metadata with accumulated
BaseComponentMetadata- Gates the entire block on
IsMetadataInheritanceEnabled()This filtering happens during base component processing, which is what the comment in stack_processor_merge.go refers to when it says "already excluded during collection."
One edge case to consider: If a base component has
type: "concrete"(or any non-abstract type), it will be inherited. Is this intentional? Based on the PRD (lines 109, 250-260 in metadata-inheritance.md), this appears correct - onlytype: abstractshould be excluded.internal/exec/metadata_inheritance_test.go (3)
15-204: LGTM! Comprehensive test coverage for metadata.name inheritance.The test suite covers critical scenarios:
- Basic inheritance from base components
- Component override of inherited values
- Versioned components (the primary use case)
- Inheritance disabled via configuration flag
- Slash normalization in metadata.name
- Empty/missing name handling
- Multiple component instances with different names
Each test verifies both the metadata merging and the downstream effect on workspace_key_prefix calculation by calling the actual
processTerraformBackendfunction, providing good integration coverage.
208-335: LGTM! Type exclusion logic is thoroughly tested.The tests correctly verify:
type: abstractis excluded from inheritance (lines 221-232)- Other type values like
real-componentARE inherited (lines 249-260)- Component can explicitly override inherited type (lines 262-274)
- Other metadata fields are still inherited when type is excluded (lines 322-332)
This matches the PRD specification (lines 109, 119-122 in metadata-inheritance.md) that only
type: abstractis excluded as a special case.
619-643: Simplified merge helper is adequate for tests.The
simpleMergehelper uses a recursive approach for deep merging maps (lines 631-637), which is simpler than the productionpkg/merge.Mergethat handles list merge strategies and other complexities.For unit testing metadata inheritance, this simplified version is sufficient since metadata typically contains nested maps rather than complex list structures. The comment on line 620 appropriately notes this difference.
The `atmos describe config` output now includes the `stacks.inherit` field, which was added as part of the metadata inheritance feature. This field controls whether metadata is inherited from base components. This is an expected change in the configuration schema and output format. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…e resolution Apply metadata inheritance when processing stacks in ExecuteDescribeStacks to ensure inherited metadata fields like terraform_workspace are correctly resolved. Previously, ExecuteDescribeStacks only merged YAML imports via FindStacksMap but did not apply component inheritance, causing components with metadata.inherits to ignore inherited metadata fields. Changes: - Call ProcessBaseComponentConfig to resolve inheritance chains for each component - Merge base component metadata with component's own metadata (component overrides base) - Remove terraform_workspace_pattern/template when explicit terraform_workspace exists to ensure explicit values take precedence over inherited/imported patterns Fixes TestDescribeStacksWithFilter7 which expects test/test-component-override-3 to inherit terraform_workspace from its inheritance chain. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1812 +/- ##
==========================================
+ Coverage 72.57% 72.63% +0.06%
==========================================
Files 521 521
Lines 49522 49598 +76
==========================================
+ Hits 35939 36025 +86
+ Misses 10844 10830 -14
- Partials 2739 2743 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
CodeRabbit (@coderabbitai) full review please |
|
Andriy Knysh (@aknysh) I'll perform a full review of all the changes in this PR. ✅ Actions performedFull review triggered. |
|
Andriy Knysh (@aknysh) I'll perform a comprehensive review of all the changes in this PR, covering the metadata inheritance implementation, workspace key prefix logic, tests, and documentation updates. 🧠 Learnings used✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/datafetcher/schema/stacks/stack-config/1.0.json (1)
487-513: Implementation of metadata inheritance is correct; user-facing documentation needs updates to explain the behavior.The
metadata.namefield and the updatedmetadata.customdescription in the schema accurately reflect the implementation. Tests ininternal/exec/metadata_inheritance_test.goconfirm that:
metadata.nameis inherited from base components whenstacks.inherit.metadatais enabled (the default)metadata.nameis properly used forworkspace_key_prefixauto-generation with the correct prioritymetadata.customis deep-merged and inherited when the inheritance flag is enabledHowever, while the feature is documented in
docs/prd/metadata-inheritance.md, user-facing documentation does not yet explain the metadata inheritance behavior. Update the component metadata documentation (or relevant guides) to clarify:
- Which metadata fields are inherited by default
- How
metadata.nameenables stable logical identity across component versions- The inheritance priority for
workspace_key_prefixauto-generation
♻️ Duplicate comments (3)
docs/prd/metadata-inheritance.md (2)
1-10: Status formatting uses emphasis instead of heading.Line 5 uses
**Implemented**instead of a proper Markdown heading. This was flagged in a previous review. Consider using### Implementedfor proper document structure.
349-364: Missing punctuation at end of line 354.This was flagged in a previous review. Line 354 should end with a period.
docs/prd/workspace-key-prefixes.md (1)
3-5: Format: Use heading instead of bold for status.This was flagged in a previous review. Change bold to a proper heading structure.
## Status -**Implemented** +### Implemented
🧹 Nitpick comments (4)
internal/exec/stack_processor_process_stacks_helpers.go (1)
47-86:BaseComponentMetadataaddition looks fine; just confirm initialization/merge behavior.The new
BaseComponentMetadata map[string]anyfits cleanly alongside the other base‑component fields and supports the inheritance flow described in the PR. SinceprocessComponentdoesn’t pre‑allocate this map (same as other base maps), please just ensure that any merge logic either:
- Assigns a non‑nil map from existing metadata, or
- Allocates a map before writing into it (so we never write to a nil map).
If you expect frequent writes, you might also consider initializing it in the constructor with a capacity hint for symmetry with
ComponentMetadata, but that’s optional.internal/exec/describe_stacks.go (1)
243-246: Consider logging invalid inheritance entries.The silent
continueon invalid entries could mask configuration problems. A debug-level log would help users troubleshoot inheritance issues without failing the describe operation.for _, inheritValue := range inheritList { inheritFrom, ok := inheritValue.(string) if !ok { + // Log at debug level to help troubleshoot inheritance issues + u.LogDebug(atmosConfig, fmt.Sprintf("Skipping non-string inherit value in component '%s'", componentName)) continue // Skip invalid entries. }website/docs/components/terraform/workspaces.mdx (1)
239-239: Minor: Add punctuation to list item.Static analysis flagged line 239 missing end punctuation. For consistency with the other list items.
- - Complex naming rules + - Complex naming rules.internal/exec/metadata_inheritance_test.go (1)
587-643: Test helpers replicate production logic.The
mergeMetadata,filterBaseMetadata, andsimpleMergehelpers duplicate the production merge logic. This approach can drift from production code.Consider importing and using the actual production merge function from
pkg/mergeorstack_processor_utils.goto ensure tests validate real behavior rather than a local approximation.
📜 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 (30)
docs/prd/metadata-inheritance.md(1 hunks)docs/prd/workspace-key-prefixes.md(1 hunks)internal/exec/describe_stacks.go(2 hunks)internal/exec/metadata_inheritance_test.go(1 hunks)internal/exec/stack_processor_backend.go(4 hunks)internal/exec/stack_processor_backend_test.go(2 hunks)internal/exec/stack_processor_merge.go(3 hunks)internal/exec/stack_processor_process_stacks_helpers.go(1 hunks)internal/exec/stack_processor_process_stacks_helpers_inheritance.go(2 hunks)internal/exec/stack_processor_utils.go(1 hunks)pkg/datafetcher/schema/stacks/stack-config/1.0.json(2 hunks)pkg/schema/schema.go(2 hunks)tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden(1 hunks)website/blog/2025-11-21-metadata-inheritance.mdx(1 hunks)website/blog/2025-11-21-metadata-name-workspace-keys.mdx(1 hunks)website/docs/cli/commands/terraform/terraform-workspace.mdx(1 hunks)website/docs/cli/configuration/stacks/_category_.json(1 hunks)website/docs/cli/configuration/stacks/index.mdx(3 hunks)website/docs/cli/configuration/stacks/inherit.mdx(1 hunks)website/docs/components/terraform/backends.mdx(2 hunks)website/docs/components/terraform/workspaces.mdx(2 hunks)website/docs/design-patterns/version-management/continuous-version-deployment.mdx(2 hunks)website/docs/design-patterns/version-management/folder-based-versioning.mdx(1 hunks)website/docs/design-patterns/version-management/git-flow-branches-as-channels.mdx(3 hunks)website/docs/design-patterns/version-management/index.mdx(1 hunks)website/docs/design-patterns/version-management/release-tracks-channels.mdx(2 hunks)website/docs/design-patterns/version-management/strict-version-pinning.mdx(1 hunks)website/docs/howto/inheritance.mdx(3 hunks)website/docs/quick-start/advanced/configure-terraform-backend.mdx(1 hunks)website/docs/stacks/components/metadata.mdx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
website/**
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
website/**: Update website documentation in thewebsite/directory when adding new features, ensure consistency between CLI help text and website documentation, and follow the website's documentation structure and style
Keep website code in thewebsite/directory, follow the existing website architecture and style, and test website changes locally before committing
Keep CLI documentation and website documentation in sync and document new features on the website with examples and use cases
Files:
website/blog/2025-11-21-metadata-inheritance.mdxwebsite/docs/cli/configuration/stacks/inherit.mdxwebsite/docs/cli/configuration/stacks/_category_.jsonwebsite/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/components/terraform/backends.mdxwebsite/docs/cli/configuration/stacks/index.mdxwebsite/blog/2025-11-21-metadata-name-workspace-keys.mdxwebsite/docs/design-patterns/version-management/continuous-version-deployment.mdxwebsite/docs/design-patterns/version-management/folder-based-versioning.mdxwebsite/docs/design-patterns/version-management/strict-version-pinning.mdxwebsite/docs/howto/inheritance.mdxwebsite/docs/components/terraform/workspaces.mdxwebsite/docs/stacks/components/metadata.mdxwebsite/docs/design-patterns/version-management/release-tracks-channels.mdxwebsite/docs/design-patterns/version-management/git-flow-branches-as-channels.mdxwebsite/docs/design-patterns/version-management/index.mdxwebsite/docs/quick-start/advanced/configure-terraform-backend.mdx
website/blog/*.mdx
📄 CodeRabbit inference engine (CLAUDE.md)
Blog posts require YAML front matter with slug, title, authors, and tags. Use
<!--truncate-->after intro. ONLY use existing tags fromwebsite/blog/*.mdx- check before writing. Author field must be GitHub username, added towebsite/blog/authors.yml. Filename format:YYYY-MM-DD-feature-name.mdx. PRs labeledminor/majorMUST include blog post
Files:
website/blog/2025-11-21-metadata-inheritance.mdxwebsite/blog/2025-11-21-metadata-name-workspace-keys.mdx
website/docs/cli/commands/**/*.mdx
📄 CodeRabbit inference engine (CLAUDE.md)
All CLI commands need Docusaurus documentation using
<dl>for arguments/flags. Follow Docusaurus conventions: frontmatter (slug, title, etc.), purpose note, screengrab, usage/examples/arguments/flags sections. File location:website/docs/cli/commands/<command>/<subcommand>.mdx. Always build after changes:cd website && npm run build
Files:
website/docs/cli/commands/terraform/terraform-workspace.mdx
**/*.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)
Import organization: three groups separated by blank lines, sorted alphabetically: 1) Go stdlib, 2) 3rd-party (NOT cloudposse/atmos), 3) Atmos packages. Maintain aliases:cfg,log,u,errUtils
Adddefer perf.Track(atmosConfig, "pkg.FuncName")()+ blank line to all public functions. Usenilif no atmosConfig param
Keep files small and focused (<600 lines). One cmd/impl per file. Co-locate tests. Never use//revive:disable:file-length-limit
Use sentinel errors fromerrors/errors.gowith ErrorBuilder for all user-facing errors. Useerrors.Is()for checking errors, never string comparison.WithCause()preserves underlying error messages,WithExplanation()adds context,WithHint()provides guidance,WithContext()adds key-value pairs
Usecontext.Contextas first parameter for: cancellation signals (prop...
Files:
internal/exec/stack_processor_backend_test.gointernal/exec/stack_processor_process_stacks_helpers_inheritance.gopkg/schema/schema.gointernal/exec/stack_processor_process_stacks_helpers.gointernal/exec/stack_processor_utils.gointernal/exec/stack_processor_backend.gointernal/exec/stack_processor_merge.gointernal/exec/describe_stacks.gointernal/exec/metadata_inheritance_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 fixtures
**/*_test.go: Useassert.ErrorIs(t, err, ErrSentinel)for checking our own errors and stdlib errors. Only use string matching for third-party errors
NEVER useassert.Contains(err.Error(), ...)for error checking. ALWAYS useassert.ErrorIs()instead. NEVER use string comparison:err.Error() == "..."orstrings.Contains(err.Error(), ...)
Test behavior, not implementation. Never test stub functions - implement or remove. Avoid tautological tests. Make code testable using dependency injection to avoidos.Exit,CheckErrorPrintAndExit, external systems. Remove always-skipped tests - fix or delete. Table-driven tests must have real scenarios
Usego.uber.org/mock/mockgenwith//go:generatedirectives for mock generation. Never create manual mocks. Pattern://go:generate go run go.uber.org/mock/mockgen@latest -source=filename.go -destination=mock_filename_test.go
Use table-driven tests for comprehensive coverage. Tests must call actual production code, never duplicate logic. Target >80% test coverage (enforced by CodeCov)
Files:
internal/exec/stack_processor_backend_test.gointernal/exec/metadata_inheritance_test.go
pkg/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
pkg/**/*.go: Business logic packages must follow the Service-Oriented Architecture pattern with: one Service struct per domain, Provider interfaces for classes of problems, default implementations, mock implementations, and dependency injection for testability
Use interface-driven design: define interfaces for all major functionality, use dependency injection for testability, generate mocks withgo.uber.org/mock/mockgenwith//go:generatedirectives, avoid integration tests by mocking external dependencies
Create focused purpose-built packages inpkg/for new functionality, each with clear responsibility. DO NOT add new functions topkg/utils/orinternal/exec/. Each package should have focused business logic with tests
Implement registry pattern for extensibility and plugin-like architecture. Define interfaces for provider implementations, register implementations in registry, generate mocks with mockgen. Examples: Command Registry incmd/internal/registry.go, Store Registry inpkg/store/registry.go
Files:
pkg/schema/schema.go
docs/prd/*.md
📄 CodeRabbit inference engine (CLAUDE.md)
Use kebab-case for PRD filenames:
command-registry-pattern.md,error-handling-strategy.md,testing-strategy.md. All PRDs indocs/prd/
Files:
docs/prd/workspace-key-prefixes.mddocs/prd/metadata-inheritance.md
🧠 Learnings (38)
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to website/blog/*.mdx : Blog posts require YAML front matter with slug, title, authors, and tags. Use `<!--truncate-->` after intro. ONLY use existing tags from `website/blog/*.mdx` - check before writing. Author field must be GitHub username, added to `website/blog/authors.yml`. Filename format: `YYYY-MM-DD-feature-name.mdx`. PRs labeled `minor`/`major` MUST include blog post
Applied to files:
website/blog/2025-11-21-metadata-inheritance.mdx
📚 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:
website/blog/2025-11-21-metadata-inheritance.mdxwebsite/docs/cli/configuration/stacks/inherit.mdxwebsite/docs/components/terraform/backends.mdxwebsite/docs/cli/configuration/stacks/index.mdxwebsite/docs/howto/inheritance.mdxdocs/prd/metadata-inheritance.md
📚 Learning: 2024-12-03T04:01:16.446Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx:0-0
Timestamp: 2024-12-03T04:01:16.446Z
Learning: In the `terraform.output.mdx` documentation file (`website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx`), the cache invalidation and cache scope behavior for the `!terraform.output` function are already described.
Applied to files:
website/docs/cli/configuration/stacks/inherit.mdx
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to tests/**/*.yaml : NEVER modify `tests/test-cases/` or `tests/testdata/` unless explicitly instructed. Golden snapshots are sensitive to minor changes. Use fixtures in `tests/test-cases/`: `atmos.yaml`, `stacks/`, `components/`
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldenwebsite/docs/design-patterns/version-management/strict-version-pinning.mdx
📚 Learning: 2025-12-04T02:40:41.742Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1588
File: website/docs/learn/mindset.mdx:36-39
Timestamp: 2025-12-04T02:40:41.742Z
Learning: In Docusaurus documentation, when a sidebar category has a `link` configuration like `link: {type: "doc", id: "quick-start/simple/simple"}`, the category URL path (e.g., `/quick-start/simple`) correctly resolves to the linked document. Links should use the shorter category path, not the full document path, as this is the proper Docusaurus routing pattern.
Applied to files:
website/docs/cli/configuration/stacks/_category_.json
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to website/docs/cli/commands/**/*.mdx : All CLI commands need Docusaurus documentation using `<dl>` for arguments/flags. Follow Docusaurus conventions: frontmatter (slug, title, etc.), purpose note, screengrab, usage/examples/arguments/flags sections. File location: `website/docs/cli/commands/<command>/<subcommand>.mdx`. Always build after changes: `cd website && npm run build`
Applied to files:
website/docs/cli/configuration/stacks/_category_.jsonwebsite/docs/cli/configuration/stacks/index.mdx
📚 Learning: 2024-11-02T15:35:09.958Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 759
File: internal/exec/terraform.go:366-368
Timestamp: 2024-11-02T15:35:09.958Z
Learning: In `internal/exec/terraform.go`, the workspace cleaning code under both the general execution path and within the `case "init":` block is intentionally duplicated because the code execution paths are different. The `.terraform/environment` file should be deleted before executing `terraform init` in both scenarios to ensure a clean state.
Applied to files:
website/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/components/terraform/backends.mdxwebsite/docs/design-patterns/version-management/folder-based-versioning.mdxwebsite/docs/components/terraform/workspaces.mdxwebsite/docs/quick-start/advanced/configure-terraform-backend.mdx
📚 Learning: 2024-12-03T03:49:30.395Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx:104-110
Timestamp: 2024-12-03T03:49:30.395Z
Learning: In the documentation for `!terraform.output`, warnings about template variable availability are already covered in other sections, so no need to suggest adding them here.
Applied to files:
website/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/components/terraform/workspaces.mdx
📚 Learning: 2025-08-29T20:57:35.423Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1433
File: cmd/theme_list.go:33-36
Timestamp: 2025-08-29T20:57:35.423Z
Learning: In the Atmos codebase, avoid using viper.SetEnvPrefix("ATMOS") with viper.AutomaticEnv() because canonical environment variable names are not exclusive to Atmos and could cause conflicts. Instead, use selective environment variable binding through the setEnv function in pkg/config/load.go with bindEnv(v, "config.key", "ENV_VAR_NAME") for specific environment variables.
Applied to files:
website/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/components/terraform/backends.mdx
📚 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:
website/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/components/terraform/backends.mdxwebsite/docs/design-patterns/version-management/release-tracks-channels.mdx
📚 Learning: 2025-04-25T20:54:19.701Z
Learnt from: mcalhoun
Repo: cloudposse/atmos PR: 963
File: website/docs/core-concepts/projects/configuration/stores.mdx:286-286
Timestamp: 2025-04-25T20:54:19.701Z
Learning: For the AWS SSM Parameter Store implementation in Atmos, support for `read_role_arn` and `write_role_arn` options is essential to enable cross-account access, allowing users to run operations like `terraform plan` in multiple accounts while accessing values across keystores. Azure Key Vault would need similar capabilities for cross-tenant/subscription authentication.
Applied to files:
website/docs/components/terraform/backends.mdxwebsite/docs/quick-start/advanced/configure-terraform-backend.mdx
📚 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:
website/docs/components/terraform/backends.mdxwebsite/docs/cli/configuration/stacks/index.mdx
📚 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_processor_backend_test.gointernal/exec/metadata_inheritance_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_processor_backend_test.gointernal/exec/metadata_inheritance_test.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*_test.go : Test behavior, not implementation. Never test stub functions - implement or remove. Avoid tautological tests. Make code testable using dependency injection to avoid `os.Exit`, `CheckErrorPrintAndExit`, external systems. Remove always-skipped tests - fix or delete. Table-driven tests must have real scenarios
Applied to files:
internal/exec/stack_processor_backend_test.gointernal/exec/metadata_inheritance_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/stack_processor_process_stacks_helpers_inheritance.gointernal/exec/stack_processor_process_stacks_helpers.gointernal/exec/stack_processor_utils.gointernal/exec/stack_processor_backend.gointernal/exec/stack_processor_merge.gointernal/exec/metadata_inheritance_test.go
📚 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/stack_processor_process_stacks_helpers_inheritance.gointernal/exec/stack_processor_process_stacks_helpers.gointernal/exec/stack_processor_utils.gointernal/exec/stack_processor_merge.go
📚 Learning: 2025-01-25T03:51:57.689Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Applied to files:
website/docs/components/terraform/workspaces.mdx
📚 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:
website/docs/components/terraform/workspaces.mdx
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to docs/prd/*.md : Use kebab-case for PRD filenames: `command-registry-pattern.md`, `error-handling-strategy.md`, `testing-strategy.md`. All PRDs in `docs/prd/`
Applied to files:
docs/prd/workspace-key-prefixes.md
📚 Learning: 2024-12-08T14:26:16.972Z
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 828
File: pkg/schema/schema.go:98-100
Timestamp: 2024-12-08T14:26:16.972Z
Learning: The `ListConfig` columns array in the `Components` struct can be empty.
Applied to files:
internal/exec/stack_processor_process_stacks_helpers.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_processor_backend.gointernal/exec/describe_stacks.go
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
internal/exec/describe_stacks.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:
internal/exec/describe_stacks.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/describe_stacks.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*.go : Import organization: three groups separated by blank lines, sorted alphabetically: 1) Go stdlib, 2) 3rd-party (NOT cloudposse/atmos), 3) Atmos packages. Maintain aliases: `cfg`, `log`, `u`, `errUtils`
Applied to files:
internal/exec/describe_stacks.go
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.
Applied to files:
internal/exec/describe_stacks.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/describe_stacks.go
📚 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:
internal/exec/describe_stacks.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*.go : Add `defer perf.Track(atmosConfig, "pkg.FuncName")()` + blank line to all public functions. Use `nil` if no atmosConfig param
Applied to files:
internal/exec/describe_stacks.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/describe_stacks.go
📚 Learning: 2025-09-27T20:50:20.564Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1533
File: pkg/config/load.go:585-637
Timestamp: 2025-09-27T20:50:20.564Z
Learning: In the cloudposse/atmos repository, command merging prioritizes precedence over display ordering. Help commands are displayed lexicographically regardless of internal array order, so the mergeCommandArrays function focuses on ensuring the correct precedence chain (top-level file wins) rather than maintaining specific display order.
Applied to files:
internal/exec/describe_stacks.go
📚 Learning: 2025-11-09T19:06:58.470Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1752
File: pkg/profile/list/formatter_table.go:27-29
Timestamp: 2025-11-09T19:06:58.470Z
Learning: In the cloudposse/atmos repository, performance tracking with `defer perf.Track()` is enforced on all functions via linting, including high-frequency utility functions, formatters, and renderers. This is a repository-wide policy to maintain consistency and avoid making case-by-case judgment calls about which functions should have profiling.
Applied to files:
internal/exec/describe_stacks.go
📚 Learning: 2025-10-16T05:26:31.892Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1639
File: pkg/merge/merge.go:392-430
Timestamp: 2025-10-16T05:26:31.892Z
Learning: In Atmos merge operations (pkg/merge/merge.go), context.Positions is a PositionMap (map[string]*schema.Position) keyed by JSONPath strings, not a slice indexed by input array position. Position lookups are path-based, making them independent of input array reorganization or filtering. This design allows filtering empty inputs without affecting provenance tracking correctness.
Applied to files:
internal/exec/describe_stacks.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*.go : Before implementing new functionality, search `internal/exec/` and `pkg/` for existing code. Extend, don't duplicate
Applied to files:
internal/exec/metadata_inheritance_test.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*.go : New configs support Go templating with `FuncMap()` from `internal/exec/template_funcs.go`. Implement template functions in `internal/exec/template_funcs.go`, register them, add tests, and update documentation
Applied to files:
internal/exec/metadata_inheritance_test.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to pkg/**/*.go : Create focused purpose-built packages in `pkg/` for new functionality, each with clear responsibility. DO NOT add new functions to `pkg/utils/` or `internal/exec/`. Each package should have focused business logic with tests
Applied to files:
internal/exec/metadata_inheritance_test.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*_test.go : Use table-driven tests for comprehensive coverage. Tests must call actual production code, never duplicate logic. Target >80% test coverage (enforced by CodeCov)
Applied to files:
internal/exec/metadata_inheritance_test.go
🧬 Code graph analysis (4)
internal/exec/stack_processor_backend_test.go (1)
pkg/schema/schema.go (1)
AtmosConfiguration(53-95)
pkg/schema/schema.go (1)
pkg/auth/provisioning/provisioner.go (1)
Metadata(42-51)
internal/exec/stack_processor_merge.go (3)
pkg/schema/schema.go (1)
Stacks(440-447)pkg/merge/merge.go (1)
Merge(389-427)pkg/config/const.go (1)
MetadataSectionName(75-75)
internal/exec/describe_stacks.go (4)
pkg/schema/schema.go (2)
Stacks(440-447)BaseComponentConfig(838-853)pkg/config/const.go (1)
InheritsSectionName(102-102)internal/exec/stack_processor_utils.go (1)
ProcessBaseComponentConfig(1447-1492)pkg/merge/merge.go (1)
Merge(389-427)
🪛 LanguageTool
website/docs/design-patterns/version-management/strict-version-pinning.mdx
[typographical] ~128-~128: Consider using a typographic opening quote here.
Context: ...erits name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-vpc...
(EN_QUOTES)
[typographical] ~128-~128: Consider using a typographic close quote here.
Context: ...s name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-vpc" ...
(EN_QUOTES)
[typographical] ~130-~130: Consider using a typographic opening quote here.
Context: ...prefix: "vpc" vars: name: "prod-vpc" cidr_block: "10.0.0.0/...
(EN_QUOTES)
[typographical] ~130-~130: Consider using a typographic close quote here.
Context: ...vpc" vars: name: "prod-vpc" cidr_block: "10.0.0.0/16" ``` <...
(EN_QUOTES)
[typographical] ~131-~131: Consider using a typographic opening quote here.
Context: ... name: "prod-vpc" cidr_block: "10.0.0.0/16" ``` ### 2. Maintai...
(EN_QUOTES)
[typographical] ~131-~131: Consider using a typographic close quote here.
Context: ...od-vpc" cidr_block: "10.0.0.0/16" ``` ### 2. Maintain Stable Wor...
(EN_QUOTES)
website/docs/howto/inheritance.mdx
[typographical] ~65-~65: To join two clauses or introduce examples, consider using an em dash.
Context: ... exceptions: 1. metadata.inherits - Not inherited because it defines the inh...
(DASH_RULE)
website/docs/components/terraform/workspaces.mdx
[typographical] ~229-~229: To join two clauses or introduce examples, consider using an em dash.
Context: ....terraform_workspace_template(highest) - Full Go template syntax 2.metadata.ter...
(DASH_RULE)
[typographical] ~232-~232: To join two clauses or introduce examples, consider using an em dash.
Context: ...to-generated from stack context (lowest) - Default behavior :::tip When to Use Tem...
(DASH_RULE)
[grammar] ~239-~239: Please add a punctuation mark at the end of paragraph.
Context: ...g/Gomplate functions - Complex naming rules - **Use terraform_workspace_pattern*...
(PUNCTUATION_PARAGRAPH_END)
[style] ~241-~241: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ...terraform_workspace_pattern`** when you need: - Simple token replacement with cont...
(EN_REPEATEDWORDS_NEED)
[style] ~245-~245: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ... Use terraform_workspace when you need: - A fixed, static workspace name. ::...
(EN_REPEATEDWORDS_NEED)
[typographical] ~260-~260: In American English, use a period after an abbreviation.
Context: ...orm.tfstate ``` :::note Workspace Name vs Workspace Key Prefix These are two sepa...
(MISSING_PERIOD_AFTER_ABBREVIATION)
[typographical] ~317-~317: To join two clauses or introduce examples, consider using an em dash.
Context: ...](/stacks/components/component-metadata) - Configure terraform_workspace and `ter...
(DASH_RULE)
docs/prd/workspace-key-prefixes.md
[typographical] ~66-~66: Consider using a typographic opening quote here.
Context: ...e metadata-inheritance.md) - Represents "what this component IS" vs "where its co...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic close quote here.
Context: ...md) - Represents "what this component IS" vs "where its code lives" ### Updated ...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic opening quote here.
Context: ... Represents "what this component IS" vs "where its code lives" ### Updated Calcu...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic close quote here.
Context: ...s component IS" vs "where its code lives" ### Updated Calculation Logic **New p...
(EN_QUOTES)
[style] ~246-~246: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...endDefaults()similarly forprefix. Update setAzureBackendKey()similarly fork...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
docs/prd/metadata-inheritance.md
[style] ~26-~26: Since ownership is already implied, this phrasing may be redundant.
Context: ...d entirely - each component must define its own metadata. ### Problems This Causes ##...
(PRP_OWN)
[typographical] ~121-~121: To join two clauses or introduce examples, consider using an em dash.
Context: ...circular dependencies. - metadata.type - Component type (abstract, real, or c...
(DASH_RULE)
[style] ~121-~121: Since ownership is already implied, this phrasing may be redundant.
Context: ...ited. Each component explicitly defines its own type. ### New Field: metadata.name ...
(PRP_OWN)
website/docs/design-patterns/version-management/git-flow-branches-as-channels.mdx
[typographical] ~192-~192: Consider using a typographic opening quote here.
Context: ...erits name: vpc → workspace_key_prefix: "vpc" vars: name: "dev-use1...
(EN_QUOTES)
[typographical] ~192-~192: Consider using a typographic close quote here.
Context: ...s name: vpc → workspace_key_prefix: "vpc" vars: name: "dev-use1-vpc...
(EN_QUOTES)
[typographical] ~232-~232: Consider using a typographic opening quote here.
Context: ...erits name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-use...
(EN_QUOTES)
[typographical] ~232-~232: Consider using a typographic close quote here.
Context: ...s name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-use1-vp...
(EN_QUOTES)
🪛 markdownlint-cli2 (0.18.1)
docs/prd/workspace-key-prefixes.md
5-5: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
⏰ 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
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (3)
website/docs/components/terraform/workspaces.mdx (1)
234-247: Fix punctuation in the tip section.Static analysis and a previous review comment both flagged missing punctuation in this tip section. The bullet points need ending punctuation for consistency.
Apply this diff:
:::tip When to Use Templates vs. Patterns - **Use `terraform_workspace_template`** when you need: - String manipulation (upper/lower case, substring, etc.) - Conditional logic - Access to Sprig/Gomplate functions - - Complex naming rules + - Complex naming rules. - **Use `terraform_workspace_pattern`** when you need: - Simple token replacement with context variables. - Straightforward naming patterns. - **Use `terraform_workspace`** when you need: - A fixed, static workspace name. :::docs/prd/metadata-inheritance.md (1)
3-5: Status formatting inconsistency.The status uses bold emphasis instead of a proper heading structure. This was flagged in a previous review.
docs/prd/workspace-key-prefixes.md (1)
3-5: Format issue: Use proper heading for Status section.Line 5 uses bold (
**Implemented**) instead of a Markdown heading. Per coding guidelines, use proper structure:## Status -**Implemented** +### Implemented
🧹 Nitpick comments (2)
internal/exec/stack_processor_utils.go (1)
1724-1746: Consider using a constant for the "type" field.Line 1736 hardcodes the string
"type", but line 1732 usescfg.InheritsSectionNamefor"inherits". For consistency with the codebase pattern (likecfg.ComponentSectionName,cfg.VarsSectionName), consider adding a constant for the type field name.If a constant like
cfg.TypeSectionNameorcfg.MetadataTypeSectionNameexists or can be added, apply this diff:baseMetadataForMerge := make(map[string]any) for k, v := range componentMetadata { // Skip 'inherits' - it's the meta-property defining inheritance, not inherited itself. if k == cfg.InheritsSectionName { continue } // Skip 'type' - component type is per-component, not inherited. - if k == "type" { + if k == cfg.TypeSectionName { continue } baseMetadataForMerge[k] = v }Otherwise, this is a minor style nit and the current implementation works correctly.
internal/exec/metadata_inheritance_test.go (1)
1-1380: Consider test file organization as it grows.The test file is comprehensive with excellent coverage (1380 lines). While it's focused on metadata inheritance as a single feature, consider splitting into multiple files if additional test scenarios are added in the future:
metadata_inheritance_core_test.go- basic inheritance, toggling, deep mergemetadata_inheritance_backends_test.go- backend-specific testsmetadata_inheritance_scenarios_test.go- versioned upgrades, release tracks, multi-levelThis is optional for now given the current cohesive organization.
📜 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 (30)
docs/prd/metadata-inheritance.md(1 hunks)docs/prd/workspace-key-prefixes.md(1 hunks)internal/exec/describe_stacks.go(2 hunks)internal/exec/metadata_inheritance_test.go(1 hunks)internal/exec/stack_processor_backend.go(4 hunks)internal/exec/stack_processor_backend_test.go(2 hunks)internal/exec/stack_processor_merge.go(3 hunks)internal/exec/stack_processor_process_stacks_helpers.go(1 hunks)internal/exec/stack_processor_process_stacks_helpers_inheritance.go(2 hunks)internal/exec/stack_processor_utils.go(1 hunks)pkg/datafetcher/schema/stacks/stack-config/1.0.json(2 hunks)pkg/schema/schema.go(2 hunks)tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden(1 hunks)website/blog/2025-11-21-metadata-inheritance.mdx(1 hunks)website/blog/2025-11-21-metadata-name-workspace-keys.mdx(1 hunks)website/docs/cli/commands/terraform/terraform-workspace.mdx(1 hunks)website/docs/cli/configuration/stacks/_category_.json(1 hunks)website/docs/cli/configuration/stacks/index.mdx(3 hunks)website/docs/cli/configuration/stacks/inherit.mdx(1 hunks)website/docs/components/terraform/backends.mdx(2 hunks)website/docs/components/terraform/workspaces.mdx(2 hunks)website/docs/design-patterns/version-management/continuous-version-deployment.mdx(2 hunks)website/docs/design-patterns/version-management/folder-based-versioning.mdx(1 hunks)website/docs/design-patterns/version-management/git-flow-branches-as-channels.mdx(3 hunks)website/docs/design-patterns/version-management/index.mdx(1 hunks)website/docs/design-patterns/version-management/release-tracks-channels.mdx(2 hunks)website/docs/design-patterns/version-management/strict-version-pinning.mdx(1 hunks)website/docs/howto/inheritance.mdx(3 hunks)website/docs/quick-start/advanced/configure-terraform-backend.mdx(1 hunks)website/docs/stacks/components/metadata.mdx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
website/**
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
website/**: Update website documentation in thewebsite/directory when adding new features, ensure consistency between CLI help text and website documentation, and follow the website's documentation structure and style
Keep website code in thewebsite/directory, follow the existing website architecture and style, and test website changes locally before committing
Keep CLI documentation and website documentation in sync and document new features on the website with examples and use cases
Files:
website/docs/quick-start/advanced/configure-terraform-backend.mdxwebsite/blog/2025-11-21-metadata-inheritance.mdxwebsite/docs/components/terraform/workspaces.mdxwebsite/docs/howto/inheritance.mdxwebsite/blog/2025-11-21-metadata-name-workspace-keys.mdxwebsite/docs/design-patterns/version-management/strict-version-pinning.mdxwebsite/docs/design-patterns/version-management/git-flow-branches-as-channels.mdxwebsite/docs/cli/configuration/stacks/index.mdxwebsite/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/stacks/components/metadata.mdxwebsite/docs/design-patterns/version-management/folder-based-versioning.mdxwebsite/docs/design-patterns/version-management/index.mdxwebsite/docs/design-patterns/version-management/release-tracks-channels.mdxwebsite/docs/design-patterns/version-management/continuous-version-deployment.mdxwebsite/docs/components/terraform/backends.mdxwebsite/docs/cli/configuration/stacks/_category_.jsonwebsite/docs/cli/configuration/stacks/inherit.mdx
website/blog/*.mdx
📄 CodeRabbit inference engine (CLAUDE.md)
Blog posts require YAML front matter with slug, title, authors, and tags. Use
<!--truncate-->after intro. ONLY use existing tags fromwebsite/blog/*.mdx- check before writing. Author field must be GitHub username, added towebsite/blog/authors.yml. Filename format:YYYY-MM-DD-feature-name.mdx. PRs labeledminor/majorMUST include blog post
Files:
website/blog/2025-11-21-metadata-inheritance.mdxwebsite/blog/2025-11-21-metadata-name-workspace-keys.mdx
docs/prd/*.md
📄 CodeRabbit inference engine (CLAUDE.md)
Use kebab-case for PRD filenames:
command-registry-pattern.md,error-handling-strategy.md,testing-strategy.md. All PRDs indocs/prd/
Files:
docs/prd/metadata-inheritance.mddocs/prd/workspace-key-prefixes.md
**/*.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)
Import organization: three groups separated by blank lines, sorted alphabetically: 1) Go stdlib, 2) 3rd-party (NOT cloudposse/atmos), 3) Atmos packages. Maintain aliases:cfg,log,u,errUtils
Adddefer perf.Track(atmosConfig, "pkg.FuncName")()+ blank line to all public functions. Usenilif no atmosConfig param
Keep files small and focused (<600 lines). One cmd/impl per file. Co-locate tests. Never use//revive:disable:file-length-limit
Use sentinel errors fromerrors/errors.gowith ErrorBuilder for all user-facing errors. Useerrors.Is()for checking errors, never string comparison.WithCause()preserves underlying error messages,WithExplanation()adds context,WithHint()provides guidance,WithContext()adds key-value pairs
Usecontext.Contextas first parameter for: cancellation signals (prop...
Files:
internal/exec/stack_processor_merge.gointernal/exec/stack_processor_backend_test.gointernal/exec/describe_stacks.gointernal/exec/stack_processor_process_stacks_helpers.gointernal/exec/stack_processor_process_stacks_helpers_inheritance.gopkg/schema/schema.gointernal/exec/stack_processor_utils.gointernal/exec/stack_processor_backend.gointernal/exec/metadata_inheritance_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 fixtures
**/*_test.go: Useassert.ErrorIs(t, err, ErrSentinel)for checking our own errors and stdlib errors. Only use string matching for third-party errors
NEVER useassert.Contains(err.Error(), ...)for error checking. ALWAYS useassert.ErrorIs()instead. NEVER use string comparison:err.Error() == "..."orstrings.Contains(err.Error(), ...)
Test behavior, not implementation. Never test stub functions - implement or remove. Avoid tautological tests. Make code testable using dependency injection to avoidos.Exit,CheckErrorPrintAndExit, external systems. Remove always-skipped tests - fix or delete. Table-driven tests must have real scenarios
Usego.uber.org/mock/mockgenwith//go:generatedirectives for mock generation. Never create manual mocks. Pattern://go:generate go run go.uber.org/mock/mockgen@latest -source=filename.go -destination=mock_filename_test.go
Use table-driven tests for comprehensive coverage. Tests must call actual production code, never duplicate logic. Target >80% test coverage (enforced by CodeCov)
Files:
internal/exec/stack_processor_backend_test.gointernal/exec/metadata_inheritance_test.go
website/docs/cli/commands/**/*.mdx
📄 CodeRabbit inference engine (CLAUDE.md)
All CLI commands need Docusaurus documentation using
<dl>for arguments/flags. Follow Docusaurus conventions: frontmatter (slug, title, etc.), purpose note, screengrab, usage/examples/arguments/flags sections. File location:website/docs/cli/commands/<command>/<subcommand>.mdx. Always build after changes:cd website && npm run build
Files:
website/docs/cli/commands/terraform/terraform-workspace.mdx
pkg/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
pkg/**/*.go: Business logic packages must follow the Service-Oriented Architecture pattern with: one Service struct per domain, Provider interfaces for classes of problems, default implementations, mock implementations, and dependency injection for testability
Use interface-driven design: define interfaces for all major functionality, use dependency injection for testability, generate mocks withgo.uber.org/mock/mockgenwith//go:generatedirectives, avoid integration tests by mocking external dependencies
Create focused purpose-built packages inpkg/for new functionality, each with clear responsibility. DO NOT add new functions topkg/utils/orinternal/exec/. Each package should have focused business logic with tests
Implement registry pattern for extensibility and plugin-like architecture. Define interfaces for provider implementations, register implementations in registry, generate mocks with mockgen. Examples: Command Registry incmd/internal/registry.go, Store Registry inpkg/store/registry.go
Files:
pkg/schema/schema.go
🧠 Learnings (35)
📚 Learning: 2024-11-02T15:35:09.958Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 759
File: internal/exec/terraform.go:366-368
Timestamp: 2024-11-02T15:35:09.958Z
Learning: In `internal/exec/terraform.go`, the workspace cleaning code under both the general execution path and within the `case "init":` block is intentionally duplicated because the code execution paths are different. The `.terraform/environment` file should be deleted before executing `terraform init` in both scenarios to ensure a clean state.
Applied to files:
website/docs/quick-start/advanced/configure-terraform-backend.mdxwebsite/docs/components/terraform/workspaces.mdxwebsite/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/design-patterns/version-management/folder-based-versioning.mdxwebsite/docs/components/terraform/backends.mdxinternal/exec/metadata_inheritance_test.go
📚 Learning: 2025-04-25T20:54:19.701Z
Learnt from: mcalhoun
Repo: cloudposse/atmos PR: 963
File: website/docs/core-concepts/projects/configuration/stores.mdx:286-286
Timestamp: 2025-04-25T20:54:19.701Z
Learning: For the AWS SSM Parameter Store implementation in Atmos, support for `read_role_arn` and `write_role_arn` options is essential to enable cross-account access, allowing users to run operations like `terraform plan` in multiple accounts while accessing values across keystores. Azure Key Vault would need similar capabilities for cross-tenant/subscription authentication.
Applied to files:
website/docs/quick-start/advanced/configure-terraform-backend.mdxwebsite/docs/components/terraform/backends.mdx
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to website/blog/*.mdx : Blog posts require YAML front matter with slug, title, authors, and tags. Use `<!--truncate-->` after intro. ONLY use existing tags from `website/blog/*.mdx` - check before writing. Author field must be GitHub username, added to `website/blog/authors.yml`. Filename format: `YYYY-MM-DD-feature-name.mdx`. PRs labeled `minor`/`major` MUST include blog post
Applied to files:
website/blog/2025-11-21-metadata-inheritance.mdx
📚 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:
website/blog/2025-11-21-metadata-inheritance.mdxdocs/prd/metadata-inheritance.mdwebsite/docs/howto/inheritance.mdxinternal/exec/describe_stacks.gowebsite/docs/cli/configuration/stacks/index.mdxwebsite/docs/components/terraform/backends.mdxwebsite/docs/cli/configuration/stacks/inherit.mdx
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to tests/**/*.yaml : NEVER modify `tests/test-cases/` or `tests/testdata/` unless explicitly instructed. Golden snapshots are sensitive to minor changes. Use fixtures in `tests/test-cases/`: `atmos.yaml`, `stacks/`, `components/`
Applied to files:
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.goldenwebsite/docs/design-patterns/version-management/strict-version-pinning.mdx
📚 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_config.stdout.goldenwebsite/docs/components/terraform/workspaces.mdx
📚 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/stack_processor_merge.gointernal/exec/stack_processor_process_stacks_helpers.gointernal/exec/stack_processor_process_stacks_helpers_inheritance.gointernal/exec/stack_processor_utils.gointernal/exec/stack_processor_backend.gointernal/exec/metadata_inheritance_test.go
📚 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/stack_processor_merge.gointernal/exec/stack_processor_process_stacks_helpers.gointernal/exec/stack_processor_utils.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_processor_backend_test.gointernal/exec/metadata_inheritance_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_processor_backend_test.gointernal/exec/metadata_inheritance_test.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*_test.go : Test behavior, not implementation. Never test stub functions - implement or remove. Avoid tautological tests. Make code testable using dependency injection to avoid `os.Exit`, `CheckErrorPrintAndExit`, external systems. Remove always-skipped tests - fix or delete. Table-driven tests must have real scenarios
Applied to files:
internal/exec/stack_processor_backend_test.gointernal/exec/metadata_inheritance_test.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to docs/prd/*.md : Use kebab-case for PRD filenames: `command-registry-pattern.md`, `error-handling-strategy.md`, `testing-strategy.md`. All PRDs in `docs/prd/`
Applied to files:
docs/prd/workspace-key-prefixes.md
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
internal/exec/describe_stacks.gointernal/exec/stack_processor_backend.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:
internal/exec/describe_stacks.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/describe_stacks.gointernal/exec/stack_processor_utils.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*.go : Import organization: three groups separated by blank lines, sorted alphabetically: 1) Go stdlib, 2) 3rd-party (NOT cloudposse/atmos), 3) Atmos packages. Maintain aliases: `cfg`, `log`, `u`, `errUtils`
Applied to files:
internal/exec/describe_stacks.go
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.
Applied to files:
internal/exec/describe_stacks.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/describe_stacks.go
📚 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:
internal/exec/describe_stacks.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*.go : Add `defer perf.Track(atmosConfig, "pkg.FuncName")()` + blank line to all public functions. Use `nil` if no atmosConfig param
Applied to files:
internal/exec/describe_stacks.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/describe_stacks.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/describe_stacks.gointernal/exec/stack_processor_backend.go
📚 Learning: 2025-09-27T20:50:20.564Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1533
File: pkg/config/load.go:585-637
Timestamp: 2025-09-27T20:50:20.564Z
Learning: In the cloudposse/atmos repository, command merging prioritizes precedence over display ordering. Help commands are displayed lexicographically regardless of internal array order, so the mergeCommandArrays function focuses on ensuring the correct precedence chain (top-level file wins) rather than maintaining specific display order.
Applied to files:
internal/exec/describe_stacks.go
📚 Learning: 2025-11-09T19:06:58.470Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1752
File: pkg/profile/list/formatter_table.go:27-29
Timestamp: 2025-11-09T19:06:58.470Z
Learning: In the cloudposse/atmos repository, performance tracking with `defer perf.Track()` is enforced on all functions via linting, including high-frequency utility functions, formatters, and renderers. This is a repository-wide policy to maintain consistency and avoid making case-by-case judgment calls about which functions should have profiling.
Applied to files:
internal/exec/describe_stacks.go
📚 Learning: 2025-10-16T05:26:31.892Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1639
File: pkg/merge/merge.go:392-430
Timestamp: 2025-10-16T05:26:31.892Z
Learning: In Atmos merge operations (pkg/merge/merge.go), context.Positions is a PositionMap (map[string]*schema.Position) keyed by JSONPath strings, not a slice indexed by input array position. Position lookups are path-based, making them independent of input array reorganization or filtering. This design allows filtering empty inputs without affecting provenance tracking correctness.
Applied to files:
internal/exec/describe_stacks.go
📚 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:
website/docs/cli/configuration/stacks/index.mdxwebsite/docs/components/terraform/backends.mdx
📚 Learning: 2025-08-29T20:57:35.423Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1433
File: cmd/theme_list.go:33-36
Timestamp: 2025-08-29T20:57:35.423Z
Learning: In the Atmos codebase, avoid using viper.SetEnvPrefix("ATMOS") with viper.AutomaticEnv() because canonical environment variable names are not exclusive to Atmos and could cause conflicts. Instead, use selective environment variable binding through the setEnv function in pkg/config/load.go with bindEnv(v, "config.key", "ENV_VAR_NAME") for specific environment variables.
Applied to files:
website/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/components/terraform/backends.mdx
📚 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:
website/docs/cli/commands/terraform/terraform-workspace.mdxwebsite/docs/design-patterns/version-management/release-tracks-channels.mdxwebsite/docs/components/terraform/backends.mdx
📚 Learning: 2024-12-08T14:26:16.972Z
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 828
File: pkg/schema/schema.go:98-100
Timestamp: 2024-12-08T14:26:16.972Z
Learning: The `ListConfig` columns array in the `Components` struct can be empty.
Applied to files:
internal/exec/stack_processor_process_stacks_helpers.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:
internal/exec/stack_processor_utils.go
📚 Learning: 2025-12-04T02:40:41.742Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1588
File: website/docs/learn/mindset.mdx:36-39
Timestamp: 2025-12-04T02:40:41.742Z
Learning: In Docusaurus documentation, when a sidebar category has a `link` configuration like `link: {type: "doc", id: "quick-start/simple/simple"}`, the category URL path (e.g., `/quick-start/simple`) correctly resolves to the linked document. Links should use the shorter category path, not the full document path, as this is the proper Docusaurus routing pattern.
Applied to files:
website/docs/cli/configuration/stacks/_category_.json
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to website/docs/cli/commands/**/*.mdx : All CLI commands need Docusaurus documentation using `<dl>` for arguments/flags. Follow Docusaurus conventions: frontmatter (slug, title, etc.), purpose note, screengrab, usage/examples/arguments/flags sections. File location: `website/docs/cli/commands/<command>/<subcommand>.mdx`. Always build after changes: `cd website && npm run build`
Applied to files:
website/docs/cli/configuration/stacks/_category_.json
📚 Learning: 2024-12-03T04:01:16.446Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx:0-0
Timestamp: 2024-12-03T04:01:16.446Z
Learning: In the `terraform.output.mdx` documentation file (`website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx`), the cache invalidation and cache scope behavior for the `!terraform.output` function are already described.
Applied to files:
website/docs/cli/configuration/stacks/inherit.mdx
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*.go : New configs support Go templating with `FuncMap()` from `internal/exec/template_funcs.go`. Implement template functions in `internal/exec/template_funcs.go`, register them, add tests, and update documentation
Applied to files:
internal/exec/metadata_inheritance_test.go
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to **/*.go : Before implementing new functionality, search `internal/exec/` and `pkg/` for existing code. Extend, don't duplicate
Applied to files:
internal/exec/metadata_inheritance_test.go
🧬 Code graph analysis (1)
internal/exec/metadata_inheritance_test.go (2)
pkg/schema/schema.go (2)
Stacks(440-447)StacksInherit(450-455)pkg/config/const.go (1)
InheritsSectionName(102-102)
🪛 LanguageTool
docs/prd/metadata-inheritance.md
[style] ~26-~26: Since ownership is already implied, this phrasing may be redundant.
Context: ...d entirely - each component must define its own metadata. ### Problems This Causes ##...
(PRP_OWN)
[typographical] ~121-~121: To join two clauses or introduce examples, consider using an em dash.
Context: ...circular dependencies. - metadata.type - Component type (abstract, real, or c...
(DASH_RULE)
[style] ~121-~121: Since ownership is already implied, this phrasing may be redundant.
Context: ...ited. Each component explicitly defines its own type. ### New Field: metadata.name ...
(PRP_OWN)
website/docs/components/terraform/workspaces.mdx
[typographical] ~229-~229: To join two clauses or introduce examples, consider using an em dash.
Context: ....terraform_workspace_template(highest) - Full Go template syntax 2.metadata.ter...
(DASH_RULE)
[typographical] ~232-~232: To join two clauses or introduce examples, consider using an em dash.
Context: ...to-generated from stack context (lowest) - Default behavior :::tip When to Use Tem...
(DASH_RULE)
[grammar] ~239-~239: Please add a punctuation mark at the end of paragraph.
Context: ...g/Gomplate functions - Complex naming rules - **Use terraform_workspace_pattern*...
(PUNCTUATION_PARAGRAPH_END)
[style] ~241-~241: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ...terraform_workspace_pattern`** when you need: - Simple token replacement with cont...
(EN_REPEATEDWORDS_NEED)
[style] ~245-~245: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ... Use terraform_workspace when you need: - A fixed, static workspace name. ::...
(EN_REPEATEDWORDS_NEED)
[typographical] ~260-~260: In American English, use a period after an abbreviation.
Context: ...orm.tfstate ``` :::note Workspace Name vs Workspace Key Prefix These are two sepa...
(MISSING_PERIOD_AFTER_ABBREVIATION)
[typographical] ~317-~317: To join two clauses or introduce examples, consider using an em dash.
Context: ...](/stacks/components/component-metadata) - Configure terraform_workspace and `ter...
(DASH_RULE)
docs/prd/workspace-key-prefixes.md
[typographical] ~66-~66: Consider using a typographic opening quote here.
Context: ...e metadata-inheritance.md) - Represents "what this component IS" vs "where its co...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic close quote here.
Context: ...md) - Represents "what this component IS" vs "where its code lives" ### Updated ...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic opening quote here.
Context: ... Represents "what this component IS" vs "where its code lives" ### Updated Calcu...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic close quote here.
Context: ...s component IS" vs "where its code lives" ### Updated Calculation Logic **New p...
(EN_QUOTES)
[style] ~246-~246: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...endDefaults()similarly forprefix. Update setAzureBackendKey()similarly fork...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
website/docs/howto/inheritance.mdx
[typographical] ~65-~65: To join two clauses or introduce examples, consider using an em dash.
Context: ... exceptions: 1. metadata.inherits - Not inherited because it defines the inh...
(DASH_RULE)
website/docs/design-patterns/version-management/strict-version-pinning.mdx
[typographical] ~128-~128: Consider using a typographic opening quote here.
Context: ...erits name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-vpc...
(EN_QUOTES)
[typographical] ~128-~128: Consider using a typographic close quote here.
Context: ...s name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-vpc" ...
(EN_QUOTES)
[typographical] ~130-~130: Consider using a typographic opening quote here.
Context: ...prefix: "vpc" vars: name: "prod-vpc" cidr_block: "10.0.0.0/...
(EN_QUOTES)
[typographical] ~130-~130: Consider using a typographic close quote here.
Context: ...vpc" vars: name: "prod-vpc" cidr_block: "10.0.0.0/16" ``` <...
(EN_QUOTES)
[typographical] ~131-~131: Consider using a typographic opening quote here.
Context: ... name: "prod-vpc" cidr_block: "10.0.0.0/16" ``` ### 2. Maintai...
(EN_QUOTES)
[typographical] ~131-~131: Consider using a typographic close quote here.
Context: ...od-vpc" cidr_block: "10.0.0.0/16" ``` ### 2. Maintain Stable Wor...
(EN_QUOTES)
website/docs/design-patterns/version-management/git-flow-branches-as-channels.mdx
[typographical] ~192-~192: Consider using a typographic opening quote here.
Context: ...erits name: vpc → workspace_key_prefix: "vpc" vars: name: "dev-use1...
(EN_QUOTES)
[typographical] ~192-~192: Consider using a typographic close quote here.
Context: ...s name: vpc → workspace_key_prefix: "vpc" vars: name: "dev-use1-vpc...
(EN_QUOTES)
[typographical] ~232-~232: Consider using a typographic opening quote here.
Context: ...erits name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-use...
(EN_QUOTES)
[typographical] ~232-~232: Consider using a typographic close quote here.
Context: ...s name: vpc → workspace_key_prefix: "vpc" vars: name: "prod-use1-vp...
(EN_QUOTES)
🪛 markdownlint-cli2 (0.18.1)
docs/prd/workspace-key-prefixes.md
5-5: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
⏰ 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 (51)
website/blog/2025-11-21-metadata-name-workspace-keys.mdx (1)
1-10: Blog post structure and YAML front matter look solid.The file follows the required format: proper YAML front matter, intro, truncate marker, and clear content sections (problem, solution, convention). The examples and explanation align well with the PR objectives. Author registration and tags are correctly configured.
tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden (1)
45-46: Snapshot correctly reflects the new inherit field.The addition of
"inherit": {}to the stacks configuration aligns with the PR objectives to expose metadata inheritance settings viaatmos describe config. The empty object default is appropriate.website/docs/quick-start/advanced/configure-terraform-backend.mdx (1)
139-139: LGTM - Concrete example improves clarity.The change from a placeholder to a concrete value with an inline comment makes the example more immediately useful while still communicating the flexibility of the field.
website/docs/howto/inheritance.mdx (2)
49-78: Excellent addition - clear reference for inheritance behavior.The table format and explicit exception rules make inheritance semantics immediately clear. The configuration example for disabling metadata inheritance provides a good escape hatch for compatibility.
Note: Static analysis flagged line 65 for em dash usage instead of hyphen. This is a minor typographical preference - current formatting is fine.
87-87: Consistent narrative updates.The additions of "metadata" to inheritance descriptions maintain consistency with the new "What Gets Inherited" section and accurately reflect the new behavior.
Also applies to: 257-258, 399-400
website/docs/design-patterns/version-management/release-tracks-channels.mdx (3)
112-127: Good demonstration of base component pattern.The catalog-based base components with
metadata.nameclearly illustrate the stable identity concept. The convention comment is helpful guidance.
129-154: Clear demonstration of inheritance-driven naming.The updates show how
metadata.nameinheritance eliminates the need for explicitworkspace_key_prefixconfiguration. The inline comments effectively explain the implicit behavior.
218-260: Consistent pattern across organizational approaches.The Track-First example maintains consistency with the Component-Centric example, effectively demonstrating that the inheritance pattern works regardless of directory organization.
website/docs/cli/configuration/stacks/_category_.json (1)
1-10: Standard Docusaurus category configuration.The category definition follows Docusaurus conventions and properly organizes the stacks configuration documentation.
internal/exec/stack_processor_process_stacks_helpers.go (1)
65-65: Clean struct extension for metadata inheritance.The new
BaseComponentMetadatafield follows existing conventions and logically extends the result structure to support metadata inheritance flows.website/docs/cli/configuration/stacks/index.mdx (3)
34-35: Clear documentation of inheritance configuration.The configuration reference and examples effectively introduce the
inheritoption. The reference to detailed documentation provides a good path for users wanting more context.Also applies to: 112-124
269-273: Good organizational structure for configuration options.The new section provides a clear place for configuration sub-topics and maintains consistency with the "Related Commands" section structure.
282-282: Helpful cross-reference addition.The inheritance guide link in Related Commands provides good discoverability for users exploring inheritance features.
website/docs/cli/configuration/stacks/inherit.mdx (4)
1-58: Comprehensive configuration documentation.The intro clearly establishes the feature and defaults. The Configuration Reference thoroughly documents the
metadatafield, including environment variables, defaults, and the two inheritance exceptions. Examples cover both enabling and disabling scenarios.
62-102: Strong practical example for version management.The version management use case clearly demonstrates the "change once, inherit everywhere" benefit. The example effectively shows how metadata inheritance simplifies component upgrades.
104-122: Clear governance use case.The governance example demonstrates how metadata inheritance supports policy enforcement, complementing the version management use case.
124-143: Good compatibility guidance and cross-references.The backwards compatibility section provides a clear path for users who encounter issues. Related links effectively guide users to deeper documentation on inheritance and related concepts.
website/docs/stacks/components/metadata.mdx (1)
57-74: Excellent explanation of metadata.name purpose.The documentation clearly articulates the stable identity concept and its importance for version management. The "Why this matters" section effectively explains the state file stability problem that
metadata.namesolves.website/docs/components/terraform/workspaces.mdx (1)
249-313: Excellent documentation of workspace concepts.This section clearly distinguishes workspace name from workspace key prefix and explains how
metadata.nameprovides stable identity for state paths. The hierarchy diagram and priority order make the concepts easy to understand.internal/exec/stack_processor_process_stacks_helpers_inheritance.go (1)
23-23: BaseComponentMetadata handling looks good.The initialization and propagation of
BaseComponentMetadatafollows the same pattern as other base component fields (BaseComponentVars,BaseComponentSettings, etc.). Consistent and correct.Also applies to: 199-199
website/docs/design-patterns/version-management/git-flow-branches-as-channels.mdx (1)
165-239: Catalog-based inheritance examples are clear and well-structured.The updated examples effectively demonstrate the new metadata inheritance pattern. Using
metadata.namefor stable identity in the catalog base component, then overridingcomponentper environment to point to channel-specific paths, aligns perfectly with the PR's objectives.website/docs/design-patterns/version-management/index.mdx (1)
231-263: Best practices clearly guide users to the recommended approach.The updated guidance effectively demonstrates the stable
metadata.namepattern vs. error-prone manual workspace key management. The new "Test Promotion Paths" and "Monitor Divergence" practices add valuable operational guidance.pkg/datafetcher/schema/stacks/stack-config/1.0.json (1)
506-509: Schema updates are properly typed and documented.The new
metadata.nameproperty is correctly typed as string with a clear description of its purpose. The updatedmetadata.customdescription accurately reflects the new inheritance behavior.Also applies to: 550-550
internal/exec/stack_processor_backend_test.go (1)
17-17: Comprehensive test coverage for metadata.name priority.The test cases thoroughly cover the workspace key prefix priority logic:
- metadata.name > base component > component name
- Slash normalization
- Explicit prefix precedence
- Fallback behavior
- Multiple backend types (S3, GCS, Azure)
Follows table-driven test patterns and tests behavior rather than implementation. Excellent work.
Based on learnings, comprehensive unit tests targeting >80% code coverage.
Also applies to: 235-347, 354-358, 365-365
website/blog/2025-11-21-metadata-inheritance.mdx (1)
1-91: Blog post meets all requirements.The YAML front matter is complete with slug, title, author (osterman, confirmed in authors.yml), and tags. The filename follows the required
YYYY-MM-DD-feature-name.mdxformat,<!--truncate-->is properly placed, and the content clearly explains the problem, solution, and configuration. All tags are either existing or appropriately scoped to the feature. No changes needed.pkg/schema/schema.go (2)
440-464: Well-structured inheritance configuration.The
StacksInherittype with pointer-basedMetadatafield correctly enables tri-state logic (nil/true/false). TheIsMetadataInheritanceEnabled()method defaults totruewhen unset, which aligns with the PR's goal of enabling inheritance by default while allowing opt-out.
843-843: Consistent pattern for base component metadata.The new
BaseComponentMetadatafield follows the established pattern used by other base component fields (BaseComponentVars,BaseComponentSettings, etc.). Good consistency.internal/exec/stack_processor_merge.go (2)
168-184: Clean metadata merge implementation.The conditional logic correctly guards the merge operation:
- Only merges when inheritance is enabled
- Only merges when base metadata exists
- Component metadata takes precedence (correct override semantics)
The fallback to
result.ComponentMetadatawhen no merge is needed maintains backward compatibility.
194-206: Proper propagation of merged metadata.The
finalComponentMetadatais correctly used in both the component map output and passed through to backend processing viaterraformBackendConfig. This ensures consistent metadata throughout the pipeline.website/docs/cli/commands/terraform/terraform-workspace.mdx (2)
55-84: Clear documentation of the recommended pattern.The example demonstrates the metadata.name inheritance flow well. The comment about
workspace_key_prefixauto-generating from inheritedmetadata.namehelps users understand the behavior without reading implementation details.One small note: Line 77 shows
inherits: [vpc/defaults]but the abstract component is defined asvpc/defaultson line 63. This is consistent and correct.
85-98: Good separation of basic vs advanced use cases.Moving Go template-based dynamic workspace keys to an "Advanced" section guides users toward the simpler
metadata.nameapproach first. The note that this is "configured at the stack level, not inatmos.yaml" prevents common misconfiguration.docs/prd/metadata-inheritance.md (3)
349-364: Implementation section looks good.The stack processing changes are well-documented. Note that a previous review flagged Line 354 for missing terminal punctuation - that appears to have been addressed based on the past comment marker.
107-122: Clear inheritance behavior table.The table effectively communicates which fields inherit and which don't. The explicit exclusions for
metadata.inheritsandmetadata.typeare well-reasoned - inheritingtype: abstractwould cause derived components to become abstract (breaking change), and inheritinginheritswould create confusing circular references.
162-167: Priority order for workspace_key_prefix is clear.The documented precedence (explicit backend > metadata.name > metadata.component > Atmos component name) provides predictable behavior and matches the implementation in stack_processor_backend.go.
internal/exec/describe_stacks.go (4)
14-14: Correct import alias.The merge package import uses alias
mwhich follows the established pattern in this codebase.
224-262: Metadata inheritance processing for describe stacks.The implementation correctly:
- Guards on
IsMetadataInheritanceEnabled()and presence of inherits list- Initializes all
BaseComponentConfigfields (avoiding nil map issues)- Processes inheritance in order (left-to-right merge semantics)
- Uses
checkBaseComponentExists=falseto be lenient during describe operationsOne consideration: The
baseComponentsslice is passed but appears unused after the loop. It's populated byProcessBaseComponentConfigfor tracking the inheritance chain, which is fine.
264-287: Merge and precedence logic is sound.The merge correctly prioritizes component metadata over base metadata. The deletion of
terraform_workspace_patternandterraform_workspace_templatewhen an explicitterraform_workspaceexists ensures the explicit value wins over inherited patterns. This prevents confusing behavior where a pattern might override an explicit workspace.
504-720: Helmfile components don't get metadata inheritance processing.Metadata inheritance is only applied to Terraform components (lines 224-287). Helmfile components (lines 504-720) skip this processing. This appears intentional since workspace handling is Terraform-specific, but worth confirming if metadata inheritance for other fields (like
locked,enabled) should apply to Helmfile too.Is metadata inheritance intentionally limited to Terraform components? For Helmfile components, fields like
metadata.lockedandmetadata.enabledwon't be inherited even whenstacks.inherit.metadata: true. If this is intentional (Terraform-only feature), consider documenting this limitation.website/docs/components/terraform/backends.mdx (1)
185-204: Excellent documentation of the new workspace_key_prefix priority logic.The new section clearly explains the auto-generation priority and the role of
metadata.nameas a stable logical identity. The tip about versioned components directly addresses the primary use case this feature enables.website/docs/design-patterns/version-management/strict-version-pinning.mdx (1)
105-156: Clear demonstration of catalog-based inheritance with metadata.name.The updated examples effectively show how
metadata.nameprovides a stable logical identity whilemetadata.componentpoints to versioned paths. The "Critical Configuration" callout appropriately emphasizes the importance of this pattern for state stability.website/docs/design-patterns/version-management/folder-based-versioning.mdx (1)
174-228: Comprehensive rewrite of workspace key management guidance.The new section effectively communicates the priority order for workspace_key_prefix calculation. The table format, the "Why This Matters" narrative, and the explicit override alternative provide clear guidance for different use cases.
website/docs/design-patterns/version-management/continuous-version-deployment.mdx (1)
535-611: Effective integration of catalog-based inheritance into continuous deployment pattern.The updated examples demonstrate how abstract catalog bases with
metadata.nameenable stable workspace keys while environments reference different component versions. The inline comments showing derived workspace_key_prefix help readers understand the behavior.internal/exec/stack_processor_backend.go (4)
25-25: Clean addition of componentMetadata to backend configuration.Adding
componentMetadatato theterraformBackendConfigstruct enables the backend default functions to access metadata fields for workspace key generation.
84-96: Consistent implementation of metadata.name priority for S3 backend.The updated
setS3BackendDefaultscorrectly implements the documented priority order: explicit config → metadata.name → metadata.component → Atmos component name. The comment clearly documents this behavior, and the slash-to-dash normalization is applied appropriately.
99-112: GCS backend follows same priority pattern as S3.The
setGCSBackendDefaultsimplementation mirrors the S3 approach for theprefixfield, maintaining consistency across backend types.
114-163: Azure backend key generation properly integrated with metadata.name.The
setAzureBackendKeyfunction correctly uses metadata.name in the priority chain for determining the key prefix component. The safe type assertions with ok checks provide defensive coding.internal/exec/metadata_inheritance_test.go (5)
13-204: Comprehensive test coverage for metadata.name inheritance.The
TestMetadataNameInheritancetest thoroughly validates the core feature with multiple scenarios: basic inheritance, versioned components, overrides, inheritance toggling, slash normalization, empty names, multiple instances, and standalone components. The test properly exercises the complete code path throughprocessTerraformBackend.
206-336: Excellent validation that metadata.type is never inherited.
TestMetadataTypeNotInheritedcorrectly validates thattype: abstractand other type values are excluded from inheritance, which prevents abstract components from becoming deployable. The test also verifies that other metadata fields are still inherited when enabled.
456-497: Deep merge semantics properly tested.The
TestMetadataDeepMergetest validates that nested metadata maps are merged correctly, preserving base values while allowing component overrides.
499-585: Critical test: versioned component upgrades maintain stable workspace keys.
TestVersionedComponentUpgradevalidates the primary use case - that upgrading from vpc/v2 to vpc/v3 to vpc/v4 maintains a stableworkspace_key_prefixof "vpc" through inheritedmetadata.name. This test proves the feature solves the state migration problem.
940-1007: Backend-specific tests validate consistent behavior across S3, GCS, and Azure.The GCS and Azure backend tests confirm that the metadata.name priority logic works consistently across all backend types, with proper slash-to-dash normalization and fallback behavior.
Also applies to: 1009-1077
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
website/docs/components/terraform/workspaces.mdx (1)
195-247: Go Templates section is well-structured and comprehensive.The new section effectively introduces
terraform_workspace_template, provides a clear example with theue2-dev-ALPHAworkspace, and establishes priority order transparently. This directly supports the PR's metadata inheritance and workspace naming objectives. The three-part tip ("When to Use Templates vs. Patterns") provides practical guidance on choosing between templates, patterns, and static values.A few minor polish suggestions:
Line 260 needs a period after "vs" per American English style: change "Workspace Name vs Workspace Key Prefix" to "Workspace Name vs. Workspace Key Prefix"
Lines 235, 241, 245 repeat "when you need" three times. Consider varying the introductory phrase for better readability, e.g., "Use
terraform_workspace_templatefor:" or "Useterraform_workspace_patternif you require:"Lines 229, 232 currently use hyphens; consider em dashes for better stylistic consistency with technical documentation:
- Change
(highest) -to(highest) —- Change
(lowest) -to(lowest) —Apply this diff to address the punctuation and styling suggestions:
-:::note Workspace Name vs Workspace Key Prefix +:::note Workspace Name vs. Workspace Key Prefix-1. `metadata.terraform_workspace_template` (highest) - Full Go template syntax -2. `metadata.terraform_workspace_pattern` - Limited token replacement -3. `metadata.terraform_workspace` - Static string -4. Auto-generated from stack context (lowest) - Default behavior +1. `metadata.terraform_workspace_template` (highest) — Full Go template syntax +2. `metadata.terraform_workspace_pattern` — Limited token replacement +3. `metadata.terraform_workspace` — Static string +4. Auto-generated from stack context (lowest) — Default behavior-:::tip When to Use Templates vs. Patterns -- **Use `terraform_workspace_template`** when you need: +:::tip When to Use Templates vs. Patterns +- **Use `terraform_workspace_template`** for: - String manipulation (upper/lower case, substring, etc.). - Conditional logic. - Access to Sprig/Gomplate functions. - Complex naming rules. -- **Use `terraform_workspace_pattern`** when you need: +- **Use `terraform_workspace_pattern`** if you require: - Simple token replacement with context variables. - Straightforward naming patterns. -- **Use `terraform_workspace`** when you need: +- **Use `terraform_workspace`** for: - A fixed, static workspace name. :::
📜 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 (5)
docs/prd/metadata-inheritance.md(1 hunks)docs/prd/workspace-key-prefixes.md(1 hunks)website/blog/2025-11-21-metadata-inheritance.mdx(1 hunks)website/docs/components/terraform/workspaces.mdx(2 hunks)website/docs/stacks/components/metadata.mdx(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- website/blog/2025-11-21-metadata-inheritance.mdx
🧰 Additional context used
📓 Path-based instructions (2)
docs/prd/*.md
📄 CodeRabbit inference engine (CLAUDE.md)
Use kebab-case for PRD filenames:
command-registry-pattern.md,error-handling-strategy.md,testing-strategy.md. All PRDs indocs/prd/
Files:
docs/prd/workspace-key-prefixes.mddocs/prd/metadata-inheritance.md
website/**
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
website/**: Update website documentation in thewebsite/directory when adding new features, ensure consistency between CLI help text and website documentation, and follow the website's documentation structure and style
Keep website code in thewebsite/directory, follow the existing website architecture and style, and test website changes locally before committing
Keep CLI documentation and website documentation in sync and document new features on the website with examples and use cases
Files:
website/docs/components/terraform/workspaces.mdxwebsite/docs/stacks/components/metadata.mdx
🧠 Learnings (4)
📚 Learning: 2025-12-06T19:24:49.329Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-06T19:24:49.329Z
Learning: Applies to docs/prd/*.md : Use kebab-case for PRD filenames: `command-registry-pattern.md`, `error-handling-strategy.md`, `testing-strategy.md`. All PRDs in `docs/prd/`
Applied to files:
docs/prd/workspace-key-prefixes.md
📚 Learning: 2024-11-02T15:35:09.958Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 759
File: internal/exec/terraform.go:366-368
Timestamp: 2024-11-02T15:35:09.958Z
Learning: In `internal/exec/terraform.go`, the workspace cleaning code under both the general execution path and within the `case "init":` block is intentionally duplicated because the code execution paths are different. The `.terraform/environment` file should be deleted before executing `terraform init` in both scenarios to ensure a clean state.
Applied to files:
website/docs/components/terraform/workspaces.mdx
📚 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:
website/docs/components/terraform/workspaces.mdx
📚 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:
docs/prd/metadata-inheritance.md
🪛 LanguageTool
docs/prd/workspace-key-prefixes.md
[typographical] ~66-~66: Consider using a typographic opening quote here.
Context: ...e metadata-inheritance.md) - Represents "what this component IS" vs "where its co...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic close quote here.
Context: ...md) - Represents "what this component IS" vs "where its code lives" ### Updated ...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic opening quote here.
Context: ... Represents "what this component IS" vs "where its code lives" ### Updated Calcu...
(EN_QUOTES)
[typographical] ~66-~66: Consider using a typographic close quote here.
Context: ...s component IS" vs "where its code lives" ### Updated Calculation Logic **New p...
(EN_QUOTES)
[style] ~246-~246: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...endDefaults()similarly forprefix. Update setAzureBackendKey()similarly fork...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
website/docs/components/terraform/workspaces.mdx
[typographical] ~229-~229: To join two clauses or introduce examples, consider using an em dash.
Context: ....terraform_workspace_template(highest) - Full Go template syntax 2.metadata.ter...
(DASH_RULE)
[typographical] ~232-~232: To join two clauses or introduce examples, consider using an em dash.
Context: ...to-generated from stack context (lowest) - Default behavior :::tip When to Use Tem...
(DASH_RULE)
[style] ~235-~235: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ...erraform_workspace_template`** when you need: - String manipulation (upper/lower c...
(EN_REPEATEDWORDS_NEED)
[style] ~241-~241: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ...terraform_workspace_pattern`** when you need: - Simple token replacement with cont...
(EN_REPEATEDWORDS_NEED)
[style] ~245-~245: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ... Use terraform_workspace when you need: - A fixed, static workspace name. ::...
(EN_REPEATEDWORDS_NEED)
[typographical] ~260-~260: In American English, use a period after an abbreviation.
Context: ...orm.tfstate ``` :::note Workspace Name vs Workspace Key Prefix These are two sepa...
(MISSING_PERIOD_AFTER_ABBREVIATION)
[typographical] ~317-~317: To join two clauses or introduce examples, consider using an em dash.
Context: ...](/stacks/components/component-metadata) - Configure terraform_workspace and `ter...
(DASH_RULE)
docs/prd/metadata-inheritance.md
[style] ~26-~26: Since ownership is already implied, this phrasing may be redundant.
Context: ...d entirely - each component must define its own metadata. ### Problems This Causes ##...
(PRP_OWN)
[typographical] ~121-~121: To join two clauses or introduce examples, consider using an em dash.
Context: ...circular dependencies. - metadata.type - Component type (abstract, real, or c...
(DASH_RULE)
[style] ~121-~121: Since ownership is already implied, this phrasing may be redundant.
Context: ...ited. Each component explicitly defines its own type. ### New Field: metadata.name ...
(PRP_OWN)
⏰ 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). (2)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Summary
🔇 Additional comments (12)
website/docs/components/terraform/workspaces.mdx (4)
11-11: PillBox import is properly used.The import correctly supports the "Advanced" label at line 197, marking the Go templates section as advanced functionality. This aligns well with the feature's complexity.
281-289: Workspace key prefix priority is clearly documented.The four-level priority order (explicit config → metadata.name → metadata.component → component name) aligns with the PR's objectives and provides clear guidance on auto-generation behavior. This effectively communicates the workspace key prefix strategy introduced in the PR.
290-313: metadata.name section with versioning example is excellent.The "Using metadata.name for Stable State Paths" section provides a practical, real-world example showing how
metadata.namedecouples logical identity from physical component paths. The vpc/v2 → vpc/v3 upgrade scenario clearly demonstrates the value: state paths remain stable (vpc/{workspace}/terraform.tfstate) without migration overhead.The note referencing folder-based versioning design pattern provides good contextual linkage.
315-322: References section is updated appropriately.The addition of "Terraform Backends" reference (line 321) is well-placed and supports the workspace key prefix and backend configuration discussion. Verify that this link path is correct in the deployed documentation structure.
Can you confirm the reference link
/components/terraform/backendsresolves correctly in the website build? If the file is located elsewhere, the path may need adjustment.docs/prd/metadata-inheritance.md (1)
1-6: Previous review comments resolved.The Status section and Implementation section formatting issues from earlier reviews have been addressed. The document structure is sound.
website/docs/stacks/components/metadata.mdx (2)
57-75: Metadata.name documentation is clear and well-contextualized.The new section effectively explains the stable logical identity concept and its purpose for workspace key prefix generation. Examples clearly show versioning before/after scenarios. The connection to workspace key management and design patterns is helpful.
217-219: Custom inheritance behavior now correctly documented.Line 218 properly clarifies that
customis inherited whenstacks.inherit.metadatais enabled (default), addressing the previous gap between documentation and schema. The note about deep-merge for nested maps is also helpful.docs/prd/workspace-key-prefixes.md (5)
1-50: Problem statement effectively frames the state loss issue.The explanation of why versioned components create silent failures is clear and compelling. Use cases showing the workaround (explicit
workspace_key_prefix) establish context for whymetadata.nameis valuable.
68-111: Solution design is sound and backwards compatible.The priority order (explicit → metadata.name → metadata.component → Atmos component name) is well-defined. The explicit statement that this requires no configuration flag and doesn't break existing setups reduces implementation risk.
220-264: Implementation details are specific and implementable.The code signature changes are clear (adding
metadata map[string]anyparameter), and pseudocode in lines 82–100 accurately reflects the priority logic. Function updates for S3, GCS, and Azure backends are called out explicitly. Caller updates are noted.
312-372: Migration guide balances new-project simplicity with safe existing-project paths.Distinguishes between projects already using the
workspace_key_prefixworkaround (can simply addmetadata.name) and those with versioned state (requiring careful name matching or state migration). This guidance will help teams adopt the feature confidently.
297-310: Documentation update section correctly identifies broken examples.Calling out that some docs show
settings.workspace_key_prefix(which doesn't exist) and should referencebackend.s3.workspace_key_prefixormetadata.nameis helpful context for the doc team. This prevents propagation of incorrect patterns.
what
Feature Implementation:
stacks.inherit.metadata)metadata.nameas a stable logical component identity for workspace key prefixesinheritfield inatmos describe configoutputBug Fixes:
metadata.type: abstractfrom inheritance to prevent abstract components from becoming deployableExecuteDescribeStacksto ensure inherited metadata fields (liketerraform_workspace) are resolved when describing stacksterraform_workspacetakes precedence over inherited/imported patternsDocumentation:
metadata.nameconvention: first-level component folder relative to component base pathworkspace_key_prefixpatterns across version management documentationmetadata.namemetadata.nameover manual settingsTests:
metadata.namemetadata.type: abstractexclusionstacks.inheritfield in describe config outputwhy
Feature Justification:
metadata.nameprovides a stable, predictable workspace key that doesn't change when component paths are refactoredBug Justification:
metadata.type: abstract, abstract base components could become deployable when inherited, breaking the abstract component patternExecuteDescribeStackswas only merging YAML imports but not applying component inheritance, causing inherited metadata fields to be ignoredBuildTerraformWorkspaceDocumentation Justification:
metadata.namefeature was implemented but documentation still showed old manualworkspace_key_prefixpatterns, creating confusion and encouraging error-prone workaroundsmetadata.name= top-level component folderreferences
TestDescribeStacksWithFilter7which validates inheritedterraform_workspacemetadataSummary by CodeRabbit
New Features
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.