Skip to content

fix: resolve relative component_path against BasePath for --chdir support#2029

Merged
aknysh merged 13 commits intomainfrom
aknysh/describe-affected-test-2
Jan 26, 2026
Merged

fix: resolve relative component_path against BasePath for --chdir support#2029
aknysh merged 13 commits intomainfrom
aknysh/describe-affected-test-2

Conversation

@aknysh
Copy link
Member

@aknysh aknysh commented Jan 26, 2026

what

  • Fix path resolution issue in pkg/terraform/output/executor.go where relative component_path was not resolved against atmosConfig.BasePath
  • Add comprehensive unit tests to increase test coverage from 88.4% to 92.9%
  • Add integration tests for --chdir flag path resolution scenarios
  • Add documentation describing the issue, root cause analysis, and fix

why

  • User-reported regression: In Atmos v1.195.0+, users encountered backend.tf.json: no such file or directory errors when using the atmos.Component template function with --chdir flag or when running from a non-project-root directory
  • Root cause: buildComponentInfo() in describe_stacks.go returns component_path as a relative path (e.g., components/terraform/vpc), but pkg/terraform/output/executor.go used this path directly for file operations. When CWD differs from project root, the relative path doesn't resolve correctly
  • The fix: Resolve relative component_path against atmosConfig.BasePath before using it for file operations (backend generation, terraform init/output)

Changes Made

Fix (pkg/terraform/output/executor.go):

// Step 2.5: Resolve relative component path against atmosConfig.BasePath.
if config.ComponentPath != "" && !filepath.IsAbs(config.ComponentPath) {
    config.ComponentPath = filepath.Join(atmosConfig.BasePath, config.ComponentPath)
}

Test Coverage Improvements:

Function Before After
GetOutput 50.0% 89.5%
GetAllOutputs 80.0% 100%
fetchAndCacheOutputs 66.7% 93.3%
runInit 90.0% 100%
processOutputs 80.0% 100%
Package Total 88.4% 92.9%

Integration Tests Added (tests/test-cases/chdir.yaml):

  • atmos --chdir with describe stacks resolves component paths - Verifies describe stacks works from different directory
  • atmos --chdir with describe affected resolves paths correctly - Verifies describe affected works from different directory

references

Summary by CodeRabbit

  • Bug Fixes

    • Component path resolution now consistently respects project base paths, --chdir usage, and folder-prefix metadata to ensure correct working directory and backend resolution.
  • Documentation

    • Added a detailed guide describing the path-resolution issue, root cause, implemented fix approach, and verification steps.
  • Tests

    • Added extensive unit and end-to-end tests covering path resolution, --chdir scenarios, caching, backend behaviors, UI/error flows, and regression cases.

✏️ Tip: You can customize this high-level summary in your review settings.

aknysh and others added 5 commits January 25, 2026 20:40
…tput executor

When atmos.Component template function executes, it retrieves component_path
from describe stacks output as a relative path (e.g., "components/terraform/vpc").
This relative path was used directly for file operations like writing backend.tf.json,
which fails when CWD differs from project root (e.g., when using --chdir flag).

The fix resolves relative component paths against atmosConfig.BasePath before
using them for file operations, ensuring correct path resolution regardless
of the current working directory.

This addresses the user-reported error:
"template: describe-stacks-all-sections:72:21 ... at <atmos.Component>:
error calling Component: open ... backend.tf.json: no such file or directory"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add table-driven tests to verify that the component path resolution
fix works correctly:

- Relative paths are resolved against atmosConfig.BasePath
- Absolute paths are preserved unchanged
- Empty BasePath with relative paths works correctly

These tests prevent regression of the path resolution issue that
caused "backend.tf.json: no such file or directory" errors when
using atmos.Component template function with --chdir flag.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive tests to improve test coverage:

