fix: handle null usage resets and spinner sizing#21
Merged
Conversation
Claude can return resets_at: null for usage windows that have no current consumption. The mapper previously treated that valid response as an invalid payload and blocked refresh entirely. Use the relevant window duration as a fallback while preserving strict failure for malformed non-null dates, and cover both paths in UsageServiceTests. Adapted from PR #18 by Jean Friesewinkel, with additional issue context from PR #13 by Rasyid Ridho. Co-authored-by: Jean Friesewinkel <jean@xfw.io> Co-authored-by: Rasyid Ridho <rasyidridho7@gmail.com>
The refresh button used scaleEffect plus a fixed frame around an AppKit-backed ProgressView. On macOS that combination can produce SwiftUI constraint assertions when the button enters the refreshing state. Use controlSize(.small), which asks AppKit for the smaller spinner without conflicting size constraints. Adapted from PR #19 by Jean Friesewinkel. Co-authored-by: Jean Friesewinkel <jean@xfw.io>
This was referenced May 18, 2026
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
This consolidates the small bug-fix parts of the open PRs we reviewed:
resets_atfailure originally addressed in fix(api): tolerate null resets_at for unused usage windows #18, with additional issue context from fix: handle null response after claude reset #13.What changed
Null usage reset times
Claude can return
resets_at: nullfor usage windows with no current consumption. The mapper previously treated that as an invalid payload and blocked refresh. This keepsUsageLimit.resetAtnon-optional and falls back to the relevant rolling window duration while preserving hard failure for malformed non-null dates.Popover refresh spinner
The refresh button used
scaleEffectplus a fixed frame around an AppKit-backedProgressView, which can produce SwiftUI constraint assertions on macOS. This now uses.controlSize(.small)so AppKit supplies the small spinner size directly.Attribution
Testing
xcodebuild test -project ClaudeMeter.xcodeproj -scheme ClaudeMeter -configuration Debug -only-testing:ClaudeMeterTests/UsageServiceTests