Skip to content

Inconsistent default scope across rad * list commands #11902

@zachcasper

Description

@zachcasper

Summary

The various rad * list commands return data from inconsistent scopes. Some list within the current workspace's default resource group only, some list across the entire plane (all resource groups), and some require an environment. The flag semantics (--group, --environment, --workspace) also differ between commands. This makes the CLI surprising to use — a user running rad app list and rad recipe-pack list on the same workspace will see results computed against different scopes, with no indication in the output of which scope was used.

This issue proposes making the default scope, supported scope-override flags, and output behavior consistent across all rad * list commands.

Current behavior

The table below summarizes every rad * list command, what it lists by default, and which scope flags it accepts.

Command Default scope Flags accepted Source
rad app list Default resource group (workspace.Scope) only --group/-g, --workspace/-w pkg/cli/cmd/app/list/list.go
rad env list Default resource group only --group/-g, --workspace/-w pkg/cli/cmd/env/list/list.go
rad resource list <type> Default resource group only (optionally filtered by --application) --application/-a, --group/-g, --workspace/-w pkg/cli/cmd/resource/list/list.go
rad group list Plane (always lists all groups in the plane) --workspace/-w pkg/cli/cmd/group/list/list.go
rad workspace list Local rad config only (no remote query) none pkg/cli/cmd/workspace/list/list.go
rad recipe list Single environment (requires --environment or default env) --environment/-e, --group/-g, --workspace/-w pkg/cli/cmd/recipe/list/list.go
rad recipe-pack list Plane (all resource groups) by default; passing --group narrows to a single group --group/-g, --workspace/-w pkg/cli/cmd/recipepack/list/list.go
rad credential list Plane (cloud provider credentials are plane-scoped) --workspace/-w pkg/cli/cmd/credential/list/list.go
rad resource-type list Plane (resource types are plane-scoped) --workspace/-w pkg/cli/cmd/resourcetype/list/list.go
rad resource-provider list Plane (resource providers are plane-scoped) --workspace/-w pkg/cli/cmd/resourceprovider/list/list.go

How the default scope is resolved today

For commands that accept --group, the resolution path is:

  1. cli.RequireWorkspace loads the current workspace from rad config (overridable via --workspace).
  2. cli.RequireScope reads --group; if unset, it uses workspace.Scope (the workspace's default resource group). See pkg/cli/cmd/app/list/list.go, pkg/cli/cmd/env/list/list.go, pkg/cli/cmd/resource/list/list.go.
  3. The management client is constructed with RootScope = workspace.Scope, e.g. /planes/radius/local/resourceGroups/<group>. See pkg/cli/connections/factory.go.
  4. List operations call NewListByScopePager against that root scope, so they only return resources in that one group.

For example, ListApplications and ListEnvironments both call the resource-group-scoped pager:

A separate method ListEnvironmentsAll exists (pkg/cli/clients/management.go) which truncates the scope to the plane and lists across all groups, but it is not wired into rad env list.

rad recipe-pack list is the only data-resource list command that defaults to plane scope and only narrows on --group, calling either ListRecipePacks or ListRecipePacksInResourceGroup based on whether the flag was set (pkg/cli/cmd/recipepack/list/list.go).

Inconsistencies

  1. Different defaults for the same kind of resource (group-scoped vs. plane-scoped):

    • rad app list, rad env list, and rad resource list default to the current resource group only.
    • rad recipe-pack list defaults to all resource groups in the plane.
    • All four resources are group-scoped resources, so the choice of default differs across commands of the same shape.
  2. Inverse semantics of --group:

    • On rad app list / rad env list / rad resource list, --group overrides the default group, but the command is still single-group.
    • On rad recipe-pack list, --group is what narrows an otherwise plane-wide listing to a single group.
    • These are opposite meanings for the same flag.
  3. A "list across all groups" option does not exist for app/env/resource list:

    • ListEnvironmentsAll already exists in the management client but is not exposed via the CLI.
    • There is no equivalent for applications or generic resources, even though the most common Radius user question — "what's deployed on this cluster?" — is plane-wide.
  4. rad recipe list uses a different scoping model entirely: It is scoped to an environment (--environment), not a resource group, even though recipes are themselves stored as part of an environment resource. This is correct for the data model, but means users have to remember which list commands are group-scoped, plane-scoped, or environment-scoped.

  5. Output does not indicate the scope that was queried. Users cannot tell from the output of rad app list whether they are seeing all applications in the plane or only those in one group. The resource group column is not consistently shown.

  6. Flag set is inconsistent:

    • rad resource list accepts --application but not --environment, even though ListResourcesOfTypeInEnvironment exists server-side.
    • rad recipe-pack list declares a Group field on its runner and reads --group twice (once directly, once through RequireScope), unlike the other commands.

Proposal

Adopt a single, consistent model for all rad * list commands that operate on group-scoped resources (app, env, resource, recipe-pack):

  • Default scope: plane-wide (all resource groups in the workspace's plane). This matches user intent for "show me everything" and matches how rad recipe-pack list, rad group list, rad credential list, rad resource-type list, and rad resource-provider list already behave.
  • --group/-g: narrows the listing to a single resource group. Same meaning everywhere.
  • --workspace/-w: selects the workspace (and therefore the plane). Same meaning everywhere.
  • Output: always include a RESOURCE GROUP column in table output for group-scoped resources so the scope of each row is unambiguous.
  • rad resource list: additionally accept --environment/-e (parallel to existing --application/-a), since the server-side ListResourcesOfTypeInEnvironment method already exists.
  • rad recipe list: keep environment-scoped (this matches the data model), but accept --group/-g only as a disambiguator for the environment lookup, not as a filter on the results.

This is a user-visible behavior change for rad app list, rad env list, and rad resource list (they would start returning results from all groups by default). A release note and migration guidance would be required.

Acceptance criteria

  • All group-scoped rad * list commands default to plane-wide scope.
  • --group/-g has consistent "narrow to one group" semantics everywhere it is accepted.
  • Table output for group-scoped resources includes the resource group column.
  • rad resource list accepts --environment/-e.
  • Tests in each command's package cover both default (plane-wide) and --group-scoped behavior.
  • Release notes call out the behavior change for rad app list, rad env list, and rad resource list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions