Repository navigation
fix(billing): annual plans include a year of credits, plan switches rebase the usage limit - #10386
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
1 issue found across 41 files
Confidence score: 3/5
- In
seats.ts, annual Team orgs with a nullbilling_intervalcolumn can get the monthly floor applied to added seats, even though the annual interval is in metadata. Pass the resolved interval instead of the raw column.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/billing/organizations/seats.ts">
<violation number="1" location="apps/sim/lib/billing/organizations/seats.ts:141">
P2: Pass the resolved interval here, not the raw column. For annual Team orgs whose `billing_interval` column is null, the interval exists only in `metadata`, so this sets the monthly floor and the added seat's annual allowance waits for the next hourly sweep. Use `resolveBillingInterval(orgSubscription)` and import it from `@/lib/billing/subscriptions/utils`, which this file already imports from.</violation>
</file>
This PR changes payment, billing, or quota logic. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.
Turn on auto-fix | Re-trigger cubic
[Critical impact] The latest changes appear safe to merge. SummaryThis PR gives annual plans twelve months of included credits, prorates annual Team seat credits, and moves spending limits when plans change.
Reviews (5) · Last reviewed commit: "fix(billing): price fractional seat-mont..." · Reviewed by Greptile |
…ebase the usage limit, billing page matches the server
…ts on plan switch, hold annual downgrades to renewal
eecf532 to
d3f402e
Compare
…ar's seat-months until it closes, dispute-aware copy
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 52 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…afe limit rebase, test schemas carry the allowance columns
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 56 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…s, allowance and limit writes in one transaction
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
getPlanPricingnow takes the subscription and returns 12× the monthly allowance on annual billing, reading the interval from the column or metadata (resolveBillingIntervalmoved intosubscriptions/utils).reconcile-billing-seatscron re-syncs settled annual subscriptions (syncAnnualPlanUsageLimits), so existing annual payers are raised without a data migration. The sync only raises.0474_annual_seat_allowanceadds three nullable columns:allowance_period_start,allowance_seats,allowance_seat_months.seats. It keeps a year's count until that year's cycle close, which prices the closed year with it.billing_intervalon rows that kept it only in metadata.switch-planrefuses it with a clear message.recordPlanSwitch(new, incore/plan-switch.ts) writes the plan and interval (column and metadata) and moves the limit to the new allowance.switch-planno longer writes the database itself.includedUsage, which the page uses for both the minimum and on-demand math.Type of Change
Testing
lib/billing/plan-allowance.integration.ts(real Postgres), 13 cases:trial.integration.tsandenterprise-self-serve.integration.tspass (the self-serve error assertion now expects credits).check:source-conventionsandcheck:unused-exportsbaselines shrank. Also rancheck:boundaries,check:comment-hygiene,check:file-namesandcheck:api-validation:strict. CI runs type-check and the full audits.Checklist
test-auditauthoring gate)