Skip to content

fix: resolve namespace from active profile config#8

Merged
phil-accelbyte merged 2 commits into
mainfrom
fix/namespace-resolves-from-profile-config
May 11, 2026
Merged

fix: resolve namespace from active profile config#8
phil-accelbyte merged 2 commits into
mainfrom
fix/namespace-resolves-from-profile-config

Conversation

@phil-accelbyte

Copy link
Copy Markdown
Collaborator

Summary

Service commands declaring --namespace as a required parameter were rejected by Clap even when the active profile had a namespace set:

❯ ags profile show
› Profile: default (active)
    Namespace   bjorn
    …

❯ ags ams images list
✕ The following required arguments were not provided:
  --namespace <namespace>

The early resolve_namespace used for Clap arg injection only checked the --namespace flag and AGS_NAMESPACE env var, so the profile-config fallback in ExecutionContext::resolve never got a chance to run — Clap failed first.

This change extends resolve_namespace to also load the active profile's config, matching the resolution order already used by ExecutionContext::resolve: --namespaceAGS_NAMESPACE → active profile config.

Test plan

  • Five unit tests in runtime::execution::tests cover the new fallback and the precedence guarantees (flag wins, env wins, explicit --profile, none-when-nothing-set)
  • Manual repro: profile with namespace = bjorn, no flag/env → ags ams images list --dry-run now resolves to /namespaces/bjorn/images
  • Manual override checks: --namespace flag-ns and AGS_NAMESPACE=env-ns still override the profile value
  • cargo clippy --all-targets -- -D warnings clean

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.
@phil-accelbyte
phil-accelbyte merged commit d6ee537 into main May 11, 2026
5 checks passed
@phil-accelbyte
phil-accelbyte deleted the fix/namespace-resolves-from-profile-config branch May 11, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant