Skip to content

Allow negative auto-topup thresholds - #2354

Merged
charlietlamb merged 1 commit into
devfrom
charlie/negative-auto-topup-threshold
Jul 22, 2026
Merged

Allow negative auto-topup thresholds#2354
charlietlamb merged 1 commit into
devfrom
charlie/negative-auto-topup-threshold

Conversation

@charlietlamb

@charlietlamb charlietlamb commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • allow negative auto-topup thresholds in the shared API schema
  • remove the matching customer and plan UI validation
  • cover negative thresholds with a schema regression test

Validation

  • bun test shared/models/cusModels/billingControls/customerBillingControls.test.ts
  • bunx tsgo --build --noEmit (server)
  • bunx biome check on changed files
  • React Doctor changed-file scan: no issues

Summary by cubic

Allow negative auto-topup thresholds across the API and UI. The shared AutoTopupSchema now accepts negative threshold values, UI checks in BillingAutoTopupSheet and the plan billing form no longer block negatives, and a regression test verifies the behavior.

Written for commit 4987187. Summary will update on new commits.

Review in cubic

Greptile Summary

This PR allows auto-top-up thresholds below zero. The main changes are:

  • API changes · Improvements: Remove the nonnegative constraint from the shared threshold schema.
  • Improvements: Accept negative thresholds in customer and plan forms.
  • Bug fixes: Add a schema test for a negative threshold.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The shared schema and both UI paths consistently accept negative thresholds.
  • Existing balance comparison behavior supports the new threshold range.

Important Files Changed

Filename Overview
shared/models/cusModels/billingControls/customerBillingControls.ts Removes the minimum-zero constraint from the shared auto-top-up threshold schema.
shared/models/cusModels/billingControls/customerBillingControls.test.ts Adds a test confirming that the schema accepts a negative threshold.
vite/src/views/customers2/components/sheets/BillingAutoTopupSheet.tsx Removes customer-form validation that rejected negative thresholds.
vite/src/views/products/plan/components/edit-plan-details/usePlanBillingControlForm.ts Updates plan-form validation to allow negative numeric thresholds.

Reviews (1): Last reviewed commit: "fix(billing): allow negative auto-topup ..." | Re-trigger Greptile

Context used:

  • Context used - When generating the key changes section of the sum... (source)

@capy-ai

capy-ai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Capy auto-review is paused for this organization because the usage-cycle auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews.

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
checkout Ignored Ignored Jul 22, 2026 2:46pm
landing-page Ignored Ignored Jul 22, 2026 2:46pm

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@charlietlamb
charlietlamb merged commit 6c3293a into dev Jul 22, 2026
15 checks passed
@charlietlamb
charlietlamb deleted the charlie/negative-auto-topup-threshold branch July 22, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant