Commit 210a8e7
authored
fix(cli): stop treating subcommand -v as version flag (#1082)
## Summary
Fix `_is_help_or_version_command` so subcommand `-v` (the CSV output
alias on commands like `quota`) no longer skips authentication.
Top-level `kaggle -v` / `kaggle --version` still 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 joins `sys.argv[1:]` into a
string. `"quota -v".endswith("-v")` matched the global version check
even though `-v` here is the CSV flag, causing unauthenticated API calls
and 401s.
## Tests
Added `tests/unit/test_help_version_auth.py` covering top-level
version/help, subcommand CSV `-v`, and subcommand help.
## Test plan
- [x] `pytest tests/unit/test_help_version_auth.py`
- [ ] Maintainer: please run `/gcbrun` for Cloud Build (fork PR)
Related to #10641 parent bb1228c commit 210a8e7
2 files changed
Lines changed: 51 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1167 | 1167 | | |
1168 | 1168 | | |
1169 | 1169 | | |
1170 | | - | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
1171 | 1179 | | |
1172 | 1180 | | |
1173 | 1181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
0 commit comments