Skip to content

fix(cli): fix collaborator role handling in dataset metadata update#1138

Merged
stevemessick merged 1 commit into
Kaggle:mainfrom
sridipbasu:fix/dataset-collaborator-role
Jul 20, 2026
Merged

fix(cli): fix collaborator role handling in dataset metadata update#1138
stevemessick merged 1 commit into
Kaggle:mainfrom
sridipbasu:fix/dataset-collaborator-role

Conversation

@sridipbasu

Copy link
Copy Markdown
Contributor

Summary

kaggle datasets metadata --update crashes whenever dataset-metadata.json
contains collaborators. The CLI was passing the collaborator role directly as
a string (for example, "writer"), while the SDK expects a
CollaboratorType enum. This caused a TypeError before the request was sent.

Fix

Convert collaborator role strings to the corresponding
CollaboratorType enum using the existing lookup_enum() helper, keeping the
behavior consistent with other enum fields already handled by the CLI.

Tests

Added tests to verify that:

  • collaborator role strings are converted correctly
  • multiple collaborators are handled correctly
  • invalid collaborator roles raise an appropriate error

Ran:

pytest tests/unit/test_dataset_metadata_update.py

@sridipbasu

Copy link
Copy Markdown
Contributor Author

Attaching screenshots of the reproduction. The first shows the test dataset being created successfully and the metadata update command being run. The second shows the dataset-metadata.json used for reproduction. The CLI crashes locally with TypeError: role must be of type CollaboratorType before any request is sent to the API.

image Screenshot 2026-07-18 133727

@stevemessick

Copy link
Copy Markdown
Contributor

/gcbrun

@stevemessick stevemessick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@stevemessick
stevemessick merged commit 90370c0 into Kaggle:main Jul 20, 2026
12 checks passed
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.

2 participants