fix(cli): stop treating subcommand -v as version flag#1082
Conversation
|
could a maintainer please run the cloud build checks when convenient? happy to address any feedback. |
|
@aadi-joshi Thanks for the PR! I like the change to |
Per maintainer feedback on Kaggle#1082.
|
Thanks for the guidance! I removed the kagglesdk compat shim from this PR. It now only contains the -v auth fix. Opened the duration parsing fix in Kaggle/kaggle-sdk-python#58, marked for manual sync with the kapigen base. Happy to address any feedback on either PR. |
Related to Kaggle#1064. Duration parsing fix is in Kaggle/kaggle-sdk-python#58.
109633c to
844b88d
Compare
Summary
Fix
_is_help_or_version_commandso subcommand-v(the CSV output alias on commands likequota) no longer skips authentication. Top-levelkaggle -v/kaggle --versionstill skip auth as before.The duration parsing crash from #1064 is handled separately in Kaggle/kaggle-sdk-python#58 (needs kapigen sync and a new kagglesdk release).
Root cause
authenticate()runs before argparse and joinssys.argv[1:]into a string."quota -v".endswith("-v")matched the global version check even though-vhere is the CSV flag, causing unauthenticated API calls and 401s.Tests
Added
tests/unit/test_help_version_auth.pycovering top-level version/help, subcommand CSV-v, and subcommand help.Test plan
pytest tests/unit/test_help_version_auth.py/gcbrunfor Cloud Build (fork PR)Related to #1064