Skip to content

Fail fast on missing component identity - #2411

Merged
Andriy Knysh (aknysh) merged 3 commits into
mainfrom
osterman/fail-on-missing-identity
May 15, 2026
Merged

Andriy Knysh (aknysh) merged 3 commits into
mainfrom
osterman/fail-on-missing-identity

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented May 15, 2026 •

Copy link
Copy Markdown
Member

what

  • Fail fast when per-component auth resolution fails for components that declare a default identity.
  • Stop eager auth-manager error printing so the top-level command emits one formatted error.
  • Add regression coverage and document the fix under docs/fixes.

why

  • Missing or invalid component identities are fatal because falling back to parent or ambient auth can use the wrong backend or account.
  • This prevents atmos list instances --upload from repeating the same identity error per component and continuing after bad auth.

references

  • See docs/fixes/2026-05-15-list-instances-auth-fail-fast.md.

Summary by CodeRabbit

  • Bug Fixes

    • atmos list instances --upload now fails fast when per-component auth resolution fails for components with a default identity; returns a clear error including component and stack context and stops further processing.
    • Eager error printing during auth initialization was removed and centralized to avoid repeated initialization messages.
  • Documentation

    • Added docs describing the updated authentication failure behavior.
  • Tests

    • Updated tests to verify resolver failures are treated as fatal and include component/stack context.

Review Change Stack

@atmos-pro

atmos-pro Bot commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More.

@github-actions github-actions Bot added the size/m Medium size PR label May 15, 2026
@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@atmos-pro atmos-pro 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.

There were no affected stacks, therefore this is approved by Atmos Pro.

@osterman Erik Osterman (Cloud Posse) (osterman) added the patch A minor, backward compatible change label May 15, 2026
@osterman
Erik Osterman (Cloud Posse) (osterman) marked this pull request as ready for review May 15, 2026 17:30
atmos-pro[bot]
atmos-pro Bot previously approved these changes May 15, 2026

@atmos-pro atmos-pro 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.

There were no affected stacks, therefore this is approved by Atmos Pro.

@coderabbitai

coderabbitai Bot commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 419d0a41-a80d-42dc-aca2-45de49076224

📥 Commits

Reviewing files that changed from the base of the PR and between f7d3a51 and 19866fa.

📒 Files selected for processing (2)
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/describe_stacks_component_processor_auth_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/describe_stacks_component_processor_auth_test.go

📝 Walkthrough

Walkthrough

Per-component auth resolution now returns initialization errors (with component/stack context) instead of falling back; Auth manager defers printing initialization errors; the component processor aborts on resolver failures; tests assert propagation and early termination; docs document the user-facing change.

Changes

Auth Fail-Fast on Component Resolution

Layer / File(s) Summary
Auth manager error deferral
pkg/auth/manager.go
NewAuthManager, initializeProviders, and initializeIdentities remove eager error printing via errUtils.CheckErrorAndPrint and instead return wrapped errors to callers.
Component processor auth resolution error handling
internal/exec/describe_stacks_component_processor.go
resolveComponentAuthManager returns (auth.AuthManager, error) and returns resolver failures with component/stack context; processComponentEntry captures the error and immediately terminates processing if auth resolution fails.
Auth resolution error propagation tests
internal/exec/describe_stacks_component_processor_auth_test.go
Tests updated to require resolveComponentAuthManager's error return be checked; TestResolveComponentAuthManager_ResolverErrorIsFatal verifies error wrapping and nil AuthManager; TestProcessComponentEntry_ComponentAuthResolverErrorIsFatal ensures processing stops after the first auth failure.
Fail-fast behavior documentation
docs/fixes/2026-05-15-list-instances-auth-fail-fast.md
Documents the change in atmos list instances --upload behavior: per-component auth resolution now stops at the first failure instead of continuing with repeated errors; top-level handler formats the error once.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • aknysh
  • atmos-pro
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: failing fast when component identity resolution fails during auth processing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch osterman/fail-on-missing-identity

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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/exec/describe_stacks_component_processor.go`:
- Around line 144-146: The current error wrap for auth resolution returns
createErr directly; update the fmt.Errorf call in the component auth resolution
block (where createErr and componentAuthManager are used) to wrap with the
shared sentinel errUtils.ErrAuthManager so it becomes: use fmt.Errorf("%w:
failed to resolve auth for component %q in stack %q: %w",
errUtils.ErrAuthManager, componentName, stackName, createErr) thereby preserving
the original createErr while tagging it with ErrAuthManager (same pattern as
used in terraform_nested_auth_helper.go).
🪄 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: 8d827507-bf07-470d-84b0-fd0c6b87df1e

📥 Commits

Reviewing files that changed from the base of the PR and between a6113a8 and f9673b9.

📒 Files selected for processing (4)
  • docs/fixes/2026-05-15-list-instances-auth-fail-fast.md
  • internal/exec/describe_stacks_component_processor.go
  • internal/exec/describe_stacks_component_processor_auth_test.go
  • pkg/auth/manager.go
💤 Files with no reviewable changes (1)
  • pkg/auth/manager.go

atmos-pro[bot]
atmos-pro Bot previously approved these changes May 15, 2026

@atmos-pro atmos-pro 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.

There were no affected stacks, therefore this is approved by Atmos Pro.

…entinel

Per CodeRabbit review, align the per-component auth error with the
existing pattern in terraform_nested_auth_helper.go so callers can match
via errors.Is(err, errUtils.ErrAuthManager).

Co-Authored-By: Claude Opus 4.7 <[email protected]>

@atmos-pro atmos-pro 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.

There were no affected stacks, therefore this is approved by Atmos Pro.

@codecov

codecov Bot commented May 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.08%. Comparing base (a6113a8) to head (19866fa).

Files with missing lines Patch % Lines
...ternal/exec/describe_stacks_component_processor.go 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2411      +/-   ##
==========================================
+ Coverage   78.06%   78.08%   +0.01%     
==========================================
  Files        1110     1110              
  Lines      104674   104673       -1     
==========================================
+ Hits        81714    81734      +20     
+ Misses      18422    18397      -25     
- Partials     4538     4542       +4     
Flag Coverage Δ
unittests 78.08% <90.90%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
pkg/auth/manager.go 82.93% <ø> (-0.23%) ⬇️
...ternal/exec/describe_stacks_component_processor.go 95.73% <90.90%> (-0.20%) ⬇️

... and 8 files with indirect coverage changes

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

@aknysh
Andriy Knysh (aknysh) merged commit e21a28c into main May 15, 2026
59 checks passed
@atmos-pro

atmos-pro Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

@aknysh
Andriy Knysh (aknysh) deleted the osterman/fail-on-missing-identity branch May 15, 2026 23:36
@github-actions

Copy link
Copy Markdown

These changes were released in v1.218.1-rc.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/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants