fix: list_kernel_files returns 0 files (issue #51)#54
Open
1chooo wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
list_kernel_filesreturns kernel source files, not run output artifacts. Users expecting output files (CSVs, model weights, etc.) should uselist_kernel_session_outputinstead. Added clear docstrings to both methods and both request types explaining the distinction.user_nameandkernel_slugdefault to""and are silently omitted from the request body, causing the server to return"files": []with no error. Both methods now raiseValueErrorwith a descriptive message (including a pointer to the correct API) when either field is missing.nullresponse: If the server ever returns"files": null,set_from_dictinkaggle_object.pywould crash withTypeErrorinsideListSerializer.Noneis now treated the same as the default empty list.Test plan
list_kernel_fileswithout settinguser_name/kernel_slug— expectValueErrorwith a message mentioninglist_kernel_session_output.list_kernel_session_outputwithout settinguser_name/kernel_slug— expectValueErrorwith a message mentioninglist_kernel_files.list_kernel_fileswith validuser_nameandkernel_slug— expect normal file list response."files": null— expect empty list, no crash.Closes #51
Made with Cursor