Skip to content

fix(auth): skip identity resolution in describe when functions disabled - #2262

Merged
Andriy Knysh (aknysh) merged 8 commits into
mainfrom
feat/skip-identity-on-describe
Mar 28, 2026
Merged

Andriy Knysh (aknysh) merged 8 commits into
mainfrom
feat/skip-identity-on-describe

Conversation

@johncblandii

@johncblandii John C. Bland II (johncblandii) commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor

what

  • Skip identity resolution in all four describe commands (describe component, describe stacks, describe affected, describe dependents) when --process-functions=false
  • Use cmd.Flags().Changed(IdentityFlagName) instead of identityName != "" so that only an explicit --identity CLI flag bypasses the guard — ATMOS_IDENTITY env vars no longer trigger auth when functions are disabled
  • Add 10 regression tests covering: auth skipped when functions disabled, env var doesn't bypass guard, explicit --identity flag forces auth, and unit tests for the Changed vs env var distinction

why

  • When all YAML functions are disabled via --process-functions=false, describe commands were still attempting identity resolution (SSO login, credential fetching, etc.)
  • YAML functions (!terraform.state, !terraform.output) are the only consumers of auth credentials during describe — no functions means no auth needed
  • The original guard treated env vars (ATMOS_IDENTITY) as equivalent to explicit CLI flags, causing auth to run even when the user only wanted raw config inspection
  • This caused unnecessary authentication prompts/errors in CI and local development

references

  • Affects cmd/describe_component.go, cmd/describe_stacks.go, cmd/describe_affected.go, cmd/describe_dependents.go

Summary by CodeRabbit

  • Bug Fixes

    • Describe commands now skip unnecessary authentication resolution unless YAML functions processing is enabled or an identity flag was explicitly provided, avoiding spurious auth errors and improving reliability.
  • Tests

    • Added regression tests covering auth-skip behavior across describe commands and verifying explicit identity-flag vs environment-variable semantics.
  • Refactor

    • Reworked describe command wiring to improve dependency injection and execution plumbing for component description.

When --process-functions=false is set, describe commands no longer attempt
identity resolution. YAML functions (!terraform.state, !terraform.output)
are the only consumers of auth credentials during describe, so identity
resolution is unnecessary when functions are disabled. The --identity flag
still works regardless of the process-functions setting.
@github-actions github-actions Bot added the size/m Medium size PR label Mar 27, 2026
@github-actions

github-actions Bot commented Mar 27, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA ce87519.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@coderabbitai

coderabbitai Bot commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Describe commands now skip creating or assigning an AuthManager unless YAML function processing is enabled or the --identity flag was explicitly provided. A new test suite verifies the auth-skip behavior across describe commands and component flows.

Changes

Cohort / File(s) Summary
Describe command auth initialization
cmd/describe_affected.go, cmd/describe_dependents.go, cmd/describe_stacks.go
Conditionally resolve identity and call CreateAuthManagerFromIdentityWithAtmosConfig(...): only create/assign AuthManager when ProcessYamlFunctions is true or --identity was explicitly set; otherwise skip auth creation and its error path.
Describe component command wiring
cmd/describe_component.go
Refactored RunE into getRunnableDescribeComponentCmd with dependency injection; constructs schema.ConfigAndStacksInfo from flags; guards component auth extraction/merge and auth creation by ProcessYamlFunctions/explicit-identity; dispatches via injected DescribeComponentCmdExec.
Exec interface change
internal/exec/describe_component.go
Added public DescribeComponentCmdExec interface and changed NewDescribeComponentExec() to return the interface; added go:generate for mock generation.
Mocks (generated)
internal/exec/mock_describe_component.go
Added GoMock-generated MockDescribeComponentCmdExec to support testing the new interface.
Regression tests for auth-skip
cmd/describe_skip_auth_test.go
New tests covering --process-functions=false scenarios, env vs explicit --identity, and asserting exec receives nil AuthManager or that errors occur when identity is forced. Includes helpers/builders for describe component and shared props.

Sequence Diagram(s)

sequenceDiagram
    rect rgba(200,200,255,0.5)
    participant CLI
    end
    rect rgba(200,255,200,0.5)
    participant Cmd
    end
    rect rgba(255,200,200,0.5)
    participant AuthManager
    end
    rect rgba(255,255,200,0.5)
    participant Exec
    end

    CLI->>Cmd: invoke describe command (flags, env)
    Cmd->>Cmd: check ProcessYamlFunctions and IdentityFlagChanged?
    alt process functions enabled OR identity explicitly set
        Cmd->>AuthManager: CreateAuthManagerFromIdentityWithAtmosConfig(...)
        AuthManager-->>Cmd: AuthManager or error
        Cmd->>Exec: Execute with AuthManager set
    else skip auth creation
        Cmd-->>Exec: Execute with AuthManager = nil
    end
    Exec-->>CLI: return result / error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • osterman
  • aknysh
🚥 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 change: skipping identity resolution in describe commands when YAML function processing is disabled.
Docstring Coverage ✅ Passed Docstring coverage is 80.77% 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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/skip-identity-on-describe

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 coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/describe_skip_auth_test.go`:
- Around line 56-172: Add tests for the describe component command that ensure
an explicit --identity still forces auth even when
ProcessYamlFunctions/--process-functions is false: mirror the existing pattern
used in TestDescribeAffected_SkipsAuthWhenFunctionsDisabled and the other tests
but use newTestCmdWithFunctionsDisabled, getRunnableDescribeComponentCmd and a
mock exec created via exec.NewMockDescribeComponentExec; when the mock's Execute
is called assert that args.ProcessYamlFunctions is false but args.AuthManager is
NOT nil (i.e. auth is performed) when you pass an explicit identity in the CLI
args/props, and also include the complementary case (no explicit identity yields
nil AuthManager) so both sides are covered.

In `@cmd/describe_stacks.go`:
- Around line 77-84: GetIdentityFromFlags currently treats env vars as
equivalent to explicit flags which makes the guard in the describe commands
trigger auth even when --process-functions=false; update the logic so the code
only treats an identity as "explicit" (and thus should bypass the
process-functions skip) when the CLI flag was changed. Either modify
GetIdentityFromFlags to return (identity, wasExplicit bool) or, at each guard
(e.g., where describe.ProcessYamlFunctions and identityName are checked before
calling CreateAuthManagerFromIdentityWithAtmosConfig and assigning
describe.AuthManager), replace the identityName check with
cmd.Flags().Changed(IdentityFlagName) (or check the returned wasExplicit) so
that ambient ATMOS_IDENTITY env values do not cause auth to run when
--process-functions is false.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: adac3784-7927-42fc-b4ff-62b6ac97016d

📥 Commits

Reviewing files that changed from the base of the PR and between eb963b9 and 14fa6f2.

📒 Files selected for processing (5)
  • cmd/describe_affected.go
  • cmd/describe_component.go
  • cmd/describe_dependents.go
  • cmd/describe_skip_auth_test.go
  • cmd/describe_stacks.go

Comment thread cmd/describe_skip_auth_test.go Resolved
Comment thread cmd/describe_stacks.go Resolved
@codecov

codecov Bot commented Mar 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.50000% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.29%. Comparing base (66845bf) to head (ce87519).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/describe_component.go 73.26% 18 Missing and 9 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2262      +/-   ##
==========================================
+ Coverage   77.24%   77.29%   +0.04%     
==========================================
  Files        1020     1020              
  Lines       96530    96564      +34     
==========================================
+ Hits        74567    74638      +71     
+ Misses      17762    17734      -28     
+ Partials     4201     4192       -9     
Flag Coverage Δ
unittests 77.29% <77.50%> (+0.04%) ⬆️

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

Files with missing lines Coverage Δ
cmd/describe_affected.go 88.63% <100.00%> (+5.30%) ⬆️
cmd/describe_dependents.go 68.75% <100.00%> (+4.23%) ⬆️
cmd/describe_stacks.go 86.41% <100.00%> (+2.87%) ⬆️
internal/exec/describe_component.go 69.00% <100.00%> (ø)
cmd/describe_component.go 74.80% <73.26%> (+19.24%) ⬆️

... and 7 files with indirect coverage changes

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

@osterman Erik Osterman (Cloud Posse) (osterman) added the patch A minor, backward compatible change label Mar 27, 2026
Replace `identityName != ""` with `cmd.Flags().Changed(IdentityFlagName)`
in all four describe command guards. This prevents ATMOS_IDENTITY env vars
from bypassing the process-functions guard — only an explicit --identity
CLI flag should force auth when functions are disabled.

Add regression tests: env var doesn't bypass guard, explicit flag does,
and unit tests for the Changed vs env var distinction.
Refactor describe component command to use factory function pattern
(getRunnableDescribeComponentCmd) matching the other three describe
commands. This enables mock injection for unit testing.

Add DescribeComponentCmdExec interface and generated mock.
Add 3 describe component tests: auth skipped when functions disabled,
env var doesn't bypass guard, explicit --identity forces auth.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/describe_component.go`:
- Around line 164-166: The auth manager is being created with
CreateAuthManagerFromIdentity(identityName, mergedAuthConfig) which prevents
loading stack-level default identities when identityName is empty; update the
call to pass atmosConfig so stack-level defaults are considered (e.g. call
CreateAuthManagerFromIdentity(..., atmosConfig) or the equivalent
CreateAuthManagerFromIdentityWithConfig function if available) so that
authManager creation in describe component uses atmosConfig along with
mergedAuthConfig and identityName.

