Repository navigation
fix(frontend): analytics range bounds keep their UTC designator - #5923
Conversation
toISOString().split(".")[0] dropped the trailing Z, and the value is later
re-read with dayjs(startTime) — which treats a designator-less stamp as LOCAL.
Measured against a 30-minute preset: UTC 30, Istanbul 210, New York -209,
Los Angeles -389. East of UTC the window is silently widened; west of it the
start lands in the future and fetchDashboardAnalytics throws "endTime must be
greater than or equal to startTime" instead of drawing a chart.
utcRangeStamp() joins the other date helpers and covers the preset, both
custom-range bounds and the two dashboard defaults; the all-time literal gets
the same designator.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change adds ChangesUTC timestamp standardization
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 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. Comment |
Railway Preview Environment
Updated at 2026-08-11T12:18:49.841Z |
…s interactionRows Two more of the deferred ports. Agenta-AI#5927 -- SessionCardList showed the agent name but not the automation kind, while SessionRow (which the merge updated) did. An automation row IS its schedule/subscription, so without the kind it reads as a conversation someone started. Now matches SessionRow. Agenta-AI#5942 (package half) -- loadSessionMessages already fetched the interaction lifecycle rows for replay (Agenta-AI#5919 brought that), but dropped them on the floor instead of returning them. They are now threaded out as SessionTranscript. interactionRows: records never carry a row's later lifecycle, so this is the only place an adoption guard can tell a card still awaiting the user (`pending`) from one that has ended. Also verified Agenta-AI#5923 needs NO port: the lane's toRangeInstant is functionally identical to the release's utcRangeStamp (second-precision UTC with the load-bearing Z), already used at all five sites, with ALL_TIME_START covering the epoch case. Filters/Sort.tsx does not exist on this lane. oss tsc 0 errors, mobile tsc 0 errors.
Context
Observability dashboards misbehave for anyone whose machine is not on UTC. West of UTC they fail outright: pick the 30 minutes range in New York and the query asks for a window that ends before it starts, so
fetchDashboardAnalyticsthrows "endTime must be greater than or equal to startTime" and no chart renders. East of UTC there is no error at all, just a silently wider window than the one you picked.The range bounds lose their UTC designator on the way out.
toISOString().split(".")[0]trims the milliseconds and the trailingZ, and the value is read a second time withdayjs(startTime), which treats a stamp with no designator as local time. The offset is then applied twice.Changes
utcRangeStamp()joins the other helpers indateTimeHelperand keeps the designator. It replaces the hand-rolled truncation at every site that feeds a query: the preset branch and both custom range bounds inSort.tsx, plus the two dashboard defaults innewObservability/atoms/controls.tsandobservability/dashboard.ts. The "all time" literal gets the same treatment.Before:
After:
Nothing changes on the wire. The API parses both forms with
datetime.fromisoformat, andparse_windowingstamps a naive datetime as UTC, so the server already resolved these to the same instant. The defect was entirely client side, in the second parse.Tests
Measured a 30 minute preset in four zones, comparing the duration the client computes and whether the window end lands before its start:
packages/agenta-entities/tests/integration/trace-migration.integration.test.tsstill builds designator-less bounds on purpose. Those assert the API accepts that form, which it still does, so they are left alone.What to QA
/observabilityuses the same sort control. Its 24 hour default still returns the last day.