fix: platform billing reschedule usage increment via trigger.dev#27483
fix: platform billing reschedule usage increment via trigger.dev#27483
Conversation
E2E results are ready! |
e386d00 to
03bdd3e
Compare
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/features/ee/billing/service/proration/__tests__/MonthlyProrationService.integration-test.ts">
<violation number="1">
P2: This test becomes time-dependent by using the current date for `monthKey`, which can make the suite flaky or fail once the current month no longer matches the seeded subscription period. Prefer a fixed date within the test data’s subscription window to keep tests deterministic.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Devin AI is addressing Cubic AI's review feedbackA Devin session has been created to address the issues identified by Cubic AI. |
|
I reviewed the Cubic AI feedback for this PR. The issue identified was: Violation #1: The test in However, after checking all Cubic AI comments on this PR, I could not find a confidence score ("Fix confidence (alpha): X/10") for this issue. Per the instructions to only fix issues with confidence scores of 9/10 or higher, and to skip issues without a confidence score, no changes were made. Additionally, upon reviewing the code, the |
What does this PR do?
Fixes a bug where platform billing usage increments were not being properly rescheduled when bookings were moved to a new time. Previously, the
rescheduleUsageIncrementtask was callingruns.cancel(runId)which would cancel the billing increment entirely, meaning rescheduled bookings would never have their usage tracked.This PR changes the behavior to use Trigger.dev's
runs.reschedule()API, which properly reschedules the delayed task to the new booking time instead of canceling it.Changes
runs.cancel(runId)toruns.reschedule(runId, { delay: payload.rescheduledTime })in the Trigger.dev taskrescheduledTimefrom trigger options into the payload so it's available inside the taskrescheduledTime: Datefield withz.coerce.date()validationoptionsparameter optional and properly forwarded in all tasker methodsMandatory Tasks (DO NOT REMOVE)
How should this be tested?
enableAsyncTasker: true)Human Review Checklist
runs.reschedule()is the correct Trigger.dev API for rescheduling delayed runsrescheduledTimeis correctly passed through: BillingService → PlatformOrganizationBillingTasker → Trigger taskChecklist
Summary by cubic
Reschedules platform billing usage increment jobs correctly via Trigger.dev by sending rescheduledTime in the payload and using runs.reschedule. Fixes delayed increments when bookings are moved.
Written for commit c0f8844. Summary will update on new commits.