Skip to content

fix(cli): avoid success message after cancelled dataset deletion#1073

Open
sridipbasu wants to merge 1 commit into
Kaggle:mainfrom
sridipbasu:fix-dataset-delete-cancel-message
Open

fix(cli): avoid success message after cancelled dataset deletion#1073
sridipbasu wants to merge 1 commit into
Kaggle:mainfrom
sridipbasu:fix-dataset-delete-cancel-message

Conversation

@sridipbasu

Copy link
Copy Markdown
Contributor

Summary

Fixes a bug in the dataset deletion CLI where a success message was printed even when the user cancelled the deletion confirmation.

Problem

When running:

kaggle datasets delete <owner>/<dataset>

and responding no to the confirmation prompt, the CLI printed:

Deletion cancelled
Dataset "<owner>/<dataset>" deleted successfully.

Although the deletion was cancelled, the success message was still displayed, resulting in misleading user feedback.

Root Cause

dataset_delete() returned after printing Deletion cancelled, but dataset_delete_cli() always printed the success message without checking whether the deletion had actually proceeded.

Solution

  • Updated dataset_delete() to return whether the deletion was executed.
  • Updated dataset_delete_cli() to print the success message only when the deletion completed successfully.

This change only affects the dataset deletion flow and does not modify the deletion logic itself.

Testing

Manual

  • Created a temporary private dataset.
  • Ran kaggle datasets delete <owner>/<dataset>.
  • Answered no at the confirmation prompt.
  • Verified that the dataset still existed.
  • Confirmed that the success message is no longer printed after cancellation.

Automated

  • Added unit tests covering:

    • cancellation path (success message is not printed)
    • successful deletion path (success message is printed)
  • Ran the new dataset deletion tests successfully.

  • Ran existing dataset-related unit tests to verify no regressions.

Before

Are you sure you want to delete the dataset: owner/dataset? [yes/no] no
Deletion cancelled
Dataset "owner/dataset" deleted successfully.

After

Are you sure you want to delete the dataset: owner/dataset? [yes/no] no
Deletion cancelled

Screenshot

A screenshot demonstrating the original incorrect behavior is attached for reference.

@sridipbasu

sridipbasu commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-06-25 160244

Here's the Screenshot which is attached

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.

1 participant