improvement(billing): replace daily refresh credits with weekly refresh - #7113
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThe PR replaces daily refresh credits with fixed weekly allowances, using seven-day usage-ledger buckets anchored to the billing-period start.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported scope-dependent display mismatch is corrected because both the subscription display and enforcement path now scale by seats only for organization-scoped billing.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/settings/components/billing/billing.tsx | Displays the resolved weekly allowance and now applies seat scaling only in organization billing scope, matching enforcement. |
| apps/sim/lib/billing/credits/weekly-refresh.ts | Implements seven-day ledger bucketing, per-window allowance caps, period clamping, and organization seat scaling. |
| apps/sim/lib/billing/plan-helpers.ts | Centralizes plan-to-weekly-refresh resolution while excluding free and enterprise plans. |
| apps/sim/lib/billing/core/usage.ts | Replaces daily-refresh deductions with weekly-refresh deductions across resolved and current-period usage. |
| apps/sim/lib/billing/core/billing.ts | Applies weekly-refresh deductions consistently to personal and organization overage calculations. |
| apps/sim/lib/billing/calculations/usage-monitor.ts | Uses weekly allowances in both personal and pooled organization usage enforcement. |
| packages/db/schema.ts | Updates schema documentation for the weekly-refresh billing-period interpretation without changing the persisted schema contract. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
P[Subscription plan] --> R[getPlanWeeklyRefreshDollars]
R --> S{Organization scoped?}
S -- Yes --> M[Multiply allowance by seats]
S -- No --> O[Use one-seat allowance]
M --> B[Bucket ledger usage into 7-day windows]
O --> B
B --> D[Deduct consumed refresh from usage]
D --> E[Enforcement and overage calculation]
R --> U[Subscription display]
S --> U
Reviews (2): Last reviewed commit: "fix(billing): scope weekly refresh row s..." | Re-trigger Greptile
bd97b3e to
9a0bc96
Compare
There was a problem hiding this comment.
All reported issues were addressed across 22 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
@cubic-dev-ai review |
@icecrasher321 I have started the AI code review. It will take a few minutes to complete. |
Summary
DAILY_REFRESH_RATEwith fixed per-tierweeklyRefreshCreditsand agetPlanWeeklyRefreshDollarsresolver shared by the billing math and every display surfaceType of Change
Testing
Checklist