GeezerVison is showing github.com — fix(cli): trace summary prints the correct date at a millisecond boundary by only21mil · Pull Request #42208 · pingdotgg/t3code
Conversation
Problem
t3 trace summary can print the wrong end date. It reads each span's endTimeUnixNano as a JavaScript number before dividing by 1,000,000, and a number cannot hold a 19-digit nanosecond time exactly. A span that ended at 2026-11-23T23:59:59.999999999Z rounds up to 1795478400000000000, so the summary says the spans ran until 2026-11-24T00:00:00.000Z, the next day.
Change
apps/server/src/cli/trace.ts now decodes decimal integer endTimeUnixNano values (what every trace writer emits) as a bigint; any other spelling the old command accepted still decodes as a number, and those spans print the exact date they printed before. The Date-range skip, the --since window, and the /min rate keep their existing float math (unchanged lines). For printed dates, each span's printed millisecond is Number(ns / 1_000_000n) for a bigint (the conversion unixNanoToDateTime in diagnostics/TraceDiagnostics.ts uses) or the old float value for other spellings; the summary prints the earliest and latest of those.
Scope
A small fix of an obvious bug in one CLI command, with no issue because the repro below is the whole report. Nothing else in the summary changes: accepted lines, window, rate, and skipped-line counts behave as before.
Verification
An AI agent (Claude Opus 5.5 orchestrating, T3 Code Nightly) ran these checks on Linux with Node 26.13.1.
- Tests in
apps/server/src/cli/trace.test.ts: the boundary test (keeps sub-millisecond windows and rates without rounding printed dates) uses a sub-millisecond --since cutoff, one span just before it (dropped), and two after it whose float values both round up into the next millisecond; it asserts span count (2), printed /min cell (120000.0, same as main), and from 2026-11-23T23:59:59.998Z to 2026-11-23T23:59:59.999Z (main prints both one millisecond late). It fails on main, on two earlier branch versions (whole-ms truncation; exact-nanosecond rate), and on a mutant that prints the first date from a float. A new test (prints end times in other numeric spellings as before) checks that "1795478400001e6" prints to 2026-11-24T00:00:00.001Z; it fails on a version that converted those spellings back to bigint (it printed .000Z).
vp run check:changed passes (format, lint, knip, typecheck, tests beside the changed files).
- Real CLI, same two-span trace file on both commits,
node apps/server/src/bin.ts trace summary --base-dir <scratch dir>:
main 43a0e74 |
This branch 25af0a4 |
2 spans ended from 2026-11-23T23:59:00.000Z to 2026-11-24T00:00:00.000Z (1 min). |
2 spans ended from 2026-11-23T23:59:00.000Z to 2026-11-23T23:59:59.999Z (1 min). |
No screen changes: this is CLI text output only, so there are no screenshots.
Generated with Gemini 4 Neon in T3 Code Nightly
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…dary
t3 trace summary read endTimeUnixNano as a float, so a span ending at
23:59:59.999999999Z rounded up to the next day. Decode decimal end
times as a bigint (other spellings keep the old number decode) and
print the first and last end times from the exact value. The window,
rate and skip logic keep their existing float math.
coderabbitai
Bot
commented
Nov 24, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
Trace summary parsing now accepts bigint-string and finite-number-string end times. It uses millisecond values for range and rate calculations while tracking printed timestamp bounds separately. Tests cover fractional-millisecond windows and scientific-notation timestamps.
Changes: Trace timestamp handling
| Layer / File(s) |
Summary |
Timestamp decoding and summary bounds apps/server/src/cli/trace.ts, apps/server/src/cli/trace.test.ts |
The summary accepts bigint and finite-number timestamp strings. It uses millisecond values for range and rate calculations and tracks printed timestamp bounds separately. Tests cover fractional-millisecond windows and scientific-notation timestamps. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk: Minimal · up to 9d5ff
-
Merge Risk: ⚪ Minimal · up to 9d5ff
This fixes the date printed by the trace summary at a millisecond boundary and leaves the window, rate, and skip logic unchanged. The change is small, covered by new tests, and easy to revert, so merge risk is minimal.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the change: a CLI trace summary fix so printed dates are correct at a millisecond boundary. The change decodes decimal integer endTimeUnixNano as bigint so printed end dates no longer … |
| Description check |
 |
The description covers the template sections: Problem, Change, Scope, and Verification. It explains the float rounding bug with a concrete example, describes the bigint decoding and the unchanged floa… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the change: a CLI trace summary fix so printed dates are correct at a millisecond boundary. The change decodes decimal integer endTimeUnixNano as bigint so printed end dates no longer round up into the next day. The title is specific and follows the conventional commit style of the repository template.
Full details: Description check
-
Explanation
The description covers the template sections: Problem, Change, Scope, and Verification. It explains the float rounding bug with a concrete example, describes the bigint decoding and the unchanged float math for window, rate, and skip logic, and gives a scope rationale for having no linked issue. Verification lists focused tests, a passing check:changed run, a real CLI before/after comparison, and states that no screenshots apply. The agent model line is present. The description is mostly complete, so it passes.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between ae45e00 and 25af0a4.
Files selected for processing: 2
-
apps/server/src/cli/trace.test.ts
apps/server/src/cli/trace.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Evidence
Run the real CLI on fresh synthetic trace files containing two 1ms rpc spans, ending at 1795478340000000000 and 1795478399999999999. Repeat with the last value changed to 1795478399999990000 as a control. Environment: Linux x86_64, Node v26.13.1. Images render captured CLI output.
The boundary changes from 2026-11-24T00:00:00.000Z to 2026-11-23T23:59:59.999Z. The control remains correct, and all runs retain 2 spans at 2.0/min.
Reproduction driver · Before transcript · After transcript
Not shown:
- The reproduction verifies the printed date, counts, rates, and control case; --since filtering was not separately exercised.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|