fix(cli): reject options add_renamed_argument cannot alias - #24
Merged
Merged
Conversation
With required=True argparse checks each spelling separately, so the deprecated one could never satisfy the requirement. append and count build on the previous value, which DeprecatedAliasAction overwrites, so `--x a --y b` kept only b and `-v --verb` gave None. Raise a ValueError when such an option is added instead of misparsing later. No current caller uses either. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
add_renamed_argumentsilently misbehaved for two kinds of options:required=True: argparse checks required-ness per spelling, so--loglevel DEBUGstill fails withthe following arguments are required: --log-level.action="append"/"count"(and anything but the store actions):DeprecatedAliasActionoverwrites the value, so--x a --y bgives'b'and-v --verbgivesNone.Both now raise
ValueErrorwhen the option is added. I grepped every caller in~/repos/lobaro/(lob-cord, lob-fqf, lob-nrf-sx-gw4, lob-at); none passesrequiredor anactionother thanstore_true, so nothing breaks.New parametrised test fails on master for all three cases.
🤖 Generated with Claude Code