Skip to content

fix: prevent nanosecond overflow in OTLP timestamps#3798

Closed
deepshekhardas wants to merge 1 commit into
triggerdotdev:mainfrom
deepshekhardas:fix/3292-otlp-nanosecond-overflow
Closed

fix: prevent nanosecond overflow in OTLP timestamps#3798
deepshekhardas wants to merge 1 commit into
triggerdotdev:mainfrom
deepshekhardas:fix/3292-otlp-nanosecond-overflow

Conversation

@deepshekhardas
Copy link
Copy Markdown

Fixes #3292

Multiply after BigInt conversion in 4 locations where epoch-ms * 1e6 exceeds Number.MAX_SAFE_INTEGER, causing ~256ns precision errors in ~0.2% of cases.

Changes:

  • \common.server.ts:24\ - getNowInNanoseconds()
  • \common.server.ts:38\ - calculateDurationFromStart()
  • \index.server.ts:265\ - recordRunDebugLog()

  • unEngineHandlers.server.ts:467\ - retry event recording

Multiply after BigInt conversion to avoid IEEE 754 precision loss.
Affects 4 locations where epoch-ms * 1e6 exceeds Number.MAX_SAFE_INTEGER.

Fixes triggerdotdev#3292
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 2, 2026

⚠️ No Changeset found

Latest commit: 706a898

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Hi @deepshekhardas, 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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e33b0902-e8ec-4bcc-a2f1-ff97d4ebe933

📥 Commits

Reviewing files that changed from the base of the PR and between 2dd9f37 and 706a898.

📒 Files selected for processing (5)
  • apps/webapp/app/v3/eventRepository/common.server.ts
  • apps/webapp/app/v3/eventRepository/index.server.ts
  • apps/webapp/app/v3/runEngineHandlers.server.ts
  • pr-body-3321.txt
  • pr-body-3322.txt

Walkthrough

This pull request refactors nanosecond timestamp conversions across the event repository and run engine handlers to improve arithmetic precision. Functions in common.server.ts, index.server.ts, and runEngineHandlers.server.ts are updated to convert millisecond timestamps to BigInt before multiplying by 1_000_000, replacing the previous approach of performing JavaScript number multiplication first. The change applies to getNowInNanoseconds(), calculateDurationFromStart(), recordRunEvent(), and the runRetryScheduled event handler. No public API signatures are altered.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot closed this Jun 2, 2026
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread pr-body-3321.txt
Comment on lines +1 to +25
## What

This PR updates route components to use the animated Resizable panel pattern:
- Converts conditionally-rendered panels to always-mounted animated panels with `collapsible`, `collapsed`, and `collapseAnimation` props
- Adds `useFrozenValue` hook usage to keep last selected item visible during panel collapse animation
- Minor UI polish on logs, runs, schedules, waitpoints pages

## Changes

- **Resizable.tsx** — skipped (main already has these exports)
- **Route files** (logs, runs, schedules, batches, etc.) — convert panel pattern, add `useFrozenValue`
- **LogsTable, TreeView, GitMetadata** — minor improvements

## Manual resolution

Merge had 3 conflicts:
- `Resizable.tsx`: kept main's version (already has animated panel exports with Firefox workarounds)
- `logs/route.tsx` line 419: removed pointless `?? undefined` (PR's cleaner version)
- `runs.$runParam/route.tsx`: kept `panel-run-parent-v3` autosaveId, removed `?? undefined`

## Original PRs
- Original: #3267
- This replaces: #3319

Co-authored-by: James Ritchie <james@trigger.dev>
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.

🚩 Accidentally committed pr-body-*.txt files unrelated to this fix

The files pr-body-3321.txt and pr-body-3322.txt at the repository root describe entirely unrelated PRs (#3321 about animated Resizable panels, #3322 about OpenClaw agent integration). These appear to have been accidentally committed alongside the BigInt fix and should be removed before merge to avoid polluting the repository root with unrelated documentation.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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