-
Notifications
You must be signed in to change notification settings - Fork 11.1k
fix: break circular dependency between reminderScheduler and credit-service #25312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ervice - Created WorkflowReminderRepository to handle workflow reminder queries - Refactored cancelScheduledMessagesAndScheduleEmails to accept userIdsWithoutCredits parameter - Moved credit-checking logic from workflows to CreditService - Changed dynamic import to static import in CreditService - Updated tests to pass userIdsWithoutCredits parameter - Removed unused imports (prisma, WorkflowMethods) This creates a one-way dependency (billing -> workflows) and follows the repository pattern by removing direct Prisma usage from reminderScheduler. Co-Authored-By: [email protected] <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 4 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="packages/features/ee/billing/credit-service.ts">
<violation number="1" location="packages/features/ee/billing/credit-service.ts:608">
Team-level credit exhaustion no longer cancels SMS reminders because the membership lookup passes the teamId to a userId-based query and the returned rows lack userId entirely, so the list of out-of-credit members is always empty.</violation>
<violation number="2" location="packages/features/ee/billing/credit-service.ts:634">
Rule violated: **Avoid Logging Sensitive Information**
Do not log the full `result` object because `LowCreditBalanceResult` holds user and admin names/emails; log only non-PII identifiers instead.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
- Use MembershipRepository.listAcceptedTeamMemberIds instead of findAllAcceptedPublishedTeamMemberships - Re-add prisma import to reminderScheduler.ts for UserRepository - Update WorkflowReminderRepository to use WorkflowActions enum instead of string Co-Authored-By: [email protected] <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
E2E results are ready! |
What does this PR do?
packages/features/ee/workflows/lib/reminders/reminderScheduler.tsandpackages/features/ee/billing/credit-service.tsWorkflowReminderRepositoryfor prisma queries and madecancelScheduledMessagesAndScheduleEmailsaccept pre-computeduserIdsWithNoCreditsparameterMandatory Tasks (DO NOT REMOVE)
How should this be tested?