In `@cmd/describe_skip_auth_test.go`:
- Around line 114-147: The tests call viper.Reset() which clears the CLI
flag-to-viper binding so ATMOS_IDENTITY never reaches GetIdentityFromFlags;
re-establish the binding after each viper.Reset() in the env-var tests (the same
way the identity flag is rebound in the other test around the
GetIdentityFromFlags usage) so that the command's auth-guard is exercised
correctly—i.e., after viper.Reset() re-bind the "identity" flag to Viper (the
same binding logic used elsewhere), then run the test using
getRunnableDescribeStacksCmd and assert that args.AuthManager is nil when
ProcessYamlFunctions is false.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b89bf5d4-9efa-49b0-a9f9-92c1ec42d0cd

📥 Commits

Reviewing files that changed from the base of the PR and between 14fa6f2 and 3aa8e23.

📒 Files selected for processing (5)
  • cmd/describe_affected.go
  • cmd/describe_component.go
  • cmd/describe_dependents.go
  • cmd/describe_skip_auth_test.go
  • cmd/describe_stacks.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/describe_affected.go

Comment thread cmd/describe_component.go Resolved
Comment thread cmd/describe_skip_auth_test.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (4)
cmd/describe_component.go (1)

187-192: ⚠️ Potential issue | 🟠 Major

Pass atmosConfig into auth creation here.

Line 189 uses CreateAuthManagerFromIdentity, so an empty identityName cannot load stack-level default identities from the stack config. That leaves describe component out of sync with the other describe commands whenever auth defaults live outside atmos.yaml.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/describe_component.go` around lines 187 - 192,
CreateAuthManagerFromIdentity is being called without the atmosConfig so an
empty identityName cannot resolve stack-level defaults; update the auth creation
call in describe_component.go to pass atmosConfig into the
CreateAuthManagerFromIdentity invocation (e.g.,
CreateAuthManagerFromIdentity(atmosConfig, identityName, mergedAuthConfig)) so
authManager can load stack-level default identities; adjust any matching
function signature or import usage for CreateAuthManagerFromIdentity, and ensure
authManager/error handling remains the same.
cmd/describe_skip_auth_test.go (3)

112-148: ⚠️ Potential issue | 🟡 Minor

Env-var test passes for the wrong reason.

viper.Reset() at line 114 clears the env binding, so GetIdentityFromFlags returns empty—not because the guard ignores env-var identity, but because viper can't see it. Rebind after reset to actually test the guard.

🔧 Fix
 	viper.Reset()
+	require.NoError(t, viper.BindEnv(IdentityFlagName, "ATMOS_IDENTITY", "IDENTITY"))
 	// Set the env var — this should NOT trigger auth when functions are disabled.
 	t.Setenv("ATMOS_IDENTITY", "some-identity")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/describe_skip_auth_test.go` around lines 112 - 148, The test
TestDescribeStacks_SkipsAuthWhenEnvVarSetButFunctionsDisabled currently calls
viper.Reset(), which clears the environment bindings so GetIdentityFromFlags
sees an empty identity for the wrong reason; after calling viper.Reset()
re-establish the viper-to-flag/env bindings (the same bind logic used in
production, e.g., the function that wires flags/env or whatever binding helper
your code uses) so that setting t.Setenv("ATMOS_IDENTITY", ...) actually
populates viper; keep the rest of the test (asserting args.AuthManager is nil in
the mock Execute in mockExec and using
newTestCmdWithFunctionsDisabled/getRunnableDescribeStacksCmd) unchanged so the
guard behavior is validated correctly.

