Merged
Conversation
|
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. |
Contributor
There was a problem hiding this comment.
golangci-lint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Member
Author
|
@coderabbitai full review |
Contributor
✅ Actions performedFull review triggered. |
aknysh
added a commit
that referenced
this pull request
Oct 11, 2025
This fixes a second regression from PR #1602 where explicitly-set metadata.component values were being overwritten by values from inherited abstract components. ## Problem When a component explicitly sets metadata.component and inherits from an abstract component: ```yaml eks/service/app1: metadata: component: eks-service inherits: - eks/service/defaults # abstract component ``` The explicitly-set metadata.component (eks-service) was being overwritten by the abstract component's metadata.component value, causing: - Wrong component path used - Terraform looking for state in wrong location - Potential resource duplication or conflicts ## Root Cause In processMetadataInheritance(), after setting metadata.component explicitly, processInheritedComponent() calls applyBaseComponentConfig() which unconditionally overwrites result.BaseComponentName with the inherited value. ## Solution Save the explicitly-set metadata.component value before processing inherits, then restore it afterwards. This ensures: - Explicit metadata.component values are never overwritten - Backend workspace_key_prefix uses correct component name - Components find their existing state files ## Changes - internal/exec/stack_processor_process_stacks_helpers_inheritance.go: Added explicitBaseComponentName tracking and restoration after inherits - internal/exec/abstract_component_backend_test.go: Added regression test - tests/fixtures/scenarios/abstract-component-backend/: Added test fixture ## Testing - New regression test passes - All existing component inheritance tests pass - All describe component tests pass Fixes #1613 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
aknysh
added a commit
that referenced
this pull request
Oct 13, 2025
…onent (#1614) * Fix component inheritance when metadata.component is not set This fixes a regression introduced in PR #1602 where components with metadata.inherits but no explicit metadata.component were failing. ## Problem When a component had: - metadata.inherits: [base-component] - NO metadata.component set Atmos was incorrectly using the inherited component's metadata.component value instead of defaulting to the component name itself. ## Solution Modified processMetadataInheritance() to: - Track whether metadata.component was explicitly set (not inherited) - Process metadata.inherits to inherit configuration (vars, settings, etc.) - Always default metadata.component to the component name when not explicitly set - This happens regardless of whether metadata.inherits exists or not Key insight: metadata.component is a pointer to the physical terraform directory and is NOT related to metadata.inherits. The metadata section itself is per-component and is NOT inherited. ## Changes - internal/exec/stack_processor_process_stacks_helpers_inheritance.go: Fixed processMetadataInheritance to properly default metadata.component - internal/exec/component_inheritance_test.go: Added regression test - tests/fixtures/scenarios/component-inheritance-without-metadata-component/: Added test fixture ## Testing - New regression test passes - All existing describe component tests pass - All stack processing tests pass - Manual testing confirms fix works Fixes #1609 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix metadata.component being overwritten by inherited values This fixes a second regression from PR #1602 where explicitly-set metadata.component values were being overwritten by values from inherited abstract components. ## Problem When a component explicitly sets metadata.component and inherits from an abstract component: ```yaml eks/service/app1: metadata: component: eks-service inherits: - eks/service/defaults # abstract component ``` The explicitly-set metadata.component (eks-service) was being overwritten by the abstract component's metadata.component value, causing: - Wrong component path used - Terraform looking for state in wrong location - Potential resource duplication or conflicts ## Root Cause In processMetadataInheritance(), after setting metadata.component explicitly, processInheritedComponent() calls applyBaseComponentConfig() which unconditionally overwrites result.BaseComponentName with the inherited value. ## Solution Save the explicitly-set metadata.component value before processing inherits, then restore it afterwards. This ensures: - Explicit metadata.component values are never overwritten - Backend workspace_key_prefix uses correct component name - Components find their existing state files ## Changes - internal/exec/stack_processor_process_stacks_helpers_inheritance.go: Added explicitBaseComponentName tracking and restoration after inherits - internal/exec/abstract_component_backend_test.go: Added regression test - tests/fixtures/scenarios/abstract-component-backend/: Added test fixture ## Testing - New regression test passes - All existing component inheritance tests pass - All describe component tests pass Fixes #1613 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Remove GitHub issue references from code comments * updates * Fix component inheritance to preserve top-level component attribute Fix the processMetadataInheritance() function to properly handle all three inheritance scenarios: 1. Top-level component: attribute sets BaseComponentName 2. metadata.component explicitly set preserves the value 3. metadata.inherits without metadata.component defaults to component name Changes: - Add conditional check to only set default BaseComponentName if not already set by top-level component inheritance - Remove incorrect code that was adding current component to BaseComponents list - BaseComponents should only contain components we inherit FROM, not the current component itself This fixes the test failures where: - TestProcessComponentInheritance was getting ["base-vpc", "derived-vpc"] instead of ["base-vpc"] - TestProcessMetadataInheritance was getting ["mixin1", "mixin2", "derived"] instead of ["mixin1", "mixin2"] - TestSpaceliftStackProcessor was getting wrong workspace_key_prefix values - Component test/test-component-override was losing its top-level component: "test/test-component" value 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix metadata.inherits without metadata.component defaulting logic The previous fix didn't properly handle components with metadata.inherits but no metadata.component. When processing inherits, applyBaseComponentConfig() would set result.BaseComponentName to the inherited component name, and then our check would see it as already set and not default it. This fix saves the original BaseComponentName (from top-level component inheritance) before processing inherits, allowing us to distinguish between: 1. Value set by top-level component: attribute (should preserve) 2. Value set by metadata.inherits processing (should override with component name) Fixes TestComponentInheritanceWithoutMetadataComponent which expected "derived-component" but was getting "base-component". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Clarify code comments: metadata.inherits is independent of component paths Update comments to clarify that metadata.inherits should NOT be used to determine component paths or affect metadata.component. These are completely independent concepts: - metadata.component: determines physical Terraform component directory path - metadata.inherits: only for configuration inheritance (vars, settings, backend, etc.) - Atmos component name: defaults for metadata.component when not explicitly set The bug was that processing metadata.inherits inadvertently overwrote metadata.component as a side effect of calling applyBaseComponentConfig(). The fix prevents this unwanted overwriting while preserving the intended behavior of each mechanism. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * updates * Fix flaky TestGetAffectedComponents by detecting mock failures Add check to skip test when gomonkey mocking fails and the real function gets called with an invalid repository path, returning an unexpected error. The test "empty_affected_list" was flaky because: 1. It mocks ExecuteDescribeAffectedWithTargetRepoPath to return empty list 2. When mock fails (platform/compiler dependent), real function is called 3. Real function tries to access fake path "/path/to/repo" 4. Returns error "invalid repository path" 5. Test fails with: "Received unexpected error: invalid repository path" Now the test properly detects this scenario and skips with a helpful message instead of failing intermittently. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * updates --------- Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Oct 14, 2025
This was referenced Oct 22, 2025
This was referenced Nov 8, 2025
This was referenced Nov 18, 2025
This was referenced Dec 10, 2025
This was referenced Dec 18, 2025
This was referenced Jan 4, 2026
This was referenced Jan 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
what
authsection following the same hierarchy as vars/env/settings:why
ProcessStackConfigfunction contained nearly identical logic repeated 3 times for Terraform, Helmfile, and Packer componentsauthsection needed proper deep-merge support to enable hierarchical authentication configuration across the stackchanges
Auth Section Deep-Merge Implementation
Merge Hierarchy
The
authsection now merges through the complete hierarchy (later values override earlier ones):auth:at stack root)terraform.auth:,helmfile.auth:, orpacker.auth:)component:inheritance)auth:)overrides.auth:)Test Coverage
Comprehensive test coverage with:
TestProcessComponentTestProcessTerraformBackendTestProcessTerraformRemoteStateBackendTestMergeComponentConfigurationsTestProcessAuthConfigtesting
Test Results
✅ All new test cases pass
✅ All auth merging tests pass
Test Quality
Auth Section Usage Examples
Result: The final merged
authfor thevpccomponent will be:Result: The final merged
authfor thevpccomponent will be:notes
✅ Auth deep-merge implementation complete
Current status:
Summary by CodeRabbit
New Features
Improvements
Chores
Tests