fix: resolve namespace from active profile config#8
Merged
Conversation
Service commands declaring --namespace as required were rejected by Clap even when the active profile had a namespace set. The early resolver used for Clap arg injection only checked the flag and AGS_NAMESPACE env var, so the profile-config fallback in ExecutionContext::resolve never got a chance to run — Clap failed first. Extend resolve_namespace to also load the active profile's config, matching the resolution order already used by ExecutionContext::resolve (flag -> env -> profile config). Add five unit tests covering the new fallback plus existing precedence guarantees.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Service commands declaring
--namespaceas a required parameter were rejected by Clap even when the active profile had a namespace set:The early
resolve_namespaceused for Clap arg injection only checked the--namespaceflag andAGS_NAMESPACEenv var, so the profile-config fallback inExecutionContext::resolvenever got a chance to run — Clap failed first.This change extends
resolve_namespaceto also load the active profile's config, matching the resolution order already used byExecutionContext::resolve:--namespace→AGS_NAMESPACE→ active profile config.Test plan
runtime::execution::testscover the new fallback and the precedence guarantees (flag wins, env wins, explicit--profile, none-when-nothing-set)namespace = bjorn, no flag/env →ags ams images list --dry-runnow resolves to/namespaces/bjorn/images--namespace flag-nsandAGS_NAMESPACE=env-nsstill override the profile valuecargo clippy --all-targets -- -D warningsclean