chore(billing): remove the Automatic top-up toggle
Client half of the auto-recharge removal in #1960. This PR was not in the issue's original plan — see the correction recorded in that issue's merge-sequencing note.
The issue checked client blast radius by grepping chat and open-agents for insufficient_credits, which correctly found that no first-party client reads the 402 body. But the auto-recharge endpoint itself has a live client, shipped in #1862: the account modal renders an "Automatic top-up" switch that reads GET /api/accounts/{id}/auto-recharge and writes PATCH. Deleting the api route without this PR leaves a switch in production that 404s on load and toasts "Couldn't update automatic top-up" on every flip.
What this removes
| File | Role |
|---|---|
components/Account/BillingSection.tsx | The "Automatic top-up" switch and its copy ("automatically charge your saved card $5 for 500 credits") |
components/Account/Account.tsx | The <BillingSection /> render and its import (2 lines) |
hooks/useAutoRecharge.ts | react-query read + mutation wrapper |
lib/recoup/getAutoRechargeSetting.ts | GET /api/accounts/{id}/auto-recharge |
lib/recoup/updateAutoRechargeSetting.ts | PATCH /api/accounts/{id}/auto-recharge |
lib/recoup/__tests__/getAutoRechargeSetting.test.ts, updateAutoRechargeSetting.test.ts | Tests for the two deleted clients |
User-observable change
The account modal loses its "Billing" section. Everything above it (name, job title, company, custom instructions, Save, Log Out) is untouched, as is the border-t divider layout of the sections that remain.
Buying credits is unaffected: it runs through POST /api/credits/sessions, which this PR does not touch and which the api side keeps.
Verification
grep -rn "AutoRecharge\|autoRecharge\|auto-recharge\|auto_recharge\|Automatic top-up"across all.ts/.tsx/.jsonoutsidenode_modulesreturns nothing. No dangling importer.eslint components/Account/Account.tsxclean (the only edited file; everything else is a deletion).tsc --noEmit: no new errors. One pre-existing error remains,SpotifyDeepResearchResult.tsx(5,25) TS2307on a.pngimport, which is worktree noise from the gitignorednext-env.d.tsnot being generated and is unrelated to this change.vitest run lib/recoup: 1 file / 2 tests passing (getAccountCredits.test.ts); the two deleted test files went with their subjects.
Not yet done: preview screenshot of the account modal without the Billing section. Flagging rather than implying it.
Merge order
Merge before the api PR that deletes the route (row 3 of #1960), and after docs#299.
Summary by cubic
Removes the “Automatic top-up” toggle and its client code so the UI no longer calls the auto-recharge endpoints being removed. Previously the account modal read/wrote GET/PATCH /api/accounts/{id}/auto-recharge; now the Billing section is gone, avoiding 404s and error toasts. Buying credits via POST /api/credits/sessions is unchanged.
- Deletes
components/Account/BillingSection.tsx,hooks/useAutoRecharge.ts,lib/recoup/getAutoRechargeSetting.ts,lib/recoup/updateAutoRechargeSetting.ts, and their tests; removes theBillingSectionimport/render fromcomponents/Account/Account.tsx. - User-visible: the account modal no longer shows the “Billing” section; remaining sections and layout stay the same.
- Rollout: merge before the API route deletion tracked in #1960 and after docs#299. No migration required.