Skip to content

feat(competitions): add host-add command - #1168

Merged
bovard merged 4 commits into
mainfrom
feat/competition-host-add
Aug 11, 2026
Merged

feat(competitions): add host-add command#1168
bovard merged 4 commits into
mainfrom
feat/competition-host-add

Conversation

@bovard

@bovard bovard commented Aug 7, 2026

Copy link
Copy Markdown
Member

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.

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.
@bovard
bovard requested a review from stevemessick August 7, 2026 22:30
@sridipbasu

Copy link
Copy Markdown
Contributor

Hi @bovard
I’m an external reviewer. You might have seen me around on a few other Kaggle CLI PRs. Thanks for working on this feature I went through the implementation and had a couple of thoughts that I wanted to share.

1. Confirmation prompt test

I noticed that the tests verify that confirmation() is called, but they don't check the actual prompt text. Since this command grants host access, I was wondering if it would be worth asserting that the prompt contains the correct competition and username as well. It feels like a small addition that could help catch accidental interpolation mistakes in the future.

2. Success message

One thing I was curious about is the success message:

User 'X' added as a host of competition 'Y'.

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.

@bovard

bovard commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

thanks @sridipbasu I'll update the test

bovard added 2 commits August 11, 2026 17:43
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.
@bovard
bovard merged commit a7f227e into main Aug 11, 2026
15 checks passed
@bovard
bovard deleted the feat/competition-host-add branch August 11, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants