Repository navigation
fix(ENG-15482): show rate limits when the API leaves out a value - #581
Merged
Merged
Conversation
The SDK sets each field that the API leaves out to None, so the "key in data" checks were always true. float(None) then stopped `cloudsmith check rates` with TypeError. Fixes CLOUDSMITH-CLI-1V Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the fix to null rate-limit handling.
No open issues 🎉
What changed in this PR
Fixes cloudsmith check rates crashing when the API omits rate-limit values that the SDK represents as None.
Changes:
- Skip conversions for missing or null values while preserving the
remaining == 0fallback for throttled status. - Add a regression test covering null fields.
- Document the fix in the changelog.
| File | Description |
|---|---|
cloudsmith_cli/core/tests/test_ratelimits.py |
Tests null-field handling and the throttled fallback. |
cloudsmith_cli/core/ratelimits.py |
Guards conversions against None values. |
CHANGELOG.md |
Records the rate-limit display fix. |
Review effort: Balanced
cloudsmith-iduffy
marked this pull request as ready for review
November 2, 2026 13:25
Collaborator
Author
|
@copilot resolve the merge conflicts in this pull request |
…ts-null # Conflicts: # CHANGELOG.md Co-authored-by: cloudsmith-iduffy <178375997+cloudsmith-iduffy@users.noreply.github.com>
Contributor
coillteoir
approved these changes
Nov 3, 2026
cloudsmith-iduffy
enabled auto-merge (squash)
November 3, 2026 14:53
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.
Description
Sentry CLOUDSMITH-CLI-1V is a
TypeErrorfromcloudsmith check rateson 1.30.1:float() argument must be a string or a real number, not 'NoneType'.get_rate_limits()turns the SDK response into a dict withto_dict(). The SDK model puts every field in that dict, and sets a field that the API leaves out toNone:RateLimitsInfo.from_dictchecked"interval" in data, which is always true for this dict, and then calledfloat(None). Each check is nowdata.get(key) is not None, so a missing value staysNone. The table showsNonefor it, as it already does when the rate limit headers are missing.throttledstill falls back toremaining == 0.Linear: ENG-15482. Fixes CLOUDSMITH-CLI-1V
Type of Change
Additional Notes
The patch in ENG-15482 was correct. This PR keeps its fix and cuts the tests to the one case that fails before the fix.
🤖 Generated with Claude Code