Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: allow specifying keys that might not be implemented for CUE_EXPERIMENT #3756

Open
rogpeppe opened this issue Feb 14, 2025 · 0 comments
Labels
FeatureRequest New feature or request

Comments

@rogpeppe
Copy link
Member

In #3689, it's stated that failing when CUE_EXPERIMENT contains unknown keys is a problem:

As @mpvl points out, this is potentially a problem, because being able to enable or disable a number of experiments across CUE versions - even if some very old or very new versions do not support them - is useful to compare behavior, such as when investigating or bisecting bugs.

However, it seems to me that this is only a problem in this specific kind of situation.
In most other situations, it's actually good that we fail on unknown keys because
setting CUE_EXPERIMENT indicates an intention and if something is misspelled,
that's almost certainly an error.

I suggest that when we want this kind of behaviour (not failing on unknown keys), we will always know that
we want this behaviour and are in a position to do something slightly different to work around the error.

I propose that we support a special syntax that indicates that a given key should not
result in an error when it's unknown. It would still result in an error if an invalid
value is specified for a key that is recognized.

Straw-man syntax: a ? after the key:

Examples:

# Do not fail if evalv3 is not recognized but _do_ fail if embed is not.
CUE_EXPERIMENT='evalv3?,embed=1'

# Do not fail if embed is not recognized, but _do_ fail if
# embed is recognized but is not allowed to be set to false.
CUE_EXPERIMENT='embed?=0'

We might also support a mode that allows unrecognized values for known keys too, say ??:

# Set embed to false or ignore if false is not allowed.
CUE_EXPERIMENT=`embed??=1`
@rogpeppe rogpeppe added the FeatureRequest New feature or request label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant