[mesheryctl] Move environments commands to v1beta3 and display the new purpose designation
Current Behavior
meshery/schemas is adding a first-class purpose property to the Environment construct (v1beta3). It designates what an environment exists for:
| Value | Meaning |
|---|---|
user |
An ordinary environment. People create these to logically group Connections and their Credentials. |
administrative |
An environment the platform provisions to hold organization-level configuration. Resolvers of that configuration trust it. |
| absent | Identical to user. Every environment that predates the property is in this state. |
The property is not client-settable. It is absent from EnvironmentPayload - the schema every POST/PUT requestBody references. Permission to create an environment must not confer the ability to make one administrative.
Two things follow for mesheryctl.
1. It is on the superseded schema version. mesheryctl/internal/cli/root/environments/{create,list,view,environment}.go import github.com/meshery/schemas/models/v1beta1/environment. That version is marked x-deprecated with x-superseded-by: v1beta3, and the new property is defined on v1beta3 only - so mesheryctl cannot see it at all until it moves. The rest of the ecosystem (Meshery Server, the remote provider) is already on v1beta3.
2. Its output does not show the designation. mesheryctl environment list prints ID, Name, Organization ID, Description, Created At, Updated At (list.go), and view prints the environment without it, so an administrative environment is indistinguishable from an ordinary one at the command line.
Full contract: docs/environment-purpose-contract.md in meshery/schemas.
Desired Behavior
Move the environments commands to
github.com/meshery/schemas/models/v1beta3/environment. Note thatv1beta3publishes camelCase on the wire (organizationId,createdAt) wherev1beta1published snake_case, so any place that renders or parses those keys needs checking alongside the import change.Show the purpose. Add it to
mesheryctl environment view, and tolistif the column budget allows. Render an absent value asuserrather than as blank - absent andusermean the same thing, and a blank cell reads as missing data.Expose no flag that sets it.
environment createtakes--orgId,--name,--description(create.go). Do not add a--purposeor equivalent, and do not pass one through from a file-based payload if one is ever added.Read the value with a positive test. Compare against
environment.EnvironmentPurposeAdministrative, or callEnvironment.IsAdministrative(). Do not test for "notuser": the property is optional and absent for every environment that predates it, so a negative test renders those as administrative.Extend the golden files under
mesheryctl/internal/cli/root/environments/testdataandfixturesto cover an administrative environment and one with the property absent.
Additional context
Blocked on the @meshery/schemas release that carries Environment.purpose. Companion issues cover Meshery Server and Meshery UI.
Source: meshery/meshery