Skip to content

fix(billing): trial-aware usage card, personal-only trial credit base, trial_card user_id index - #10358

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/trial-release-review
Nov 24, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/trial-release-review

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Follow-up to #10330 from the v0.9.66 release review (#10356).

  • Usage-limit card: a personal trial that used its allowance was told to increase its usage limit, which a trial cannot do. resolveUsageUpgradePayload now returns trial copy (usage resumes when the trial ends) for every caller: copilot continuation, cost callback, provider run limit and the mothership billing tool. UsageUpgradePayer.payerSubscription now requires status; every builder already had it except the chat-access check in host-context.ts, which now passes it.
  • Credit grants: setUsageLimitForCredits applies the trial allowance only to a personal pool. An organization keeps basePrice × seats, matching syncSubscriptionUsageLimits and getOrgUsageLimit.
  • Migration 0472: indexes trial_card(user_id). The claim query (fingerprint = $1 OR user_id = $2) and the FK's ON DELETE SET NULL both scanned the table, which only grows. It is built CONCURRENTLY after a COMMIT, with replay guards copied from 0467. 0471 is already applied on staging, so the index can't go into 0471.

Tests: four new cases in trial.integration.ts against real Postgres. Reverting each guard turns its tests red (3 fail), and the converted-Pro case stays green.

…, trial_card user_id index

- The usage-limit card told a personal trial to increase a limit it cannot edit; it now says
  usage resumes when the trial ends. Payers carry their subscription status for this.
- setUsageLimitForCredits applies the trial allowance only to a personal pool; an organization
  keeps its seat-priced plan base, as every other org limit path does.
- 0472 indexes trial_card(user_id) for the claim lookup and the ON DELETE SET NULL cleanup.
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 24, 2026 10:51am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; no actionable issues were found.

Summary

This PR makes usage-limit messages aware of personal trials and keeps organization credit grants based on the plan price and seat count.

  • Trial usage cards explain when usage will resume.
  • Personal trials and organizations get the right base for credit limits.
  • Trial-card claims can find rows by account ID faster.

No actionable issues were found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "fix(billing): trial-aware usage card, pe..." · Reviewed by Greptile

@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 9 files

Confidence score: 5/5

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

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

@waleedlatif1
waleedlatif1 merged commit 2aa5845 into staging Nov 24, 2026
151 of 153 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/trial-release-review branch November 24, 2026 18:21

This branch was previously deployed

1 inactive deployment
Preview — 9b9ce01b Deployed Nov 24, 2026 by vercel[bot]
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