Repository navigation
auth Allow override of AWS Resolver URL - #1624
Conversation
📝 WalkthroughWalkthroughAdds a configurable AWS endpoint resolver and wires it into AWS auth flows so identity or provider configs can supply a custom resolver URL. Documentation, tests, and a LocalStack example identity were added. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Flow as Auth Flow (User/AssumeRole/SSO/SAML)
participant ResolverSel as Resolver Selector
participant Loader as AWS SDK Config Loader
participant AWS as AWS Service
Note right of ResolverSel: Selects resolver from Identity or Provider (identity wins)
Caller->>Flow: start auth
Flow->>ResolverSel: GetResolverConfigOption(identity, provider)
ResolverSel-->>Flow: resolver option or nil
Flow->>Loader: LoadDefaultConfig(region, resolver?)
alt Resolver configured
Loader->>AWS: use custom endpoint resolver (fixed URL)
else no resolver
Loader->>AWS: use default endpoints
end
Loader-->>Flow: cfg
Flow->>AWS: API calls using cfg
AWS-->>Flow: response
Flow-->>Caller: result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
pkg/auth/cloud/aws/resolver.go (2)
3-9: Consider updating to mapstructure v2.The import uses
github.com/mitchellh/mapstructure, but based on learnings, the v2 version is now maintained atgithub.com/go-viper/mapstructure/v2. While not a blocker, consider updating to the maintained fork for future compatibility.</review_comment_end -->
51-67: Silent error handling may hide configuration issues.The
mapstructure.Decodeerror at line 62-63 is silently ignored by returning nil. While this provides graceful degradation, it may hide configuration typos or structure mismatches. Consider logging the decode error at debug level to aid troubleshooting.Apply this diff:
var awsConfig AWSConfig if err := mapstructure.Decode(awsRaw, &awsConfig); err != nil { + log.Debug("Failed to decode AWS config", "error", err) return nil }</review_comment_end -->
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (9)
examples/demo-localstack/atmos.yaml(1 hunks)pkg/auth/cloud/aws/README.md(1 hunks)pkg/auth/cloud/aws/resolver.go(1 hunks)pkg/auth/cloud/aws/resolver_test.go(1 hunks)pkg/auth/identities/aws/assume_role.go(1 hunks)pkg/auth/identities/aws/permission_set.go(1 hunks)pkg/auth/identities/aws/user.go(1 hunks)pkg/auth/providers/aws/saml.go(2 hunks)pkg/auth/providers/aws/sso.go(2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
pkg/**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Place business logic in pkg rather than in cmd
Files:
pkg/auth/identities/aws/assume_role.gopkg/auth/identities/aws/user.gopkg/auth/providers/aws/saml.gopkg/auth/cloud/aws/resolver.gopkg/auth/cloud/aws/resolver_test.gopkg/auth/providers/aws/sso.gopkg/auth/identities/aws/permission_set.go
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments
**/*.go: All comments must end with periods across all Go code (godot linter enforced).
Organize imports into three groups (stdlib, 3rd-party, Atmos) separated by blank lines and sorted alphabetically within groups; preserve existing aliases.
Add defer perf.Track(<atmosConfig|nil>, ".")() at the start of all public and critical private functions, followed by a blank line.
All errors must be wrapped using static errors from errors/errors.go; prefer errors.Join for multiple errors, fmt.Errorf with %w for context, and check with errors.Is; never use dynamic errors directly.
Use utils.PrintfMarkdown() to render embedded markdown examples for CLI help output.
Co-locate unit tests with implementation files; integration tests reside under tests/.
Distinguish UI output from logging: UI prompts/status/errors to stderr; data/results to stdout; logging for system/debug info only with structured fields.
Most text UI must go to stderr; only data/results to stdout. Prefer utils.PrintfMessageToTUI for UI messages.
Bind all environment variables with viper.BindEnv(); every env var must have an ATMOS_ alternative binding.
Favor cross-platform code: prefer SDKs over external binaries, use filepath/os/runtime, and handle OS-specific differences or use build tags.
For non-standard execution paths, capture telemetry using telemetry.CaptureCmd or telemetry.CaptureCmdString without collecting user data.
Search for existing methods and utilities (internal/exec, pkg/) before implementing new functionality; prefer reuse/refactoring over duplication.
Files:
pkg/auth/identities/aws/assume_role.gopkg/auth/identities/aws/user.gopkg/auth/providers/aws/saml.gopkg/auth/cloud/aws/resolver.gopkg/auth/cloud/aws/resolver_test.gopkg/auth/providers/aws/sso.gopkg/auth/identities/aws/permission_set.go
**/!(*_test).go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Document all exported functions, types, and methods with Go doc comments
Files:
pkg/auth/identities/aws/assume_role.gopkg/auth/identities/aws/user.gopkg/auth/providers/aws/saml.gopkg/auth/cloud/aws/resolver.gopkg/auth/providers/aws/sso.gopkg/auth/identities/aws/permission_set.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios
**/*_test.go: Write unit tests as table-driven tests focused on behavior; prefer high coverage for pkg/ and internal/exec/; comments must end with periods.
Use t.Skipf with a reason instead of t.Skip; never skip without a reason.
Test files must mirror implementation file names (e.g., aws_ssm_store_test.go pairs with aws_ssm_store.go).
Files:
pkg/auth/cloud/aws/resolver_test.go
pkg/**/*_test.go
📄 CodeRabbit inference engine (CLAUDE.md)
Place unit tests for packages under pkg/ as *_test.go files.
Files:
pkg/auth/cloud/aws/resolver_test.go
🧬 Code graph analysis (6)
pkg/auth/identities/aws/assume_role.go (1)
pkg/auth/cloud/aws/resolver.go (1)
GetResolverConfigOption(25-47)
pkg/auth/identities/aws/user.go (1)
pkg/auth/cloud/aws/resolver.go (1)
GetResolverConfigOption(25-47)
pkg/auth/providers/aws/saml.go (1)
pkg/auth/cloud/aws/resolver.go (1)
GetResolverConfigOption(25-47)
pkg/auth/cloud/aws/resolver_test.go (1)
pkg/auth/cloud/aws/resolver.go (1)
GetResolverConfigOption(25-47)
pkg/auth/providers/aws/sso.go (2)
pkg/auth/cloud/aws/resolver.go (1)
GetResolverConfigOption(25-47)errors/errors.go (1)
ErrAuthenticationFailed(332-332)
pkg/auth/identities/aws/permission_set.go (1)
pkg/auth/cloud/aws/resolver.go (1)
GetResolverConfigOption(25-47)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: Build (macos-latest, macos)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Analyze (go)
- GitHub Check: Lint (golangci)
- GitHub Check: Lint (golangci)
- GitHub Check: Analyze (go)
- GitHub Check: Lint (golangci)
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (go)
- GitHub Check: Lint (golangci)
- GitHub Check: Summary
🔇 Additional comments (9)
examples/demo-localstack/atmos.yaml (1)
27-39: LGTM! LocalStack configuration is correct.The authentication configuration properly demonstrates the new resolver feature with appropriate test credentials and the standard LocalStack endpoint. This serves as a good reference example for users.
</review_comment_end -->
pkg/auth/identities/aws/assume_role.go (1)
44-54: Clean integration of resolver option.The dynamic config options pattern correctly integrates the custom endpoint resolver while maintaining backward compatibility. The conditional appending ensures the resolver is only used when configured.
</review_comment_end -->
pkg/auth/identities/aws/permission_set.go (1)
227-242: Consistent resolver integration.The implementation follows the same pattern as other identity types, ensuring uniform resolver support across all AWS authentication flows.
</review_comment_end -->
pkg/auth/providers/aws/saml.go (2)
20-20: Good import alias choice.The
awsCloudalias prevents collision with the AWS SDK import and clearly indicates the package scope.</review_comment_end -->
241-252: Provider-level resolver correctly integrated.The SAML provider correctly passes
nilfor identity andp.configfor provider toGetResolverConfigOption, implementing the documented precedence behavior (identity > provider).</review_comment_end -->
pkg/auth/cloud/aws/README.md (1)
1-78: Excellent documentation.The README clearly explains the resolver feature, configuration options, precedence rules, and provides practical examples. The implementation details section helps developers understand the underlying mechanism.
</review_comment_end -->
pkg/auth/cloud/aws/resolver_test.go (1)
10-103: Comprehensive test coverage.The tests validate all key behaviors: nil handling, identity precedence over provider, fallback to provider, empty URL handling, and extraction logic. The test structure is clear and follows Go testing conventions.
</review_comment_end -->
pkg/auth/identities/aws/user.go (1)
163-179: User identity resolver integration complete.The resolver option is correctly integrated into the session token generation flow, maintaining consistency with other identity types.
</review_comment_end -->
pkg/auth/providers/aws/sso.go (1)
91-94: Use errors.Join for wrapping and cover resolver path in tests.
- Replace the current wrap with errors.Join, e.g.:
- return nil, fmt.Errorf("%w: failed to load AWS config: %v", errUtils.ErrAuthenticationFailed, err) + return nil, errors.Join(errUtils.ErrAuthenticationFailed, fmt.Errorf("failed to load AWS config: %w", err))
- Add or extend tests in pkg/auth/providers/aws/sso_test.go to exercise the resolver configuration logic (lines 86–88).
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1624 +/- ##
==========================================
+ Coverage 64.49% 64.55% +0.05%
==========================================
Files 333 334 +1
Lines 37469 37536 +67
==========================================
+ Hits 24167 24231 +64
+ Misses 11350 11346 -4
- Partials 1952 1959 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
pkg/auth/cloud/aws/README.md(1 hunks)pkg/auth/cloud/aws/resolver.go(1 hunks)pkg/auth/cloud/aws/resolver_test.go(1 hunks)pkg/auth/providers/aws/saml_test.go(1 hunks)pkg/auth/providers/aws/sso.go(2 hunks)pkg/auth/providers/aws/sso_test.go(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- pkg/auth/cloud/aws/README.md
- pkg/auth/providers/aws/saml_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
- pkg/auth/cloud/aws/resolver_test.go
- pkg/auth/cloud/aws/resolver.go
🧰 Additional context used
📓 Path-based instructions (5)
pkg/**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Place business logic in pkg rather than in cmd
Files:
pkg/auth/providers/aws/sso.gopkg/auth/providers/aws/sso_test.go
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments
**/*.go: All comments must end with periods across all Go code (godot linter enforced).
Organize imports into three groups (stdlib, 3rd-party, Atmos) separated by blank lines and sorted alphabetically within groups; preserve existing aliases.
Add defer perf.Track(<atmosConfig|nil>, ".")() at the start of all public and critical private functions, followed by a blank line.
All errors must be wrapped using static errors from errors/errors.go; prefer errors.Join for multiple errors, fmt.Errorf with %w for context, and check with errors.Is; never use dynamic errors directly.
Use utils.PrintfMarkdown() to render embedded markdown examples for CLI help output.
Co-locate unit tests with implementation files; integration tests reside under tests/.
Distinguish UI output from logging: UI prompts/status/errors to stderr; data/results to stdout; logging for system/debug info only with structured fields.
Most text UI must go to stderr; only data/results to stdout. Prefer utils.PrintfMessageToTUI for UI messages.
Bind all environment variables with viper.BindEnv(); every env var must have an ATMOS_ alternative binding.
Favor cross-platform code: prefer SDKs over external binaries, use filepath/os/runtime, and handle OS-specific differences or use build tags.
For non-standard execution paths, capture telemetry using telemetry.CaptureCmd or telemetry.CaptureCmdString without collecting user data.
Search for existing methods and utilities (internal/exec, pkg/) before implementing new functionality; prefer reuse/refactoring over duplication.
Files:
pkg/auth/providers/aws/sso.gopkg/auth/providers/aws/sso_test.go
**/!(*_test).go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Document all exported functions, types, and methods with Go doc comments
Files:
pkg/auth/providers/aws/sso.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios
**/*_test.go: Write unit tests as table-driven tests focused on behavior; prefer high coverage for pkg/ and internal/exec/; comments must end with periods.
Use t.Skipf with a reason instead of t.Skip; never skip without a reason.
Test files must mirror implementation file names (e.g., aws_ssm_store_test.go pairs with aws_ssm_store.go).
Files:
pkg/auth/providers/aws/sso_test.go
pkg/**/*_test.go
📄 CodeRabbit inference engine (CLAUDE.md)
Place unit tests for packages under pkg/ as *_test.go files.
Files:
pkg/auth/providers/aws/sso_test.go
🧬 Code graph analysis (2)
pkg/auth/providers/aws/sso.go (2)
pkg/auth/cloud/aws/resolver.go (1)
GetResolverConfigOption(25-49)errors/errors.go (1)
ErrAuthenticationFailed(332-332)
pkg/auth/providers/aws/sso_test.go (1)
pkg/auth/providers/aws/sso.go (1)
NewSSOProvider(36-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Lint (golangci)
- GitHub Check: Analyze (go)
- GitHub Check: Summary
🔇 Additional comments (2)
pkg/auth/providers/aws/sso_test.go (1)
208-253: Test coverage looks solid.Both tests appropriately verify that the provider constructor handles custom resolver configuration in the Spec field. Accessing private fields directly (lines 227-228) is idiomatic for Go tests in the same package.
pkg/auth/providers/aws/sso.go (1)
80-94: Implementation looks good.The config options pattern cleanly integrates the optional custom resolver. Passing
nilfor identity is correct—SSO authentication occurs before an identity exists, so the resolver correctly falls back to provider config.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
pkg/auth/providers/aws/sso_test.go (1)
231-236: Assert resolver URL value.Great start. Let’s also assert the nested resolver URL so this test trips if the URL gets dropped.
Apply this diff:
assert.NotNil(t, p.config.Spec) awsSpec, ok := p.config.Spec["aws"] assert.True(t, ok) assert.NotNil(t, awsSpec) + + awsConfig, ok := awsSpec.(map[string]interface{}) + require.True(t, ok) + resolverConfig, ok := awsConfig["resolver"].(map[string]interface{}) + require.True(t, ok) + assert.Equal(t, "http://localhost:4566", resolverConfig["url"])
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
pkg/auth/identities/aws/assume_role_test.go(1 hunks)pkg/auth/providers/aws/sso_test.go(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
pkg/**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Place business logic in pkg rather than in cmd
Files:
pkg/auth/identities/aws/assume_role_test.gopkg/auth/providers/aws/sso_test.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios
**/*_test.go: Write unit tests as table-driven tests focused on behavior; prefer high coverage for pkg/ and internal/exec/; comments must end with periods.
Use t.Skipf with a reason instead of t.Skip; never skip without a reason.
Test files must mirror implementation file names (e.g., aws_ssm_store_test.go pairs with aws_ssm_store.go).
Files:
pkg/auth/identities/aws/assume_role_test.gopkg/auth/providers/aws/sso_test.go
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments
**/*.go: All comments must end with periods across all Go code (godot linter enforced).
Organize imports into three groups (stdlib, 3rd-party, Atmos) separated by blank lines and sorted alphabetically within groups; preserve existing aliases.
Add defer perf.Track(<atmosConfig|nil>, ".")() at the start of all public and critical private functions, followed by a blank line.
All errors must be wrapped using static errors from errors/errors.go; prefer errors.Join for multiple errors, fmt.Errorf with %w for context, and check with errors.Is; never use dynamic errors directly.
Use utils.PrintfMarkdown() to render embedded markdown examples for CLI help output.
Co-locate unit tests with implementation files; integration tests reside under tests/.
Distinguish UI output from logging: UI prompts/status/errors to stderr; data/results to stdout; logging for system/debug info only with structured fields.
Most text UI must go to stderr; only data/results to stdout. Prefer utils.PrintfMessageToTUI for UI messages.
Bind all environment variables with viper.BindEnv(); every env var must have an ATMOS_ alternative binding.
Favor cross-platform code: prefer SDKs over external binaries, use filepath/os/runtime, and handle OS-specific differences or use build tags.
For non-standard execution paths, capture telemetry using telemetry.CaptureCmd or telemetry.CaptureCmdString without collecting user data.
Search for existing methods and utilities (internal/exec, pkg/) before implementing new functionality; prefer reuse/refactoring over duplication.
Files:
pkg/auth/identities/aws/assume_role_test.gopkg/auth/providers/aws/sso_test.go
pkg/**/*_test.go
📄 CodeRabbit inference engine (CLAUDE.md)
Place unit tests for packages under pkg/ as *_test.go files.
Files:
pkg/auth/identities/aws/assume_role_test.gopkg/auth/providers/aws/sso_test.go
🧠 Learnings (1)
📚 Learning: 2025-10-11T23:25:09.201Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-11T23:25:09.201Z
Learning: Applies to **/*.go : All comments must end with periods across all Go code (godot linter enforced).
Applied to files:
pkg/auth/providers/aws/sso_test.go
🧬 Code graph analysis (2)
pkg/auth/identities/aws/assume_role_test.go (3)
pkg/schema/schema_auth.go (1)
IdentityVia(42-45)pkg/auth/identities/aws/assume_role.go (1)
NewAssumeRoleIdentity(108-123)pkg/auth/types/aws_credentials.go (1)
AWSCredentials(11-18)
pkg/auth/providers/aws/sso_test.go (1)
pkg/auth/providers/aws/sso.go (1)
NewSSOProvider(36-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Run pre-commit hooks
- GitHub Check: Analyze (go)
- GitHub Check: Lint (golangci)
- GitHub Check: Summary
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (4)
pkg/auth/identities/aws/assume_role_test.go (4)
347-347: Missing trailing period (already flagged).This comment needs a period at the end to satisfy the godot linter.
382-382: Missing trailing period (already flagged).Add a period to satisfy the godot linter.
401-401: Missing trailing period (already flagged).End the comment with a period.
439-439: Missing trailing period (already flagged).Add a period to the comment.
🧹 Nitpick comments (2)
pkg/auth/providers/aws/sso_test.go (2)
230-236: Consider verifying the actual resolver URL value.The test asserts that
config.Spec["aws"]exists but doesn't verify the nestedresolver.urlvalue. Since the test is specifically about custom resolver configuration, validate the complete structure:// Verify the provider has the config with resolver. assert.NotNil(t, p.config) assert.NotNil(t, p.config.Spec) awsSpec, ok := p.config.Spec["aws"] assert.True(t, ok) assert.NotNil(t, awsSpec) + + // Verify resolver URL is preserved. + awsMap, ok := awsSpec.(map[string]interface{}) + require.True(t, ok) + resolverSpec, ok := awsMap["resolver"] + require.True(t, ok) + resolverMap, ok := resolverSpec.(map[string]interface{}) + require.True(t, ok) + assert.Equal(t, "http://localhost:4566", resolverMap["url"])
238-253: Test overlap with existing coverage.This test overlaps with existing validation tests (e.g.,
TestSSOProvider_Validate_Simpleat lines 69-81). Since absence of resolver config is the default case already covered, consider either merging this into a table-driven test with the custom resolver case or removing it to reduce duplication.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
pkg/auth/identities/aws/assume_role_test.go(1 hunks)pkg/auth/providers/aws/sso_test.go(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
pkg/**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Place business logic in pkg rather than in cmd
Files:
pkg/auth/providers/aws/sso_test.gopkg/auth/identities/aws/assume_role_test.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios
**/*_test.go: Write unit tests as table-driven tests focused on behavior; prefer high coverage for pkg/ and internal/exec/; comments must end with periods.
Use t.Skipf with a reason instead of t.Skip; never skip without a reason.
Test files must mirror implementation file names (e.g., aws_ssm_store_test.go pairs with aws_ssm_store.go).
Files:
pkg/auth/providers/aws/sso_test.gopkg/auth/identities/aws/assume_role_test.go
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments
**/*.go: All comments must end with periods across all Go code (godot linter enforced).
Organize imports into three groups (stdlib, 3rd-party, Atmos) separated by blank lines and sorted alphabetically within groups; preserve existing aliases.
Add defer perf.Track(<atmosConfig|nil>, ".")() at the start of all public and critical private functions, followed by a blank line.
All errors must be wrapped using static errors from errors/errors.go; prefer errors.Join for multiple errors, fmt.Errorf with %w for context, and check with errors.Is; never use dynamic errors directly.
Use utils.PrintfMarkdown() to render embedded markdown examples for CLI help output.
Co-locate unit tests with implementation files; integration tests reside under tests/.
Distinguish UI output from logging: UI prompts/status/errors to stderr; data/results to stdout; logging for system/debug info only with structured fields.
Most text UI must go to stderr; only data/results to stdout. Prefer utils.PrintfMessageToTUI for UI messages.
Bind all environment variables with viper.BindEnv(); every env var must have an ATMOS_ alternative binding.
Favor cross-platform code: prefer SDKs over external binaries, use filepath/os/runtime, and handle OS-specific differences or use build tags.
For non-standard execution paths, capture telemetry using telemetry.CaptureCmd or telemetry.CaptureCmdString without collecting user data.
Search for existing methods and utilities (internal/exec, pkg/) before implementing new functionality; prefer reuse/refactoring over duplication.
Files:
pkg/auth/providers/aws/sso_test.gopkg/auth/identities/aws/assume_role_test.go
pkg/**/*_test.go
📄 CodeRabbit inference engine (CLAUDE.md)
Place unit tests for packages under pkg/ as *_test.go files.
Files:
pkg/auth/providers/aws/sso_test.gopkg/auth/identities/aws/assume_role_test.go
🧠 Learnings (2)
📚 Learning: 2025-10-11T23:25:09.224Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-11T23:25:09.224Z
Learning: Applies to **/*.go : All comments must end with periods across all Go code (godot linter enforced).
Applied to files:
pkg/auth/providers/aws/sso_test.gopkg/auth/identities/aws/assume_role_test.go
📚 Learning: 2025-10-11T23:25:09.224Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-11T23:25:09.224Z
Learning: Do not bypass pre-commit hooks; fix lint issues and ensure make lint passes before committing.
Applied to files:
pkg/auth/providers/aws/sso_test.go
🧬 Code graph analysis (2)
pkg/auth/providers/aws/sso_test.go (1)
pkg/auth/providers/aws/sso.go (1)
NewSSOProvider(36-58)
pkg/auth/identities/aws/assume_role_test.go (3)
pkg/schema/schema_auth.go (1)
IdentityVia(42-45)pkg/auth/identities/aws/assume_role.go (1)
NewAssumeRoleIdentity(108-123)pkg/auth/types/aws_credentials.go (1)
AWSCredentials(11-18)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Build (macos-latest, macos)
- GitHub Check: Analyze (go)
- GitHub Check: Lint (golangci)
- GitHub Check: Summary
🔇 Additional comments (5)
pkg/auth/identities/aws/assume_role_test.go (5)
348-379: Well-structured test for custom resolver.The test correctly verifies that an identity with a custom resolver configuration can be created and that the resolver config is accessible in the credentials map.
383-398: Solid negative test case.Confirms the identity functions correctly without a custom resolver, which is important for backward compatibility.
402-436: Appropriate unit test coverage.Verifies that newSTSClient can be created with a custom resolver configuration without errors. The actual resolver endpoint usage would be an integration test concern.
440-467: Good baseline test.Ensures the default behavior (no custom resolver) continues to work as expected.
469-534: Excellent table-driven test for region resolution.The test comprehensively covers the region resolution logic with clear, well-structured test cases. Validates that the region is correctly resolved and persisted on the identity object.
|
These changes were released in v1.195.0-test.0. |
what
why
Summary by CodeRabbit
New Features
Documentation
Tests
Examples