- TestExecutor_GetOutput_InvalidAuthManagerType: tests invalid auth manager error
- TestExecutor_GetOutput_FullExecutionPath: tests complete execution without cache
- TestExecutor_GetOutput_DescribeError: tests DescribeComponent failure handling
- TestExecutor_GetOutput_ExecuteError: tests execute failure handling
- TestExecutor_GetAllOutputs_Success: tests GetAllOutputs happy path
- TestExecutor_GetAllOutputs_CacheHit: tests cache retrieval
- TestExecutor_GetAllOutputs_Error: tests error handling
- TestExecutor_GetAllOutputs_StaticRemoteState: tests static remote state path
- TestProcessOutputs_WithInvalidJSON: tests invalid JSON handling
- TestExecutor_ExecuteWithSections_InitWithReconfigure: tests reconfigure option
- TestStartSpinnerOrLog_DebugMode/TraceMode: tests log-only mode
- TestHighlightValue_NilConfig: tests nil config handling

Key coverage improvements:
- GetOutput: 50% → 89.5%
- GetAllOutputs: 80% → 100%
- fetchAndCacheOutputs: 66.7% → 93.3%
- runInit: 90% → 100%
- processOutputs: 80% → 100%

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add integration tests to verify that running atmos with --chdir from
a different directory correctly resolves component paths. These tests
prevent regression of the path resolution issue fixed in this branch
where relative component_path was not resolved against BasePath,
causing "no such file or directory" errors.

Tests added to chdir.yaml:
- "atmos --chdir with describe stacks resolves component paths"
  Tests that describe stacks works correctly when run from a different
  directory with --chdir pointing to a fixture with templates.

- "atmos --chdir with describe affected resolves paths correctly"
  Tests that describe affected works correctly when run from a
  different directory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@aknysh aknysh requested a review from a team as a code owner January 26, 2026 02:25
@aknysh aknysh added the patch A minor, backward compatible change label Jan 26, 2026
@github-actions github-actions bot added the size/l Large size PR label Jan 26, 2026
@aknysh aknysh self-assigned this Jan 26, 2026
@github-actions
Copy link

github-actions bot commented Jan 26, 2026

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

Resolves component path determination by passing Atmos configuration into component extraction and using utils.GetComponentPath so component_path values become absolute (respecting atmosConfig.BasePath and metadata) before backend generation and file I/O. (≤50 words)

Changes

Cohort / File(s) Summary
Documentation
docs/fixes/describe-affected-component-path-resolution.md
New diagnostic doc describing the component_path resolution bug, root cause, considered fixes, chosen fix (consumer-side via utils.GetComponentPath), and testing guidance.
Core implementation
pkg/terraform/output/config.go, pkg/terraform/output/executor.go
Threaded *schema.AtmosConfiguration into extraction call chain; ExtractComponentConfig, extractRequiredFields, and extractComponentPath now accept atmosConfig and use utils.GetComponentPath to resolve absolute ComponentPath. Updated call site in executor.go and removed an unused import.
Unit tests
pkg/terraform/output/executor_test.go, pkg/terraform/output/config_test.go
Added and expanded tests covering executor flows, outputs, caching, backend behaviors, spinner/logging, and regression tests validating component path resolution (relative → absolute and absolute preserved). Tests construct AtmosConfiguration and use cross-platform path assertions.
Integration tests
tests/test-cases/chdir.yaml
New end-to-end test case validating --chdir with describe stacks resolves component_path correctly.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as Atmos CLI
  participant Executor as Terraform Output Executor
  participant Extractor as ExtractComponentConfig
  participant Resolver as utils.GetComponentPath
  participant Backend as Backend Generator / File I/O

  CLI->>Executor: invoke describe/describe-stacks (may pass --chdir)
  Executor->>Extractor: ExtractComponentConfig(atmosConfig, sections, component, stack)
  Extractor->>Resolver: GetComponentPath(component_type, component, atmosConfig.BasePath, metadata)
  Resolver-->>Extractor: resolved absolute component path
  Extractor-->>Executor: ComponentConfig (with absolute ComponentPath)
  Executor->>Backend: generate backend files / run init using resolved path
  Backend-->>Executor: backend artifacts / results
  Executor-->>CLI: return outputs / errors
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • osterman
  • mcalhoun
  • jamengual
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: resolving relative component_path against BasePath to support --chdir, which is the core change across multiple files.
Docstring Coverage ✅ Passed Docstring coverage is 81.48% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch aknysh/describe-affected-test-2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 26, 2026
…tory

