fix: format extra usage in the currency reported by the usage API#418
Open
mhriemers wants to merge 1 commit into
Open
fix: format extra usage in the currency reported by the usage API#418mhriemers wants to merge 1 commit into
mhriemers wants to merge 1 commit into
Conversation
The usage API reports the account's billing currency (extra_usage.currency, e.g. "EUR"), but ExtraUsageRemaining always formatted with a hardcoded dollar sign, showing non-USD budgets with the wrong symbol. Parse the currency field through the API response schema, file cache, and prefetch merge, and format the remaining budget with Intl-based currency formatting (falling back to USD when the field is absent or invalid, preserving current output for USD accounts). Fixes sirmalloc#415 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mhriemers
added a commit
to mhriemers/ccstatusline
that referenced
this pull request
Jun 4, 2026
…sirmalloc#418 Once sirmalloc#418 teaches the parser about extra_usage.currency, a fixture carrying the field would add extraUsageCurrency to the parsed result and break this test's expectation depending on merge order. The field is irrelevant to what this test covers (monthly_limit: null handling). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 4, 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
Fixes #415 — the usage API reports the account's billing currency (
extra_usage.currency, e.g."EUR"), butExtraUsageRemainingalways formatted with a hardcoded$, so non-USD accounts see their budget with the wrong symbol.Changes
currencyadded toUsageApiResponseSchema,CachedUsageDataSchema, both parse functions,USAGE_DATA_FIELDS/pickDefinedUsageFieldsin the prefetch merge, and theUsageData/RenderUsageDatatypes (asextraUsageCurrency)src/widgets/shared/currency.ts:formatUsageCurrency()usesIntl-based currency formatting with theen-USlocale, falling back to USD when the code is absent or invalid — so output for USD accounts is byte-for-byte unchanged ($3,894.00)ExtraUsageRemainingformats with the reported currency: an EUR account now seesOverage Left: €3,894.00Testing
currency.test.ts(default, known codes, invalid-code fallback)ExtraUsageRemaining.test.tscurrency: 'EUR'added to the usage-fetch API fixture, asserting it parses through toextraUsageCurrencybun run lintcleanRelated to but distinct from #387 (cents/dollars math). Related: #413/#416, #414/#417.
🤖 Generated with Claude Code