🐛 server: fix repeat options on maturity queue - #1182
Conversation
🦋 Changeset detectedLatest commit: 6a3bc08 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
WalkthroughMaturity reminder workers now process delayed jobs, notification TTLs clamp to zero for past maturities, and both schedulers use timestamp-aligned start dates. Tests verify delayed processing, notification behavior, scheduler arguments, and Sentry mock updates. ChangesMaturity reminders
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CheckDebtsWorker
participant ScanChunkWorker
participant ReminderWorker
participant OneSignal
CheckDebtsWorker->>ScanChunkWorker: enqueue scan-chunk
ScanChunkWorker->>ReminderWorker: enqueue reminder delivery
ReminderWorker->>OneSignal: send notification with clamped ttl
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
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: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b81546a4-859a-4981-8f6f-4f5a572bf266
📒 Files selected for processing (2)
server/test/utils/maturity.test.tsserver/utils/maturity.ts
c69da84 to
bc3a972
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
server/utils/maturity.ts (1)
419-430: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUse future maturity-window start dates.
Both sites encode start dates that are already past, causing BullMQ to schedule the initial job immediately rather than at the intended maturity boundary. (raw.githubusercontent.com)
server/utils/maturity.ts#L419-L430: remove- everyand derive eachstartDatefrommaturity * 1000 + offset.server/test/utils/maturity.test.ts#L302-L324: update both expectedstartDatevalues to match the corrected maturity-boundary calculation.Source: MCP tools
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: e22b165f-fb5e-4e3f-bd68-8037f49d387e
📒 Files selected for processing (3)
.changeset/long-carpets-cut.mdserver/test/utils/maturity.test.tsserver/utils/maturity.ts
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1182 +/- ##
==========================================
- Coverage 70.69% 70.28% -0.42%
==========================================
Files 263 262 -1
Lines 11446 11521 +75
Branches 3833 3851 +18
==========================================
+ Hits 8092 8097 +5
- Misses 3059 3128 +69
- Partials 295 296 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3297d808a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -119,15 +118,6 @@ const worker = observe( | |||
| case "check-debts": { | |||
| const check = parse(checkDebtsSchema, job.data); | |||
| const maturity = (Math.floor(Date.now() / 1000 / MATURITY_INTERVAL) + 1) * MATURITY_INTERVAL; | |||
There was a problem hiding this comment.
Preserve the scheduled maturity on delayed planner jobs
When a check-debts job is delayed across its maturity boundary, this recalculates maturity from the execution time rather than the scheduled occurrence. Since the stale-job guard was removed, a 24-hour planner resuming just after the original maturity now scans the next maturity and can send a “due in 24 hours” reminder nearly a full interval early. Include the intended maturity in the scheduled job data or reject planners that cross a maturity boundary.
Useful? React with 👍 / 👎.
acaa74c to
e020098
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b42a553fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
server/utils/maturity.ts (1)
120-123: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftPreserve the intended maturity for delayed planner jobs.
After the window gate was removed, a
check-debtsjob that runs after its target maturity recomputesmaturityas the next interval. It then scans and potentially notifies for the wrong maturity instead of delivering the overdue reminder. Carry the intended maturity in the scheduled job contract, or derive it from the job’s scheduled timestamp.
server/utils/maturity.ts#L120-L123: stop deriving the target maturity solely from processing time.server/test/utils/maturity.test.ts#L1026-L1038: add a post-maturity delayed planner case that verifies the original maturity is queried and delivered.
♻️ Duplicate comments (1)
server/utils/maturity.ts (1)
370-375: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winSet
startDateat the maturity-window boundary.The
- everyterm shifts both start dates a full maturity interval backward: for normal timestamps this resolves tomaturity + offset - every, which is already expired. Usematurity * 1000 + offsetand update the expectations. This repeats the previously addressed finding.
server/utils/maturity.ts#L370-L375: remove the full-interval backdating from bothstartDatecalculations.server/test/utils/maturity.test.ts#L305-L320: assertmaturity - 24handmaturity - 1h, without subtractingMATURITY_INTERVAL.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 9ea95deb-0375-4be7-afe6-6f53581bb0a0
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
.changeset/long-carpets-cut.md.changeset/sunny-sites-shine.mdserver/package.jsonserver/test/utils/maturity.test.tsserver/utils/maturity.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65b9656339
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
startDatevalues for 24-hour and 1-hour maturity schedulers.Testing
Summary by CodeRabbit