fix(auth): normalize ATMOS_IDENTITY=false (issue #1931)#1935
Conversation
…issue #1931) ## Summary Fix `ATMOS_IDENTITY=false` environment variable not working for disabling authentication. Previously, the literal string "false" was treated as an identity name, causing "identity not found" errors. Now boolean false representations ("false", "0", "no", "off") correctly disable authentication. ## Changes - Create shared `NormalizeIdentityValue()` function in `pkg/config/identity.go` - Fix bug in `internal/exec/cli_utils.go` to normalize env var before use - Add comprehensive tests for `ATMOS_IDENTITY=false` in `cli_utils_test.go` - Refactor duplicate normalization functions to use shared implementation ## Testing - All unit tests pass - Verified `ATMOS_IDENTITY=false`, `0`, `no`, `off` all disable authentication correctly - No regressions in existing tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR centralizes identity value normalization logic. A new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (7)
🧰 Additional context used📓 Path-based instructions (4)cmd/**/*.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/*.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/{pkg,internal,cmd}/**/*.go📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*_test.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
🧠 Learnings (39)📓 Common learnings📚 Learning: 2025-09-07T18:07:00.549ZApplied to files:
📚 Learning: 2025-12-13T04:37:40.435ZApplied to files:
📚 Learning: 2025-12-21T04:10:29.030ZApplied to files:
📚 Learning: 2025-12-13T06:10:25.156ZApplied to files:
📚 Learning: 2025-12-13T04:37:25.223ZApplied to files:
📚 Learning: 2025-12-13T03:21:35.786ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.698ZApplied to files:
📚 Learning: 2025-10-10T23:51:36.597ZApplied to files:
📚 Learning: 2024-12-07T16:16:13.038ZApplied to files:
📚 Learning: 2025-11-08T19:56:18.660ZApplied to files:
📚 Learning: 2024-12-11T18:40:12.808ZApplied to files:
📚 Learning: 2025-08-29T20:57:35.423ZApplied to files:
📚 Learning: 2025-04-23T15:02:50.246ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.698ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.698ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.698ZApplied to files:
📚 Learning: 2025-11-11T03:47:59.576ZApplied to files:
📚 Learning: 2025-11-11T03:47:45.878ZApplied to files:
📚 Learning: 2025-08-15T14:43:41.030ZApplied to files:
📚 Learning: 2025-08-16T23:33:07.477ZApplied to files:
📚 Learning: 2025-08-16T23:32:40.412ZApplied to files:
📚 Learning: 2024-10-23T21:36:40.262ZApplied to files:
📚 Learning: 2024-12-02T21:26:32.337ZApplied to files:
📚 Learning: 2025-07-05T20:59:02.914ZApplied to files:
📚 Learning: 2025-12-13T04:37:45.831ZApplied to files:
📚 Learning: 2025-02-18T13:18:53.146ZApplied to files:
📚 Learning: 2025-11-10T03:03:31.505ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-09-29T15:47:10.908ZApplied to files:
📚 Learning: 2025-01-09T22:37:01.004ZApplied to files:
🧬 Code graph analysis (7)cmd/identity_flag.go (1)
internal/exec/cli_utils.go (1)
pkg/config/identity_test.go (2)
pkg/config/identity.go (1)
cmd/list/utils.go (1)
internal/exec/cli_utils_test.go (1)
pkg/flags/global_registry.go (1)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (7)
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 |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1935 +/- ##
=======================================
Coverage 74.03% 74.04%
=======================================
Files 769 770 +1
Lines 69336 69326 -10
=======================================
- Hits 51334 51332 -2
+ Misses 14592 14585 -7
+ Partials 3410 3409 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
These changes were released in v1.204.0-rc.3. |
what
ATMOS_IDENTITY=falsenot being recognized in the legacyProcessCommandLineArgs()code pathNormalizeIdentityValue()function inpkg/config/identity.goto centralize normalization logicATMOS_IDENTITY=false,0,no,offincli_utils_test.gonormalizeIdentityValue()functions to use shared implementationwhy
PR #1900 fixed
ATMOS_IDENTITY=falsenormalization for the flag parsing path (pkg/flags/global_registry.go), but missed a separate code path ininternal/exec/cli_utils.gothat readsATMOS_IDENTITYdirectly viaos.Getenv().Two independent code paths exist:
pkg/flags/global_registry.go): Used by Cobra commands with proper global flag inheritance - ✅ Fixed in PR Fix ATMOS_IDENTITY=false not working (issue #1898) #1900internal/exec/cli_utils.go:ProcessCommandLineArgs()): Used by terraform commands - ❌ Not fixed until this PRThe legacy path was added in PR #1720 (Oct 2025) without normalization. When PR #1900 fixed the flag path (Dec 2025), this code path was missed, causing the regression reported in issue #1931.
Verified with user's reproduction case:
Note: This class of problems (duplicate code paths for auth handling) should be eliminated by #1919, which refactors Atmos auth to use the command registry pattern. Once that lands, there will be a single, unified code path for identity/auth handling across all commands.
references
Closes #1931
Related: #1900 (partial fix), #1720 (introduced the unfixed code path), #1919 (architectural fix to prevent this class of bugs)
Summary by CodeRabbit
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.