Skip to content

fix: list_kernel_files returns 0 files (issue #51)#52

Closed
1chooo wants to merge 1 commit into
Kaggle:mainfrom
1chooo:fix/list-kernel-files-returns-zero
Closed

fix: list_kernel_files returns 0 files (issue #51)#52
1chooo wants to merge 1 commit into
Kaggle:mainfrom
1chooo:fix/list-kernel-files-returns-zero

Conversation

@1chooo

@1chooo 1chooo commented Jun 27, 2026

Copy link
Copy Markdown

Summary

  • Root cause 1 — wrong API: list_kernel_files returns kernel source files, not run output artifacts. Users expecting output files (CSVs, model weights, etc.) should use list_kernel_session_output instead. Added clear docstrings to both methods and both request types explaining the distinction.
  • Root cause 2 — silent empty response: user_name and kernel_slug default to "" and are silently omitted from the request body, causing the server to return "files": [] with no error. Both methods now raise ValueError with a descriptive message (including a pointer to the correct API) when either field is missing.
  • Root cause 3 — latent crash on null response: If the server ever returns "files": null, set_from_dict in kaggle_object.py would crash with TypeError inside ListSerializer. None is now treated the same as the default empty list.

Test plan

  • Call list_kernel_files without setting user_name/kernel_slug — expect ValueError with a message mentioning list_kernel_session_output.
  • Call list_kernel_session_output without setting user_name/kernel_slug — expect ValueError with a message mentioning list_kernel_files.
  • Call list_kernel_files with valid user_name and kernel_slug — expect normal file list response.
  • Simulate a server response with "files": null — expect empty list, no crash.

Closes #51

Made with Cursor

@google-cla

google-cla Bot commented Jun 27, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Three root causes addressed:

1. Silent empty response when user_name/kernel_slug are omitted — add
   ValueError in list_kernel_files and list_kernel_session_output when
   either required field is missing, with a hint pointing to the correct
   API.

2. API confusion — list_kernel_files returns kernel source files, not
   run output artifacts. Add docstrings to both methods and both request
   types making this distinction explicit and cross-referencing each other.

3. Latent crash on `"files": null` in server response — set_from_dict
   in kaggle_object.py now treats None values the same as the default,
   preventing a TypeError from ListSerializer trying to iterate None.

Fixes Kaggle#51

Co-authored-by: Cursor <cursoragent@cursor.com>
@1chooo 1chooo force-pushed the fix/list-kernel-files-returns-zero branch from 9194157 to aa61b83 Compare June 27, 2026 22:50
@1chooo

1chooo commented Jun 27, 2026

Copy link
Copy Markdown
Author

Closing in favour of a fresh PR.

@1chooo 1chooo closed this Jun 27, 2026
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.

Kernel List Files Return 0 file

1 participant