Commit 0005b45
authored
fix(billing): treat incomplete subscriptions as fail-closed (#3624)
* fix(billing): treat incomplete subscriptions as fail-closed for quota
Adds 'incomplete' to failClosedStatuses in requireQuota meter-mode gate.
Previously, a status='incomplete' sub (initial payment failed, ~24h Stripe window)
fell through to the meter check, which read the paid plan quota from subscription.plan
when no BillingUsage doc existed — giving users full paid resources for free.
Now routes to free-plan quota like paused/unpaid/incomplete_expired. V8 audit C2.
* fix(billing): add canceled to fail-closed statuses + pin getMeter short-circuit
CodeRabbit pass 1 (PR #3624):
- Add 'canceled' to failClosedStatuses in meter mode — mirrors legacy-mode
behavior (activeStatuses check) so canceled subs can't bleed paid quota
- Update comment: list all 5 statuses, clarify "routes to default/free-plan quota"
- Add getMeter.not.toHaveBeenCalled() assertion to pin fail-closed short-circuit
- Remove hard-coded quota number reference from test comment1 parent ddb0285 commit 0005b45
2 files changed
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
597 | 624 | | |
598 | 625 | | |
0 commit comments