223-258: ⚠️ Potential issue | 🟡 Minor

Same viper binding issue here.

Rebind after viper.Reset() so the env var is actually visible.

🔧 Fix
 	viper.Reset()
+	require.NoError(t, viper.BindEnv(IdentityFlagName, "ATMOS_IDENTITY", "IDENTITY"))
 	t.Setenv("ATMOS_IDENTITY", "some-identity")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/describe_skip_auth_test.go` around lines 223 - 258, The test resets viper
with viper.Reset() which clears existing env bindings so the subsequent
t.Setenv("ATMOS_IDENTITY", ...) has no effect; rebind the required env keys
immediately after viper.Reset() in
TestDescribeDependents_SkipsAuthWhenEnvVarSetButFunctionsDisabled (or call the
shared viper setup helper used elsewhere) so that "ATMOS_IDENTITY" and
"IDENTITY" are bound to viper before invoking
getRunnableDescribeDependentsCmd/run; ensure the restore/bind calls mirror
whatever binding logic the code uses (e.g., viper.BindEnv("ATMOS_IDENTITY") and
viper.BindEnv("IDENTITY") or invoking the common viper-init function) so the
test assertions on props.AuthManager behave as expected.

334-372: ⚠️ Potential issue | 🟡 Minor

Same viper binding issue here too.

Rebind after viper.Reset().

🔧 Fix
 	viper.Reset()
+	require.NoError(t, viper.BindEnv(IdentityFlagName, "ATMOS_IDENTITY", "IDENTITY"))
 	t.Setenv("ATMOS_IDENTITY", "some-identity")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/describe_skip_auth_test.go` around lines 334 - 372, This test calls
viper.Reset() which clears Viper bindings, so rebind the Viper/CLI flags after
viper.Reset() (before creating testCmd or invoking
getRunnableDescribeAffectedCmd) so the ATMOS_IDENTITY env var is picked up
correctly; insert the same Viper binding call/helper used elsewhere in the tests
(the helper you use to bind flags for commands) immediately after viper.Reset()
in TestDescribeAffected_SkipsAuthWhenEnvVarSetButFunctionsDisabled.
🧹 Nitpick comments (1)
cmd/describe_skip_auth_test.go (1)

61-66: clearIdentityEnvVars resets viper bindings.

This helper calls viper.Reset() which clears all env bindings. Tests that later rely on ATMOS_IDENTITY being visible to GetIdentityFromFlags need to rebind after calling this.

