feat(competitions): add host-add command - #1168
Conversation
Wire the SDK's AddCompetitionHost endpoint up as `kaggle competitions host-add <comp> -u <user>`, granting host access on a competition to another Kaggle user. Named `host-add` rather than `hosts add` because `hosts` takes the competition as a positional argument, and argparse cannot distinguish a competition slug from a subcommand token. Making `hosts` a subcommand group would break the existing `kaggle competitions hosts <comp>` form (the same limitation already affects `competitions pages <comp>`), so the flat hyphenated spelling matches submission-download and team-submissions instead. Granting host access is a permission change, so it prompts for confirmation by default, with -y to skip for scripting.
…-add # Conflicts: # CHANGELOG.md
|
Hi @bovard 1. Confirmation prompt test I noticed that the tests verify that 2. Success message One thing I was curious about is the success message:
Do we know how the backend behaves if the specified user is already a host? If the API treats that as an idempotent operation and still returns success, the message might imply that a new host was added even though nothing actually changed. Just wanted to check if that behavior has already been considered. Overall, I think this is a clean implementation and the tests cover the happy path really well. |
|
thanks @sridipbasu I'll update the test |
…-add # Conflicts: # CHANGELOG.md
The existing test only checked that confirmation() was called. Since this command grants host access, also assert the prompt names the exact user and competition, so an interpolation mistake can't slip through.
Wire the SDK's AddCompetitionHost endpoint up as
kaggle competitions host-add <comp> -u <user>, granting host access on a competition to another Kaggle user.Named
host-addrather thanhosts addbecausehoststakes the competition as a positional argument, and argparse cannot distinguish a competition slug from a subcommand token. Makinghostsa subcommand group would break the existingkaggle competitions hosts <comp>form (the same limitation already affectscompetitions pages <comp>), so the flat hyphenated spelling matches submission-download and team-submissions instead.Granting host access is a permission change, so it prompts for confirmation by default, with -y to skip for scripting.