Fix extra usage values shown 100x wrong due to double cent-to-dollar conversion#463
Open
Priyans-hu wants to merge 1 commit intosteipete:mainfrom
Open
Fix extra usage values shown 100x wrong due to double cent-to-dollar conversion#463Priyans-hu wants to merge 1 commit intosteipete:mainfrom
Priyans-hu wants to merge 1 commit intosteipete:mainfrom
Conversation
Both the OAuth path (normalizeClaudeExtraUsageAmounts) and the Web path (parseOverageSpendLimit) already convert cents to dollars by dividing by 100. The rescaleClaudeExtraUsageCostIfNeeded heuristic then divided by 100 again when the post-normalization limit was >= 1000, which meant any user with a limit of $1000 or more saw their extra usage values divided by an extra factor of 100. Remove the rescale function entirely since the upstream normalization handles the conversion correctly for all plan types. Fixes steipete#227
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.
Both the OAuth path (
normalizeClaudeExtraUsageAmounts) and the Web path (parseOverageSpendLimit) already divide the raw API response by 100 to go from cents to dollars. ButrescaleClaudeExtraUsageCostIfNeededwas dividing by 100 again whenever the post-normalization limit came out >= $1000 — so any Max/Team user with a high extra-usage cap got their values squished by another 100x.Removed the rescale function entirely since the upstream conversion handles it correctly for every plan type now. Updated tests to match.
What changed
rescaleClaudeExtraUsageCostIfNeededandextraUsageRescaleThreshold_rescaleExtraUsageForTestingtest hookClaudeOAuthTeststo expect the correct post-normalization values instead of the double-divided onesFixes #227