Ghost icon indicating copy to clipboard operation
Ghost copied to clipboard

Switched to time-based domain warmup

Open sam-lord opened this issue 2 months ago • 1 comments

closes GVA-617 closes GVA-619

This uses the new domain warmup algorithm that makes the warmup static:

  • The number of recipients we're targeting is 200,000
  • The number of days in which the warmup takes place is 6 weeks (42 days)

This simplifies the flow considerably, and we can experiment with the exact thresholds to make sure this is effective for most users of domain warming.


[!NOTE] Replaces threshold-based scaling with a time-based exponential warmup from 200 to 200k over 42 days, with Infinity after completion, and updates tests accordingly.

  • Email Service (DomainWarmingService.ts)
    • Replace threshold-based scaling table with time-based exponential warmup using WarmupVolumeOptions (start=200, end=200000, totalDays=42).
    • Add #getDaysSinceFirstEmail() querying first csd_email_count email (findPage with csd_email_count:-null, ordered by created_at ASC).
    • getWarmupLimit now computes limit via start * (end/start)^(day/(totalDays-1)) and returns Infinity once day >= totalDays.
  • Tests
    • Integration and unit tests updated to validate time-based limits, day progression, same-day behavior, gaps, and post-warmup Infinity.
    • Introduce deterministic time control with fake timers and adjust assertions to new query and limits.

Written by Cursor Bugbot for commit 4d1012b398495e7a909aa72e81b389b5c7bf661f. This will update automatically on new commits. Configure here.

sam-lord avatar Dec 10 '25 21:12 sam-lord

Walkthrough

This PR refactors the domain warmup logic in DomainWarmingService from a discrete threshold-based scaling approach to a continuous, time-based exponential formula. The service replaces the hardcoded WarmupScalingTable with a new WarmupVolumeOptions configuration and DefaultWarmupOptions constant. The warmup limit calculation now uses an exponential ramp formula (limit = start * (end/start)^(day/(totalDays-1))) based on days since the first email, with an upper bound that returns Infinity once the warmup period completes. The constructor now accepts laboratories and config services as dependencies. Tests are updated to validate the new exponential progression using time-based scenarios with fake timers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • The exponential formula implementation and edge case handling (particularly day 0 boundaries and the Infinity return at totalDays)
  • Math precision in test assertions with floating-point exponential calculations across both integration and unit tests
  • Verification that expected values in test cases correctly reflect the new formula: start * (end/start)^(day/(totalDays-1))
  • The integration of time-based tracking via #getDaysSinceFirstEmail() and the query changes to filter and order email records appropriately

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Switched to time-based domain warmup' clearly and concisely describes the main change in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description clearly references the associated Linear tickets (GVA-617 and GVA-619) and explains the new time-based warmup algorithm implementation with target recipients (200,000) and warmup duration (42 days).
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch time-based-warmup

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 10 '25 21:12 coderabbitai[bot]