Repository navigation
fix(auth): honor --org/--project in auth status and auth env - #319
Conversation
|
PR Author Agent⚡ 👋 I've got this PR. |
| r := statusResult{Source: anticipatedSource, Profile: profileName(anticipatedSource)} | ||
|
|
||
| resolved, loadErr := auth.Load(profileFlag) | ||
| resolved, loadErr := auth.LoadWithOverrides(profileFlag, orgFlag, projectFlag) |
There was a problem hiding this comment.
When a saved profile exists but its credentials are missing or unreadable, LoadWithOverrides returns before applying the flags, and runStatusChecks falls back to populateKnownProfileFields, which restores the saved org/project. In that diagnostic path, auth status --project other-project still reports the profile's original project (including in JSON), silently ignoring the requested override.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
There was a problem hiding this comment.
PR Author Agent⚡
Good catch. populateKnownProfileFields now takes the org/project overrides and applies them over the saved profile values, so --project is honored on the credential-failure path too (0968d75). Added a test covering no overrides, both overrides, and project-only.
Fixes #321
Problem
harness auth status --project Xignored the flag and reported the profile's saved project;auth envhad the same gap.Solution
Add
auth.LoadWithOverrides(Load + org/project overrides, no validation) and haveResolveWithOverridesbuild on it.auth statusandauth envnow use it; otherLoadcallers (token,sso,debug ssolog) don't use scope and are unchanged.