fix: parse whole-second protobuf duration strings like 0s#58
Open
aadi-joshi wants to merge 1 commit into
Open
Conversation
Needs manual sync with the kapigen base.
2 tasks
aadi-joshi
added a commit
to aadi-joshi/kaggle-cli
that referenced
this pull request
Jun 30, 2026
Related to Kaggle#1064. Duration parsing fix is in Kaggle/kaggle-sdk-python#58.
Author
|
Following up on stevemessick's guidance in Kaggle/kaggle-cli#1082. Marked for manual sync with the kapigen base. The auth portion of Kaggle/kaggle-cli#1064 is handled separately in #1082. |
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
Fix
TimeDeltaSerializer._from_dict_valueto accept protobuf JSON duration strings without a fractional component (e.g.0s,151s). The current implementation always splits on., which crashes quota and other API responses that return whole-second durations.Needs manual sync with the kapigen base.
Root cause
Protobuf JSON allows whole-second values like
0s. When.split(".")returns one element, unpacking fails withValueError: not enough values to unpack (expected 2, got 1).Reported in Kaggle/kaggle-cli#1064.
Tests
Added
TimeDeltaSerializerTestsinkaggle_object_tests.py:0s,151s)151.500s) regressionApiGetAcceleratorQuotaStatisticsResponseJSON deserializationTest plan
TimeDeltaSerializer._from_dict_value("0s")returnstimedelta(0)python -m unittest kaggle_object_tests.TimeDeltaSerializerTests