CLI: Validate strict in verdi config set caching.disabled_for
#6197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Values provided for
verdi config set caching.disabled_for
andverdi config set caching.enabled_for
were validated, but without settingstrict=True
for the_validate_identifier_pattern
validator. This keyword was recently added (b9144bb) and when set toTrue
would actually attempt to load the entry point or import path.Without this strict validation, a user could accidentally set an incorrect value to enable or disable caching for. Most common example is where a correct entry point was provided but without the entry point group, e.g.,
core.arithmetic.add
. The validator would interpret this as an import path and not as an entry point, and since strict validation was turned off, it didn't attempt to actually import it.The
strict
validation is now turned on causing the example above to return a validation error. The downside of this approach is that it is no longer possible to disable or enable caching for an entry point or import path that cannot be loaded in the current environment. But then again, the question is what the use would be of such a use-case.