ion-cli icon indicating copy to clipboard operation
ion-cli copied to clipboard

Consider removing `beta` namespace

Open popematt opened this issue 1 year ago • 5 comments

I have been musing about a potential problem with the "beta" namespace. Namely, what do we want to do if, e.g. ion beta schema validate becomes stable, but there's a new, unstable command in the schema namespace.

  1. We could have two "schema" namespaces...
ion
 ├─ schema 
 │   └─ validate
 └─ beta
     └─ schema
         └─ transmogrify
  1. We could have two "beta" namespaces...
ion
 └─ schema 
     ├─ validate
     └─ beta
         └─ transmogrify
  1. We could fudge with the namespaces a bit so that "beta" is a pseudo-namespace and just has to appear somewhere in the command—i.e. so that ion beta schema transmogrify and ion schema beta transmogrify would be equivalent.

  2. We could do away with the "beta" namespace altogether, and have a "beta" (or other) prefix on the commands. E.g.:

ion
 └─ schema 
     ├─ validate
     └─ beta-transmogrify

I think I lean toward a command prefix so that we can just avoid having to choose between 1 & 2, and because the namespaces are generally grouping things by function, but the beta namespace is orthogonal to that by grouping by api stability. However, I think a shorter prefix (maybe x- as in ion schema x-transmogrify) would be sufficient to flag it as experimental.

popematt avatar Jun 14 '23 03:06 popematt

Has an option flag been considered?

For example:

ion --beta schema validate ...

Where the --beta (or --experimental?) flag would enable beta functionality but does not prevent production commands and sub-commands?

rmarrowstone avatar Jun 14 '23 20:06 rmarrowstone

Rather than a command prefix, we could make this an internal flag or configuration which only governs which commands show up. As long as the top level help overview has some helpful text like "include --all/--beta/--experimental to see experimental and porcelain commands" I think it would be good.

Then the commands would be ion schema validate and ion schema transmogrify.

Compare with git, which has a convention for not showing all plumbing or external commands in help enumeration unless specifically requested. Git's help documentation: https://git-scm.com/docs/git-help#_options

Specifically see the following options:

-a --all Prints all the available commands on the standard output.

--no-external-commands When used with --all, exclude the listing of external "git-*" commands found in the $PATH.

--no-aliases When used with --all, exclude the listing of configured aliases.

--verbose When used with --all print description for all recognized commands. This is the default.

jobarr-amzn avatar Jun 14 '23 20:06 jobarr-amzn

Offhand, I think I like the idea of a flag the best. (ion -x/ion --experimental?) I think that allows us slightly more granular opt-in to features. For example, a command could be stabilized but have new features that only work if -x has been specified.

# Access to an experimental top-level command
ion -x inspect file.ion

# Access to a (hypothetical) experimental tool in the `to` namespace
ion to -x parquet file.ion

# Access to an experimental feature in a stable command
ion dump -x --format obfuscated file.ion

I note that this doesn't address @popematt's use case of having a second experimental version of the same command.

--all is also an interesting idea, though I think we should keep it distinct from the --experimental flag as I think there are reasonable motivations for hiding commands even though they're stable. (External, low-level, unpopular, etc.)

zslayton avatar Jun 14 '23 20:06 zslayton

I note that this doesn't address @popematt's use case of having a second experimental version of the same command.

Actually, I think this does address my use cases, as long as we can model -x as a flag rather than as a namespace. I don't want people to have to remember what order to include the -x part, so something like ion -x to parquet and ion to -x parquet should both work or we could just say that the -x flag always comes right after ion and before anything else.

popematt avatar Jun 14 '23 21:06 popematt

We could probably use something similar tocargo test like following:

cargo test [options] [testname] [-- test-options]

If we choose to use something like this then we can have the -x or --experimental flag followed by -- and we don't have to worry about remembering the order of -x as it will always be distinguished by --.

desaikd avatar Jun 15 '23 16:06 desaikd