The describe affected command requires git history to work properly.
In CI environments with shallow clones, this causes exit code 128.
Keep only the describe stacks test which adequately verifies the
--chdir path resolution fix without git dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 26, 2026
@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.51%. Comparing base (e483668) to head (b86dcc4).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/terraform/output/config.go 91.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2029      +/-   ##
==========================================
+ Coverage   75.43%   75.51%   +0.08%     
==========================================
  Files         793      793              
  Lines       73666    73699      +33     
==========================================
+ Hits        55568    55655      +87     
+ Misses      14589    14547      -42     
+ Partials     3509     3497      -12     
Flag Coverage Δ
unittests 75.51% <92.00%> (+0.08%) ⬆️

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

Files with missing lines Coverage Δ
pkg/terraform/output/executor.go 91.73% <100.00%> (+6.34%) ⬆️
pkg/terraform/output/config.go 95.04% <91.66%> (-4.96%) ⬇️

... and 6 files with indirect coverage changes

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

…ests

Use filepath.Join() and filepath.ToSlash() for cross-platform compatibility:
- Use t.TempDir() to get a valid absolute path on all platforms
- Use filepath.Join() to construct paths with correct separators
- Use filepath.ToSlash() to normalize paths for comparison
- Use suffix check instead of exact match for flexibility

This fixes test failures on Windows where path separators differ.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 26, 2026
@aknysh aknysh requested a review from osterman January 26, 2026 04:46
@github-actions github-actions bot added size/xl Extra large size PR and removed size/l Large size PR labels Jan 26, 2026
@aknysh
Copy link
Member Author

aknysh commented Jan 26, 2026

@coderabbitai full review please

@mergify
Copy link

mergify bot commented Jan 26, 2026

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.
Consider refactoring it into smaller, more focused PRs to facilitate a smoother review process.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

@aknysh: I'll conduct a full review of the PR covering all changes including the component path resolution fix, test additions, and documentation.


🧠 Learnings used
Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: Final XDG Base Directory Specification implementation for atmos toolchain is complete and verified: toolchain/xdg_cache.go provides GetXDGCacheDir() and GetXDGTempCacheDir() functions, all hardcoded ~/.cache/tools-cache paths have been replaced with XDG-compliant paths using ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain fallback), and tests have been updated to expect the new path structure.

