fix(webapp): billing alert preview uses current limit instead of stale saved amount#4338
Draft
claude[bot] wants to merge 1 commit into
Draft
fix(webapp): billing alert preview uses current limit instead of stale saved amount#4338claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
…e saved amount After a customer raised their billing limit, the alert-threshold percentage preview kept calculating dollar amounts against the previous limit until they re-saved their alerts. This happened because the preview reused the alert record's snapshotted amount whenever saved percentage levels existed. The preview now returns the snapshot only when it still matches the current effective/plan limit, and otherwise falls back to the current effective limit, so the preview reflects the saved billing limit immediately. Adds a regression test covering the raised-limit scenario. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TywtuVBcXSNVTV6nJbgLk8
|
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.
Requested by Iss · Slack thread
Testing
Added a regression test in
apps/webapp/test/billingAlertsFormat.test.tscovering the raised-limit scenario, and ran thebillingAlertsFormattest suite (26 tests passing). The new test fails against the previous behavior (returns the stale3000) and passes with the fix (returns the current30000).Before: After raising the billing limit, the alert threshold preview still showed dollar amounts calculated against the previous limit until the user clicked "Update alerts" again.
After: The preview reflects the current saved billing limit immediately.
Changelog
getAlertPreviewLimitCentsno longer returns the alert record's snapshottedamountwhenever saved percentage levels exist. It returns the snapshot only when it still matches the current effective/plan limit, and otherwise returns the currenteffectiveLimitCents, so the threshold preview follows the saved billing limit right away. Added a regression test.Generated by Claude Code