Fix argparse conflict for duplicate TypedDict field short aliases#433
Open
wirjo wants to merge 1 commit intoeval-protocol:mainfrom
Open
Fix argparse conflict for duplicate TypedDict field short aliases#433wirjo wants to merge 1 commit intoeval-protocol:mainfrom
wirjo wants to merge 1 commit intoeval-protocol:mainfrom
Conversation
When multiple TypedDicts in a function signature share the same field name (e.g. credentials_secret in both aws_s3_config and azure_blob_storage_config), the CLI auto-generation creates duplicate short flags (--credentials-secret), causing an argparse error. Track registered flags and only add the short alias if it hasn't already been claimed by a previous TypedDict field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
argparse.ArgumentErrorwhen multiple TypedDicts in a function signature share the same field name (e.g.credentials_secretin bothaws_s3_configandazure_blob_storage_config)add_args_from_callable_signaturecreates a short alias--{field_kebab}for every TypedDict field. When two TypedDicts have the same field name, the short alias collides causing:ArgumentError: argument --azure-blob-storage-config-credentials-secret/--credentials-secret: conflicting option string: --credentials-secretTest plan
eval-protocol create rft --helpworks without argparse errorseval-protocol create rftwith full arguments runs through the complete flow (local test, evaluator upload, dataset transform)--credentials-secretmaps toaws_s3_config.credentials_secret)--azure-blob-storage-config-credentials-secret)🤖 Generated with Claude Code
Note
Low Risk
Small, localized change to CLI flag generation that reduces conflicts; main risk is subtle alias/precedence changes when duplicate field names exist.
Overview
Prevents
argparse.ArgumentErrorwhen auto-generating CLI flags from callables whose signature includes multipleTypedDictparameters with overlapping field names.add_args_from_callable_signaturenow tracks already-registered option strings and only adds the unprefixed short alias (e.g.--credentials-secret) for the first occurrence, while always registering the fully-prefixed flag (e.g.--azure-blob-storage-config-credentials-secret).Written by Cursor Bugbot for commit db7f8bd. This will update automatically on new commits. Configure here.