♻️ Consider adding rebind to the helper
 func clearIdentityEnvVars(t *testing.T) {
 	t.Helper()
 	viper.Reset()
+	// Rebind so env vars can still be read when needed.
+	_ = viper.BindEnv(IdentityFlagName, "ATMOS_IDENTITY", "IDENTITY")
 	t.Setenv("ATMOS_IDENTITY", "")
 	t.Setenv("IDENTITY", "")
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/describe_skip_auth_test.go` around lines 61 - 66, The helper
clearIdentityEnvVars calls viper.Reset(), which removes environment bindings and
breaks later tests that expect ATMOS_IDENTITY/IDENTITY to be bound for
GetIdentityFromFlags; after resetting, re-establish the bindings by calling
viper.BindEnv for the keys used by GetIdentityFromFlags (e.g., "ATMOS_IDENTITY"
and "IDENTITY" or the canonical keys that GetIdentityFromFlags reads) so tests
see the env vars again while still clearing their values via t.Setenv.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/describe_skip_auth_test.go`:
- Around line 479-504: This test needs to rebind Viper to the environment
variables the CLI reads (same pattern used elsewhere); after viper.Reset() and
t.Setenv(...) call viper.BindEnv for the relevant config keys (e.g., bind the
CLI config key for identity to "ATMOS_IDENTITY" and/or "IDENTITY") so the
command created by
newTestCmdForDescribeComponent/getRunnableDescribeComponentCmd sees the env var;
add the viper.BindEnv calls before creating mockExec or invoking run (adjust key
names to match describeComponentTestProps/atmosConfigWithBrokenDefaultIdentity
usage).

---

Duplicate comments:
In `@cmd/describe_component.go`:
- Around line 187-192: CreateAuthManagerFromIdentity is being called without the
atmosConfig so an empty identityName cannot resolve stack-level defaults; update
the auth creation call in describe_component.go to pass atmosConfig into the
CreateAuthManagerFromIdentity invocation (e.g.,
CreateAuthManagerFromIdentity(atmosConfig, identityName, mergedAuthConfig)) so
authManager can load stack-level default identities; adjust any matching
function signature or import usage for CreateAuthManagerFromIdentity, and ensure
authManager/error handling remains the same.

In `@cmd/describe_skip_auth_test.go`:
- Around line 112-148: The test
TestDescribeStacks_SkipsAuthWhenEnvVarSetButFunctionsDisabled currently calls
viper.Reset(), which clears the environment bindings so GetIdentityFromFlags
sees an empty identity for the wrong reason; after calling viper.Reset()
re-establish the viper-to-flag/env bindings (the same bind logic used in
production, e.g., the function that wires flags/env or whatever binding helper
your code uses) so that setting t.Setenv("ATMOS_IDENTITY", ...) actually
populates viper; keep the rest of the test (asserting args.AuthManager is nil in
the mock Execute in mockExec and using
newTestCmdWithFunctionsDisabled/getRunnableDescribeStacksCmd) unchanged so the
guard behavior is validated correctly.
- Around line 223-258: The test resets viper with viper.Reset() which clears
existing env bindings so the subsequent t.Setenv("ATMOS_IDENTITY", ...) has no
effect; rebind the required env keys immediately after viper.Reset() in
TestDescribeDependents_SkipsAuthWhenEnvVarSetButFunctionsDisabled (or call the
shared viper setup helper used elsewhere) so that "ATMOS_IDENTITY" and
"IDENTITY" are bound to viper before invoking
getRunnableDescribeDependentsCmd/run; ensure the restore/bind calls mirror
whatever binding logic the code uses (e.g., viper.BindEnv("ATMOS_IDENTITY") and
viper.BindEnv("IDENTITY") or invoking the common viper-init function) so the
test assertions on props.AuthManager behave as expected.
- Around line 334-372: This test calls viper.Reset() which clears Viper
bindings, so rebind the Viper/CLI flags after viper.Reset() (before creating
testCmd or invoking getRunnableDescribeAffectedCmd) so the ATMOS_IDENTITY env
var is picked up correctly; insert the same Viper binding call/helper used
elsewhere in the tests (the helper you use to bind flags for commands)
immediately after viper.Reset() in
TestDescribeAffected_SkipsAuthWhenEnvVarSetButFunctionsDisabled.

---

Nitpick comments:
In `@cmd/describe_skip_auth_test.go`:
- Around line 61-66: The helper clearIdentityEnvVars calls viper.Reset(), which
removes environment bindings and breaks later tests that expect
ATMOS_IDENTITY/IDENTITY to be bound for GetIdentityFromFlags; after resetting,
re-establish the bindings by calling viper.BindEnv for the keys used by
GetIdentityFromFlags (e.g., "ATMOS_IDENTITY" and "IDENTITY" or the canonical
keys that GetIdentityFromFlags reads) so tests see the env vars again while
still clearing their values via t.Setenv.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fbefedff-840c-49bf-97dd-4e3a3bae8d21

📥 Commits

Reviewing files that changed from the base of the PR and between 3aa8e23 and 554d48a.

📒 Files selected for processing (4)
  • cmd/describe_component.go
  • cmd/describe_skip_auth_test.go
  • internal/exec/describe_component.go
  • internal/exec/mock_describe_component.go
✅ Files skipped from review due to trivial changes (1)
  • internal/exec/mock_describe_component.go

Comment thread cmd/describe_skip_auth_test.go Resolved
… test bindings

Switch describe component from CreateAuthManagerFromIdentity to
CreateAuthManagerFromIdentityWithAtmosConfig so stack-level default
identities are discovered (matching the other three describe commands).

Re-establish viper.BindEnv after viper.Reset() in all env-var tests
so ATMOS_IDENTITY actually reaches GetIdentityFromFlags, ensuring the
guard is exercised correctly rather than passing vacuously.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/describe_component.go`:
- Around line 109-112: The call to g.initCliConfig is building
schema.ConfigAndStacksInfo only from component and stack, which drops global
config-selection flags; fix by first populating the ConfigAndStacksInfo from the
parsed global flags (use flags.ParseGlobalFlags or the same parsing path used
elsewhere to seed the struct) and then set ComponentFromArg and Stack on that
struct before calling g.initCliConfig/InitCliConfig so --base-path, --config,
--config-path and --profile are preserved; update the code that constructs
schema.ConfigAndStacksInfo (used by g.initCliConfig / cfg.InitCliConfig) to
start from the parsed globals and then override ComponentFromArg and Stack.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f6a60da3-4c40-4d14-8b82-bbb901df8723

📥 Commits

Reviewing files that changed from the base of the PR and between 554d48a and 710cdd0.

📒 Files selected for processing (2)
  • cmd/describe_component.go
  • cmd/describe_skip_auth_test.go

Comment thread cmd/describe_component.go Resolved
…sInfo

The describe component command was constructing ConfigAndStacksInfo with
only ComponentFromArg and Stack, dropping --base-path, --config,
--config-path, and --profile global flags. Extract these from cmd.Flags()
to match the behavior of ProcessCommandLineArgs used by other describe
commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/describe_component.go`:
- Around line 179-199: The code is currently ignoring componentErr from
g.executeDescribeComponent (while only returning for
errUtils.ErrInvalidComponent); instead, if executeDescribeComponent returns any
error it should be returned immediately so we don't begin authentication probes
on a likely real config/stack/component failure—modify the error branch in the
executeDescribeComponent call inside DescribeComponent to return componentErr
for non-nil componentErr (only keep the special-case return for
errUtils.ErrInvalidComponent if you truly want to treat that as a different
path), so the merge step (auth.MergeComponentAuthFromConfig) only runs when
componentConfig is valid.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fa9cad73-9ad8-4944-bbd9-63427be73079

📥 Commits

Reviewing files that changed from the base of the PR and between 710cdd0 and 7c48697.

📒 Files selected for processing (1)
  • cmd/describe_component.go

Comment thread cmd/describe_component.go Resolved
Andriy Knysh (aknysh) and others added 2 commits March 28, 2026 11:05
Add 9 tests covering previously untested paths in getRunnableDescribeComponentCmd:
- FunctionsEnabled_HappyPath: auth resolution + executor called
- ComponentNotFound: ErrInvalidComponent returned immediately
- ComponentAuthError_FallsBackToGlobal: graceful degradation to global auth
- PathResolution: isExplicitComponentPath triggers resolver
- PathResolutionError: resolver errors propagated
- InitConfigError: config loading errors propagated
- GlobalFlagsExtracted: base-path captured in ConfigAndStacksInfo
- CheckAtmosConfigError: early return on config check failure
- AllGlobalFlagsExtracted: config, config-path, profile flags captured

Coverage: 65.2% -> 82.6% (above 80% target).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@github-actions github-actions Bot added size/l Large size PR and removed size/m Medium size PR labels Mar 28, 2026
Extract helpers from getRunnableDescribeComponentCmd to fix all golangci-lint issues:
- parseDescribeComponentFlags: flag extraction (eliminates repeated GetString/GetBool)
- buildConfigAndStacksInfoFromFlags: global flags to ConfigAndStacksInfo
- resolveAuthManager with resolveAuthManagerParams struct (fixes nestif + arg-limit)
- resolveComponentFromPathIfNeeded: path resolution extraction (fixes function-length)
- handleConfigError: config error wrapping with path-resolution context
- Use ErrInvalidArguments sentinel instead of dynamic errors.New (fixes err113)

Restore flag registrations in init() (AddStackCompletion, PersistentFlags).
Add 9 new tests for describe component coverage (65.2% -> 82.6%).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@aknysh
Andriy Knysh (aknysh) merged commit ad044f8 into main Mar 28, 2026
56 checks passed
@aknysh
Andriy Knysh (aknysh) deleted the feat/skip-identity-on-describe branch March 28, 2026 16:58
@github-actions

Copy link
Copy Markdown

These changes were released in v1.214.0-rc.1.

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/l Large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants