Conversation
- Teams with inactive subscriptions (isActive=false) now receive the same email usage alerts as FREE plan users - Sends 80% warning email at 2,400 emails (80% of 3,000 monthly limit) - Sends monthly limit reached email at 3,000 emails - Uses FREE plan limits (3,000 emails/month) for all inactive subscriptions - Improves user communication when subscriptions become inactive 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded@KMKoushik has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 33 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThe change updates email limit checking logic to treat inactive subscriptions similarly to FREE plan accounts for monthly limits. When a subscription is inactive, the system now applies FREE plan monthly limits and generates notifications accordingly, regardless of the actual plan tier. Monthly limit thresholds and notifications now reference "FREE plan or inactive subscription." Logging is enhanced with an isActive flag to track subscription state. Daily limit behavior remains unchanged. Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/src/server/service/limit-service.ts (1)
134-137: Apply daily limit logic consistently for inactive subscriptions.The daily and monthly limit logic treat inactive subscriptions asymmetrically. While inactive subscriptions use the FREE monthly limit (3,000 emails), the daily limit still uses the original
team.dailyEmailLimit(which could be unlimited for BASIC plans).The suggested fix in the original comment has a logic error. When an inactive BASIC plan uses
PLAN_LIMITS[team.plan].emailsPerDay, it evaluates to -1 (unlimited) rather than the FREE daily limit. Instead, usePLAN_LIMITS.FREE.emailsPerDaywhen inactive:const dailyLimit = - team.plan !== "FREE" + team.plan !== "FREE" && team.isActive ? team.dailyEmailLimit - : PLAN_LIMITS[team.plan].emailsPerDay; + : PLAN_LIMITS.FREE.emailsPerDay;This ensures inactive subscriptions (regardless of plan) follow the same daily and monthly limits as FREE plans.
🧹 Nitpick comments (1)
apps/web/src/server/service/limit-service.ts (1)
176-193: Consider removing duplicate logging statement.The logging at lines 176-179 and 190-193 is identical and redundant. The values being logged don't change between these two points, so the second logging statement (lines 190-193) can be safely removed.
Apply this diff to remove the duplicate:
logger.info( { monthlyUsage, monthlyLimit, team, isActive: team.isActive }, `[LimitService]: Monthly usage and limit (FREE plan or inactive subscription)` ); if (monthlyUsage / monthlyLimit > 0.8 && monthlyUsage < monthlyLimit) { await TeamService.sendWarningEmail( teamId, monthlyUsage, monthlyLimit, LimitReason.EMAIL_FREE_PLAN_MONTHLY_LIMIT_REACHED ); } - logger.info( - { monthlyUsage, monthlyLimit, team, isActive: team.isActive }, - `[LimitService]: Monthly usage and limit (FREE plan or inactive subscription)` - ); - if (isLimitExceeded(monthlyUsage, monthlyLimit)) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/src/server/service/limit-service.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Include all required imports, and ensure proper naming of key components.
Files:
apps/web/src/server/service/limit-service.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: TypeScript-first: use .ts/.tsx for source code (avoid JavaScript source files)
Use 2-space indentation and semicolons (Prettier 3 enforces these)
Adhere to @usesend/eslint-config; fix all ESLint warnings (CI fails on warnings)
Do not use dynamic imports; always place imports at the top of the module
Files:
apps/web/src/server/service/limit-service.ts
**/*.{ts,tsx,md}
📄 CodeRabbit inference engine (AGENTS.md)
Format code with Prettier 3 (run pnpm format)
Files:
apps/web/src/server/service/limit-service.ts
apps/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
apps/web/**/*.{ts,tsx}: In apps/web, use the/ alias for src imports (e.g., import { x } from "/utils/x")
Prefer using tRPC in apps/web unless explicitly asked otherwise
Files:
apps/web/src/server/service/limit-service.ts
🧬 Code graph analysis (1)
apps/web/src/server/service/limit-service.ts (1)
apps/web/src/lib/constants/plans.ts (1)
PLAN_LIMITS(12-36)
🔇 Additional comments (2)
apps/web/src/server/service/limit-service.ts (2)
103-103: LGTM: Documentation accurately reflects the new behavior.The comment clearly documents that inactive subscriptions receive FREE plan treatment for monthly limit alerts.
167-174: Monthly limit logic correctly implements the requirement.The condition properly treats both FREE plans and inactive subscriptions with the same 3,000 email/month limit. The explicit use of
PLAN_LIMITS.FREE.emailsPerMonthensures consistency.However, this change should be reviewed alongside the daily limit behavior to ensure the overall limit strategy is coherent (see comment on lines 134-137).
Deploying usesend with
|
| Latest commit: |
ff72fa7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://69bf502c.usesend.pages.dev |
| Branch Preview URL: | https://claude-email-usage-alerts-01.usesend.pages.dev |
🤖 Generated with Claude Code
Summary by cubic
Treats inactive teams like FREE plans for monthly email usage alerts. Adds clear thresholds and logging to warn at 80% and notify when the monthly limit is reached.
Summary by CodeRabbit
Release Notes