Skip to content

fix(billing): Enforce Seer auto-reload minimums in the modal - #130828

Merged
billyvg merged 7 commits into
masterfrom
billyvong/reveng-733-auto-reload-modal-allows-0-daily-limit
Nov 17, 2026
Merged

billyvg merged 7 commits into
masterfrom
billyvong/reveng-733-auto-reload-modal-allows-0-daily-limit

Conversation

@billyvg

@billyvg billyvg commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Fixes some FE defaults and validations. Reload amount now correctly selects $15 and daily limit now defaults to undefined (and can send undefined rather than send $0 which blocks seer usage).

Slop

Why?

The Seer auto-reload modal didn't enforce the agreed limits: a minimum amount of $15, and an unset daily limit meaning no cap. It let any amount above $0 through. Clearing the daily limit sent $0, which blocks all Seer usage, and there was no way to leave the limit unset.

The "Due now" preview also disagreed with the backend at exactly the threshold. The modal showed no charge, but the backend bills an auto-reload at or below the threshold. A new wallet starts at exactly the threshold, so turning auto-reload on billed without showing "Due now".

Turning auto-reload off and back on also replaced a saved custom amount with the $15 preset (review comment).

How?

The modal reads the minimum amount from the auto-reload API instead of hardcoding it. It disables saving below the minimum and shows an inline message. An empty daily limit is saved as null, meaning no limit. A $0 daily limit is still allowed, with a warning that it turns off all Seer usage. The "Due now" preview now uses at-or-below the threshold, which matches when the backend bills the first auto-reload. The modal and wallet card now say auto-reload triggers "at or below" the threshold rather than "below".

The modal now opens on the saved amount whether auto-reload is on or off. While off, it used to swap any amount that wasn't a preset for $15, to hide the API's old 1,000-credit default. That default is now the $15 minimum, which is the first preset.

This depends on getsentry/getsentry#23167, which returns minTopUpCredits and a nullable dailySpendCapCents, and still accepts a $0 daily limit. That change must deploy first.

Fixes REVENG-751

Generated with Claude Code

@linear-code

linear-code Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

REVENG-733

REVENG-751

@billyvg
billyvg marked this pull request as ready for review November 11, 2026 23:23
@billyvg
billyvg requested a review from a team as a code owner November 11, 2026 23:23
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Story previews

Preview the stories changed in this PR on the Vercel deployment:

Preview deployment: https://sentry-eycwp3jpi.sentry.dev

@billyvg

billyvg commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

QA

Updated Nov 12: a $0 daily limit is now allowed with a warning, so the $14 / $0 frame was retaken.

I tested this on a box devserver, running this branch's frontend with getsentry/getsentry#23167's backend. The org is a local mock org on a token-billed (am3_business_seer_credits) contract, with 500 of 500 included credits. That is exactly the 500-credit threshold, the state from REVENG-751. The "before" frames come from master (b1ed56cb6fe) on the same backend and data.

Before After
Turning on at the threshold Turn-on modal before: no Due now, plain Turn on, daily limit $0 Turn-on modal after: Due now $15.00, Turn on and pay $15.00 + tax, daily limit No limit
$14 amount, $0 daily limit Before: $14 and $0 accepted, Turn on enabled After: inline error on the $14 amount, warning (not an error) on the $0 limit; button disabled because of the amount
Wallet card, auto-load on Wallet card before: when below 500 Wallet card after: when at or below 500

A $0 daily limit is valid: with a valid amount it shows only the warning, and the button stays enabled.

$0 daily limit with the $15 preset: warning shown, Turn on and pay $15.00 + tax enabled

  • Turning on at the threshold: Before, the modal said "drop below $5" and showed a plain "Turn on", but the backend bills $15 as soon as auto-load is on at this balance. It now says "at or below $5", shows "Due now $15.00", and the button reads "Turn on and pay $15.00 + tax". An unset daily limit shows "No limit" instead of $0.
  • Minimums: A $14 amount used to be accepted. It now shows an inline error and disables the button. A $0 daily limit is valid and saves, with a warning that it turns off all Seer usage. Clearing the daily limit saves no limit and shows no warning; I checked that in the DOM.
  • Not covered: clicking "Turn on and pay" (off-cycle invoices are off locally, so the charge can't go through), dark theme, and narrow viewports. The "auto-load on" config was written straight through SeerWalletConfigService, because turning it on through the API would bill.

Generated with Claude Code

billyvg and others added 5 commits November 13, 2026 13:06
The auto-load modal let any amount above $0 through, sent a $0 daily
limit when the field was empty (which blocks all Seer usage), and had no
way to leave the daily limit unset.

The modal now reads the minimum amount and daily limit from the API,
disables saving below them with an inline message, and saves an empty
daily limit as no limit. The "Due now" charge preview matches the
backend, which loads credits at or below the threshold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The backend loads credits once the balance is at or below the threshold,
but the modal and wallet card said "below", so a wallet at exactly the
threshold being charged on turn-on looked like a bug.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A $0 daily usage limit is a valid way to turn off Seer, so the modal no
longer blocks it. It shows a warning instead, and saves the $0 limit. The
API no longer returns a minimum daily limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
When auto-load was off, the modal replaced any amount that wasn't a
preset with the $15 default, so a saved custom amount came back as $15
when turning auto-load on again. That fallback only hid the old
1,000-credit API default. The API now defaults to the 1,500-credit
minimum, which is the first preset, so the modal shows the saved amount
whether auto-load is on or off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master now calls the daily cap the daily usage limit everywhere, so the
new tests and type comment use the same words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… payment

The 3DS flow from master stores the settings to resend once the refill
is paid, typed as the full auto-reload response. Saving now takes only
the settings the API accepts, which leaves out the minTopUpCredits the
response adds, so the stored settings use that type too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@billyvg
billyvg merged commit 81809c3 into master Nov 17, 2026
73 checks passed
@billyvg
billyvg deleted the billyvong/reveng-733-auto-reload-modal-allows-0-daily-limit branch November 17, 2026 19:44

This branch was successfully deployed

1 active deployment
Preview — 25cc9d31 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants