Skip to content

Commit 32672e5

Browse files
Copilotostermanaknyshclaudeautofix-ci[bot]
authored
Fix workdir collision for component instances sharing base component (#2093)
* Initial plan * Fix workdir path to use component instance name instead of metadata.component The workdir provisioner was using metadata.component (base component) instead of atmos_component (component instance name) when generating workdir paths. This caused all instances of the same component to share the same workdir, preventing parallel execution. Now workdir paths use atmos_component first, falling back to metadata.component for backward compatibility. This ensures each component instance gets a unique workdir like: - .workdir/terraform/dev-elasticache-redis-cluster-1 - .workdir/terraform/dev-elasticache-redis-cluster-2 - .workdir/terraform/dev-elasticache-redis-cluster-3 Instead of all mapping to: - .workdir/terraform/dev-elasticache Added comprehensive test coverage for component instances sharing the same base component. Co-authored-by: osterman <52489+osterman@users.noreply.github.com> * Merge branch 'main' into copilot/fix-parallel-component-instances Resolved merge conflict in pkg/provisioner/workdir/workdir.go by combining: - New hasSource() check from main (handles source + workdir coordination) - atmos_component fix for parallel instance isolation The fix now works correctly with both local components and remote source provisioning. Co-authored-by: osterman <52489+osterman@users.noreply.github.com> * Merge latest main into copilot/fix-parallel-component-instances Resolved merge conflict in pkg/provisioner/workdir/workdir.go by keeping the atmos_component fix for parallel instance isolation. The conflict occurred because changes from main reverted to using ComponentKey instead of atmos_component. All workdir tests pass including TestComponentInstancesWithSameBaseComponent. Co-authored-by: osterman <52489+osterman@users.noreply.github.com> * test(workdir): add tests for atmos_component priority and file sync Add 13 new tests covering: - atmos_component priority: overrides base component, falls back to component key when absent/empty/non-string (the core fix from this PR) - Concurrent component instances: 5 parallel instances sharing one base component all get unique workdirs (validates issue #2091 fix) - SyncDir: deletes removed files, reports no changes for identical files, preserves .atmos/ metadata directory - fileNeedsCopy: permission changes, identical files, missing destination - getModTimeFromEntry: error path returns zero time (was 75% coverage) Coverage remains at 93.3% with getModTimeFromEntry now at 100%. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(workdir): separate workdir naming from source path resolution Fix critical bug where component instances sharing a base component (e.g., elasticache-redis-cluster-1 inheriting from elasticache) would fail because the source path was resolved using the instance name instead of the base component name. Changes: - Use atmos_component for workdir directory naming (isolation) - Use extractComponentName() for source path resolution (base component) - Add component_info.component_path check in extractComponentPath() to support the production flow where paths are set in nested maps - Remove component_path workarounds from tests that masked the bug - Add tests for production flow, base component path resolution, nested component_info, and non-inherited component fallback Test coverage: 93.2% for workdir package. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix tests, increase test coverage * [autofix.ci] apply automated fixes * fix(workdir): skip permission change test on Windows Windows does not support Unix-style file permissions (0o755 vs 0o644 are effectively the same), so the TestFileNeedsCopy_PermissionChange test correctly fails there. Skip it on Windows with runtime.GOOS check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test(workdir): cover sourceComponent fallback when no component keys exist Add test for the case where only atmos_component is set (no component, metadata.component, or vars.component keys), exercising the fallback path where sourceComponent = workdirComponent. This brings Provision() to 100% coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: osterman <52489+osterman@users.noreply.github.com> Co-authored-by: aknysh <andriy.knysh@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 6edec69 commit 32672e5

File tree

3 files changed

+811
-14
lines changed

3 files changed

+811
-14
lines changed

0 commit comments

Comments
 (0)