Learnt from: osterman
Repo: cloudposse/atmos PR: 887
File: internal/exec/workflow_utils.go:167-169
Timestamp: 2024-12-25T20:28:19.618Z
Learning: The user plans to revert the change from `path.Join` to `filepath.Join` in this PR due to testing gaps and will open a new PR to safely handle the migration without breaking `main`.

Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: XDG Base Directory Specification compliance implementation for atmos toolchain is complete: created toolchain/xdg_cache.go with GetXDGCacheDir() and GetXDGTempCacheDir() functions, updated toolchain/installer.go and cmd/toolchain_clean.go to use these XDG helpers, and changed all cache paths from hardcoded ~/.cache/tools-cache to XDG-compliant ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain fallback).

Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform_clean.go:329-332
Timestamp: 2024-10-28T01:51:30.811Z
Learning: In the Atmos Go code, when deleting directories or handling file paths (e.g., in `terraform_clean.go`), always resolve the absolute path using `filepath.Abs` and use the logger `u.LogWarning` for logging messages instead of using `fmt.Printf`.

Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected_test.go:15-15
Timestamp: 2025-05-23T19:51:47.091Z
Learning: The atmos codebase has a custom extension to *testing.T that provides a Chdir method, allowing test functions to call t.Chdir() to change working directories during tests. This is used consistently across test files in the codebase.

Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: The atmos toolchain XDG compliance implementation is complete with GetXDGCacheDir() and GetXDGTempCacheDir() functions in toolchain/xdg_cache.go, updated installer.go and toolchain_clean.go to use these helpers, and changed cache paths from ~/.cache/tools-cache to ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain when XDG_CACHE_HOME is not set).

Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: docs/prd/tool-dependencies-integration.md:58-64
Timestamp: 2025-12-13T06:07:37.766Z
Learning: cloudposse/atmos: For PRD docs (docs/prd/*.md), markdownlint issues like MD040/MD010/MD034 can be handled in a separate documentation cleanup commit and should not block the current PR.

Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: errors/errors.go:184-203
Timestamp: 2025-12-13T06:10:13.688Z
Learning: cloudposse/atmos: For toolchain work, duplicate/unused error sentinels in errors/errors.go should be cleaned up in a separate refactor PR and not block feature PRs; canonical toolchain sentinels live under toolchain/registry with re-exports in toolchain/errors.go.

Learnt from: 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.

Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
✅ Actions performed

Full review triggered.

@aknysh aknysh requested a review from osterman January 26, 2026 15:44
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

@aknysh: I'll conduct a comprehensive review of all changes in this PR, including the component path resolution fix, test coverage improvements, and documentation.


🧠 Learnings used
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.

Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: docs/prd/tool-dependencies-integration.md:58-64
Timestamp: 2025-12-13T06:07:37.766Z
Learning: cloudposse/atmos: For PRD docs (docs/prd/*.md), markdownlint issues like MD040/MD010/MD034 can be handled in a separate documentation cleanup commit and should not block the current PR.

Learnt from: 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.

Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.

Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_utils.go:496-513
Timestamp: 2024-11-22T12:38:33.132Z
Learning: In the Atmos project, continue to flag path traversal issues in code reviews but acknowledge when they are expected and acceptable in specific cases.

Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: XDG Base Directory Specification compliance implementation for atmos toolchain is complete: created toolchain/xdg_cache.go with GetXDGCacheDir() and GetXDGTempCacheDir() functions, updated toolchain/installer.go and cmd/toolchain_clean.go to use these XDG helpers, and changed all cache paths from hardcoded ~/.cache/tools-cache to XDG-compliant ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain fallback).

Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: The atmos toolchain XDG compliance implementation is complete with GetXDGCacheDir() and GetXDGTempCacheDir() functions in toolchain/xdg_cache.go, updated installer.go and toolchain_clean.go to use these helpers, and changed cache paths from ~/.cache/tools-cache to ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain when XDG_CACHE_HOME is not set).

Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: errors/errors.go:184-203
Timestamp: 2025-12-13T06:10:13.688Z
Learning: cloudposse/atmos: For toolchain work, duplicate/unused error sentinels in errors/errors.go should be cleaned up in a separate refactor PR and not block feature PRs; canonical toolchain sentinels live under toolchain/registry with re-exports in toolchain/errors.go.

Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: Final XDG Base Directory Specification implementation for atmos toolchain is complete and verified: toolchain/xdg_cache.go provides GetXDGCacheDir() and GetXDGTempCacheDir() functions, all hardcoded ~/.cache/tools-cache paths have been replaced with XDG-compliant paths using ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain fallback), and tests have been updated to expect the new path structure.

Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Ensure all tests pass, verify code coverage meets targets, run golangci-lint and fix any issues, and update documentation before submitting pull requests

Learnt from: osterman
Repo: cloudposse/atmos PR: 887
File: internal/exec/workflow_utils.go:167-169
Timestamp: 2024-12-25T20:28:19.618Z
Learning: The user plans to revert the change from `path.Join` to `filepath.Join` in this PR due to testing gaps and will open a new PR to safely handle the migration without breaking `main`.

Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform_clean.go:329-332
Timestamp: 2024-10-28T01:51:30.811Z
Learning: In the Atmos Go code, when deleting directories or handling file paths (e.g., in `terraform_clean.go`), always resolve the absolute path using `filepath.Abs` and use the logger `u.LogWarning` for logging messages instead of using `fmt.Printf`.

Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected_test.go:15-15
Timestamp: 2025-05-23T19:51:47.091Z
Learning: The atmos codebase has a custom extension to *testing.T that provides a Chdir method, allowing test functions to call t.Chdir() to change working directories during tests. This is used consistently across test files in the codebase.
✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@docs/fixes/describe-affected-component-path-resolution.md`:
- Around line 88-105: Add the markdown language tag "text" to the flow‑diagram
code fence so the opening fence becomes ```text (leaving the closing fence as
```); update the fenced block that starts with "User Template: {{
atmos.Component \"vpc\" \"dev-ue1\" }}" (the flow‑diagram in the doc) to use
```text to satisfy MD040 and clarify intent.

In `@pkg/terraform/output/executor_test.go`:
- Around line 21-30: The comment above the helper function validSections() is
misleading because it claims a temp directory is used; update the comment to
accurately describe the function’s behavior (e.g., "Helper function that returns
a minimal valid sections map for tests" or similar) and remove any mention of a
temp directory or cross-platform compatibility; keep the comment concise and
reference the function name validSections to locate and replace the misleading
comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/fixes/describe-affected-component-path-resolution.md`:
- Around line 81-85: Add terminal periods to the three bullet sentences that
describe resolution behavior for the relative path example
"components/terraform/vpc/backend.tf.json": end the lines mentioning CWD,
atmosConfig.BasePath, and the CI/subdirectory mismatch with a period. Apply the
same fix to the equivalent sentences in the later section that repeats this text
(the block that mirrors lines referencing the same path and CWD vs
atmosConfig.BasePath behavior). Ensure only punctuation is changed—no wording
alterations.
🧹 Nitpick comments (2)
pkg/terraform/output/executor_test.go (2)

3-9: Prefer temp-based BasePath over hard-coded /tmp.

Hard-coded /tmp can be brittle on Windows/locked-down CI; deriving from os.TempDir() keeps paths cross‑platform. As per coding guidelines, prioritize cross‑platform paths.

♻️ Suggested tweak
@@
-import (
-	"context"
-	"errors"
-	"fmt"
-	"path/filepath"
-	"strings"
-	"testing"
+import (
+	"context"
+	"errors"
+	"fmt"
+	"os"
+	"path/filepath"
+	"strings"
+	"testing"
@@
-		BasePath: "/tmp/test-project",
+		BasePath: filepath.Join(os.TempDir(), "test-project"),

Also applies to: 38-46


1086-1205: Align the component argument with the section value for realism.

Passing tt.componentName mirrors real call sites and keeps error context consistent if a test fails.

🔧 Suggested tweak
-			outputs, err := exec.ExecuteWithSections(atmosConfig, "vpc", "dev-ue1", sections, nil)
+			outputs, err := exec.ExecuteWithSections(atmosConfig, tt.componentName, "dev-ue1", sections, nil)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/fixes/describe-affected-component-path-resolution.md`:
- Around line 286-297: The snippet references componentInfoMap without showing
its derivation from componentInfo, which is confusing; update the code to assert
and assign componentInfoMap from componentInfo (e.g., componentInfoMap, ok :=
componentInfo.(map[string]interface{})) before using componentInfoMap, then use
that map when extracting "component_type" so the variables componentInfo,
componentInfoMap and the lookup for "component_type" are clearly defined and
safe.

@aknysh aknysh merged commit b731596 into main Jan 26, 2026
57 checks passed
@aknysh aknysh deleted the aknysh/describe-affected-test-2 branch January 26, 2026 18:42
@github-actions
Copy link

These changes were released in v1.205.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A minor, backward compatible change size/xl Extra large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants