Skip to content

fix(webapp): avoid float precision loss when converting ms to ns BigInt - #5061

Closed
arthi-arumugam-git wants to merge 1 commit into
triggerdotdev:mainfrom
arthi-arumugam-git:fix/timestamp-ms-to-ns-3292
Closed

arthi-arumugam-git wants to merge 1 commit into
triggerdotdev:mainfrom
arthi-arumugam-git:fix/timestamp-ms-to-ns-3292

Conversation

@arthi-arumugam-git

Copy link
Copy Markdown

Closes #3292

BigInt(ms * 1_000_000) multiplies in float64 first; epoch-ms*1e6 (~1.7e18) exceeds Number.MAX_SAFE_INTEGER, so the result is rounded. Convert to BigInt first, then multiply (same as existing convertDateToNanoseconds).

Changed: getNowInNanoseconds, calculateDurationFromStart (common.server.ts), run-engine debug event startTime (runEngineHandlers.server.ts).

Verified: over 100k sample epoch-ms values, the old pattern differed from exact BigInt(ms) * 1_000_000n in 75,000 cases; new pattern is exact. 3-line change, no behavior change other than precision.

@changeset-bot

changeset-bot Bot commented Oct 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f74bcb3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @arthi-arumugam-git, 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://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Oct 25, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OTLP nanosecond timestamp overflow in webapp event repository

1 participant