From 2ef612556fb77c4a65d71e8c0df117b8ff8418b2 Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Tue, 21 Jul 2026 22:23:48 -0600 Subject: [PATCH 1/7] refactor: use nanosecond timestamp offsets, upgrade to echarts 6 --- ui/docs/relative-time-axis-plan.md | 124 ++++++++++++++++++ ui/packages/@quent/components/package.json | 2 +- .../@quent/components/src/dag/DagPlayhead.tsx | 21 +-- .../components/src/lib/timeline.utils.ts | 17 +-- .../operator-timeline/OperatorGanttChart.tsx | 20 +-- .../src/operator-timeline/utils.test.ts | 18 ++- .../components/src/operator-timeline/utils.ts | 12 +- .../src/timeline/ResourceTimeline.tsx | 2 - .../components/src/timeline/Timeline.tsx | 16 +-- .../src/timeline/TimelineController.tsx | 21 ++- .../components/src/timeline/TimelineRuler.tsx | 13 +- .../src/timeline/TimelineTooltip.test.tsx | 10 +- .../src/timeline/TimelineTooltip.tsx | 10 +- .../src/timeline/TimelineTooltipPortal.tsx | 6 - .../src/timeline/useVisibleMaxValue.ts | 12 +- ui/pnpm-lock.yaml | 30 ++--- ui/pnpm-workspace.yaml | 15 +-- ui/src/components/DataFlowOverlay.test.tsx | 4 +- ui/src/components/QueryPlan.tsx | 2 +- ui/src/components/QueryResourceTree.tsx | 3 +- 20 files changed, 207 insertions(+), 151 deletions(-) create mode 100644 ui/docs/relative-time-axis-plan.md diff --git a/ui/docs/relative-time-axis-plan.md b/ui/docs/relative-time-axis-plan.md new file mode 100644 index 000000000..5da609515 --- /dev/null +++ b/ui/docs/relative-time-axis-plan.md @@ -0,0 +1,124 @@ + + + +# Relative nanosecond time axis for ECharts timelines + +## Status + +**Scoped / approved for initial implementation.** This document covers only the +first slice: migrating the charts currently used in the app from an absolute +epoch-millisecond axis to a **relative nanosecond-offset** axis. Broader "make +ECharts BigInt-aware as a library" work is explicitly out of scope for now (see +[Deferred](#deferred-not-in-this-slice)). + +## Why now: the ECharts 6 driver + +The trigger for doing this slice first is that **ECharts 6 breaks our current +approach**, so this is a prerequisite for upgrading. + +### Finding (confirmed by executing 5.6.0 vs 6.1.0) + +Today every timeline chart feeds ECharts an **absolute epoch value in ms** on a +`type: 'time'` axis (`nanosToMs(startTime) + offset`). ECharts 6's `time` axis +**quantizes values to whole-millisecond (`Date`) resolution**, destroying all +sub-millisecond structure. For an identical sub-ms window (`min = startMs`, +`max = startMs + 0.00175`, 8 points 250 ns apart), `convertToPixel` returns: + +| x-axis / base epoch / window | v5.6.0 | v6.1.0 | +|---|---|---| +| `time`, `1.72e12`, `0.00175 ms` | span `0.00171`, **8/8 distinct pixels** | extent balloons to **±1 day**, **1/8** (all collapse to one pixel) | +| `time`, `0`, `0.00175 ms` | span `0.00175`, **8/8 distinct** | **±1 day**, **1/8** | +| `time`, `1.72e12`, `2 ms` | span `2`, **8/8 distinct** | span `2`, **3/8** (data snapped to whole ms) | +| `value`, `1.72e12`, `0.00175 ms` | span `0.00171`, **8/8** | span `0.00171`, **8/8 distinct** | + +Key conclusions: + +- It is **magnitude-independent** (breaks at `base = 0` too) → not a float64 + precision ceiling, but deliberate integer-ms quantization on the `time` axis. +- The **`value` axis is unaffected** — v6 preserves fractional/float spans there. +- v6 also **intermittently hangs** (synchronous multi-minute tick-generation + loops) on sub-ms `time` windows — a worse, secondary failure mode. + +Diff notes: `TimeScale.parse`, `scaleRawExtentInfo.ts`, +`axisHelper.ts#niceScaleExtent`, `data/helper/dataValueHelper.ts`, and +`util/number.ts#parseDate` are unchanged between 5.6 and 6.x. The visible +amplifier is the (identical) equal-extent guard in `src/scale/Time.ts` +`calcNiceExtent`: when the sub-ms window collapses to `min === max`, it expands +to `±ONE_DAY`, so every real point lands on the same pixel. + +### The fix, and why it is safe for our use case + +Move the ECharts numeric domain from absolute epoch ms on a `time` axis to a +**relative nanosecond offset (`ts − startTime`, as a plain integer) on a `value` +axis**. The `value` axis is the one path proven to stay correct on v6, and it +carries full precision. + +**Precision budget (float64 exact-integer range `2^53`):** + +- Exact 1 ns resolution for any query up to **`2^53` ns ≈ 104.25 days**. +- Degrades gracefully past that (2 ns at ~104–208 days, …); stays under our + `MIN_BIN_DURATION_NS = 250` floor until **~2^60 ns ≈ 36 years**. +- Real queries run seconds→minutes, i.e. **6–8 orders of magnitude** of margin. + +Bonus: today's absolute-epoch-ms ulp at `~1.72e12` is already `~244 ns` — the +very reason `MIN_BIN_DURATION_NS = 250` exists. Relative-ns replaces that +~244 ns floor with exact 1 ns, so this hack can be removed. + +## Design principle + +- BigInt lives **only at the data boundary**. A single codec converts + `bigint` ns ↔ relative `number` offset for the axis, and relative `number` ↔ + display string for labels/tooltips. +- ECharts never sees a BigInt; every timeline x-axis becomes `type: 'value'` + in the **relative-ns domain**. Zoom stays percentage-based (unchanged). +- Display formatting (elapsed durations) is unchanged — it already works in + ms/µs/ns via `@quent/utils` formatters. + +## Scope of this slice + +### In scope + +1. **Shared codec** (`@quent/utils` + `timeline.utils`), tested: + - `nsOffset(ts: bigint, origin: bigint): number` — relative offset in ns. + - `offsetToNs(offset: number, origin: bigint): bigint` — inverse for + round-tripping pointer/zoom values back to absolute BigInt. + - Offset-domain formatter helpers (wrap existing `formatDuration*`). + - Unit tests proving 1 ns / 250 ns steps stay distinct where absolute-ms + collapses them today. + +2. **Migrate the charts used in the app to the relative-ns `value` domain:** + - `Timeline.tsx` — `type: 'time'` → `type: 'value'`; `data: [offset, value]`; + `min/max` in offsets; `convertFromPixel` results are offsets (already + numeric, feed straight into `snapToBinIndex`). + - `OperatorGanttChart.tsx` — `type: 'time'` → `type: 'value'`; + `value: [startOffset, endOffset, rowIndex]`; `renderItem` `api.value(0/1)` + become offsets. + - `TimelineController.tsx` / `TimelineRuler.tsx` — already `type: 'value'` + but on absolute epoch ms; switch min/max/label math to offsets + (labels simplify to `formatDuration(offset)`). + - `DagPlayhead.tsx` — `broadcastSyncedPointer` sends an offset; the + axis-pointer registry in `timeline.utils.ts` operates in the same offset + domain so crosshair sync stays consistent. + - `operator-timeline/utils.ts` (`spanToMs`, `stackOperatorsIntoRows`) → + offset-based equivalents. + +3. **Remove / lower** `MIN_BIN_DURATION_NS` once bins are distinct at ns scale. + +4. **Coordinated landing:** all five surfaces share crosshair/zoom sync, so the + domain switch lands as one change, not per-chart. + +### Validation + +- Existing unit tests updated for the offset domain; new codec tests. +- Nanosecond timelines render distinct bins at max zoom. +- **ECharts 6 upgrade check:** re-run the v6 probe (relative-ns `value` axis → + 8/8 distinct pixels; no hang) to confirm the upgrade is unblocked. +- `pnpm ci:check` green. + +## Deferred (not in this slice) + +- Centralizing the codec + axis/formatter builders into `lib/echarts.ts` as a + reusable "BigInt time" adapter for future charts. +- Any general ECharts library extension (custom scale/axis, upstream work). + Note: native BigInt in core is impractical — its `DataStore` is backed by + `Float64Array`. diff --git a/ui/packages/@quent/components/package.json b/ui/packages/@quent/components/package.json index e44e7b39c..c653db3cb 100644 --- a/ui/packages/@quent/components/package.json +++ b/ui/packages/@quent/components/package.json @@ -26,7 +26,7 @@ "@tanstack/react-table": "^8.0.0", "@tanstack/react-virtual": "^3.0.0", "@xyflow/react": "^12.10.1", - "echarts": "^5.6.0", + "echarts": "^6.1.0", "echarts-for-react": "^3.0.6", "jotai": "^2.0.0", "react": "^19.0.0", diff --git a/ui/packages/@quent/components/src/dag/DagPlayhead.tsx b/ui/packages/@quent/components/src/dag/DagPlayhead.tsx index 3c79452f2..7c8d92422 100644 --- a/ui/packages/@quent/components/src/dag/DagPlayhead.tsx +++ b/ui/packages/@quent/components/src/dag/DagPlayhead.tsx @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; import { Pause, Play } from 'lucide-react'; import { cn, formatDurationForWindow } from '@quent/utils'; import { @@ -10,7 +10,7 @@ import { usePlayheadTimeS, useSetPlayheadTimeS, } from '@quent/hooks'; -import { broadcastSyncedPointer, hideSyncedPointer, nanosToMs } from '../lib/timeline.utils'; +import { broadcastSyncedPointer, hideSyncedPointer } from '../lib/timeline.utils'; /** Interval between play ticks; each tick advances the playhead by one bin. */ const PLAY_INTERVAL_MS = 100; @@ -18,11 +18,6 @@ const KEYBOARD_STEP_BINS = 1; const KEYBOARD_FAST_STEP_BINS = 10; interface DagPlayheadProps { - /** - * Query epoch (ns since Unix epoch). Used to broadcast a synced axis - * pointer to the timeline charts while scrubbing/playing. - */ - startTimeUnixNs: bigint; className?: string; } @@ -38,7 +33,7 @@ function formatTimeLabel(timeS: number, windowS: number): string { * changes into per-bin frames. Renders nothing when the feature is * unavailable or disabled. */ -export function DagPlayhead({ startTimeUnixNs, className }: DagPlayheadProps) { +export function DagPlayhead({ className }: DagPlayheadProps) { const enabled = useDataFlowEnabled(); const meta = useDataFlowMeta(); const playheadTimeS = usePlayheadTimeS(); @@ -51,8 +46,6 @@ export function DagPlayhead({ startTimeUnixNs, className }: DagPlayheadProps) { const playheadRef = useRef(playheadTimeS); playheadRef.current = playheadTimeS; - const startTimeMs = useMemo(() => nanosToMs(startTimeUnixNs), [startTimeUnixNs]); - const bin = meta?.bin ?? null; const clampTime = useCallback( @@ -72,9 +65,9 @@ export function DagPlayhead({ startTimeUnixNs, className }: DagPlayheadProps) { const t = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width)); const timeS = bin.startS + t * (bin.endS - bin.startS); setPlayheadTimeS(timeS); - broadcastSyncedPointer(startTimeMs + timeS * 1000); + broadcastSyncedPointer(timeS * 1000); }, - [bin, setPlayheadTimeS, startTimeMs] + [bin, setPlayheadTimeS] ); const handlePointerDown = useCallback( @@ -172,11 +165,11 @@ export function DagPlayhead({ startTimeUnixNs, className }: DagPlayheadProps) { const current = playheadRef.current ?? startS; const next = Math.min(current + binDurationS, endS); setPlayheadTimeS(next); - broadcastSyncedPointer(startTimeMs + next * 1000); + broadcastSyncedPointer(next * 1000); if (next >= endS) setIsPlaying(false); }, PLAY_INTERVAL_MS); return () => window.clearInterval(id); - }, [isPlaying, bin, setPlayheadTimeS, startTimeMs]); + }, [isPlaying, bin, setPlayheadTimeS]); // Clear the synced crosshair when playback stops. useEffect(() => { diff --git a/ui/packages/@quent/components/src/lib/timeline.utils.ts b/ui/packages/@quent/components/src/lib/timeline.utils.ts index c3a56d8c3..e99784811 100644 --- a/ui/packages/@quent/components/src/lib/timeline.utils.ts +++ b/ui/packages/@quent/components/src/lib/timeline.utils.ts @@ -71,7 +71,7 @@ export function getLongEntitiesThreshold(windowSeconds: number): number { export function buildBinnedTimelineSeries( data: ResourceTimeline, config: BinnedSpanSec, - startTime: bigint, + _startTime: bigint, theme: PaletteTheme, capacities?: CapacityDecl[], quantitySpecs?: { [key in string]?: QuantitySpec }, @@ -83,7 +83,9 @@ export function buildBinnedTimelineSeries( const { bin_duration, num_bins, span } = config; const numBinsNumber = Number(num_bins); - const firstBinMs = nanosToMs(startTime) + span.start * 1_000; + // x-domain is relative to query start (ms); span.start is already relative + // seconds, so no absolute epoch base is added — keeps values float64-exact. + const firstBinMs = span.start * 1_000; const binDurationMs = bin_duration * 1_000; const timestamps = new Array(numBinsNumber); @@ -170,7 +172,7 @@ export function getLongFsms(data: ResourceTimeline): FiniteStateMachine[] { */ export function buildTimelineMarks( longFsms: FiniteStateMachine[], - startTime: bigint, + _startTime: bigint, theme: PaletteTheme, resourceIdsForFilter?: Set | null, fsmTypes?: { [key in string]?: FsmTypeDecl }, @@ -180,7 +182,6 @@ export function buildTimelineMarks( ): TimelineMark[] | undefined { if (longFsms.length === 0) return undefined; - const startTimeMs = nanosToMs(startTime); const colorFsm = createFsmTypeColorFn(fsmTypes ?? {}, theme); const marks = longFsms.flatMap(fsm => { @@ -196,8 +197,8 @@ export function buildTimelineMarks( return null; } const next = fsm.transitions[i + 1]; - const xStart = startTimeMs + transition.timestamp * 1000; - const xEnd = startTimeMs + next.timestamp * 1000; + const xStart = transition.timestamp * 1000; + const xEnd = next.timestamp * 1000; const color = colorFsm(transition.name); return { label, @@ -473,8 +474,8 @@ function broadcastHidePointer(source: EChartsInstance | null) { } /** - * Broadcast a synced axis-pointer crosshair at `timestampMs` (epoch ms) to - * every registered timeline chart, without a source chart. Used by the DAG + * Broadcast a synced axis-pointer crosshair at `timestampMs` (ms relative to + * query start) to every registered timeline chart, without a source chart. Used by the DAG * playhead so scrubbing/playing draws a crosshair on the right-panel * timelines with zero React re-renders. */ diff --git a/ui/packages/@quent/components/src/operator-timeline/OperatorGanttChart.tsx b/ui/packages/@quent/components/src/operator-timeline/OperatorGanttChart.tsx index 989019b0d..91818cdd4 100644 --- a/ui/packages/@quent/components/src/operator-timeline/OperatorGanttChart.tsx +++ b/ui/packages/@quent/components/src/operator-timeline/OperatorGanttChart.tsx @@ -7,11 +7,7 @@ import EChartsReactCore from 'echarts-for-react/lib/core'; import type { EChartsOption } from '../lib/echarts'; import type { EChartsInstance } from 'echarts-for-react'; import type { CustomSeriesOption } from 'echarts/charts'; -import { - nanosToMs, - registerAxisPointerSync, - unregisterAxisPointerSync, -} from '../lib/timeline.utils'; +import { registerAxisPointerSync, unregisterAxisPointerSync } from '../lib/timeline.utils'; import { useChartConnect } from '../lib/useChartConnect'; import { echarts } from '../lib/echarts'; import { CHART_GROUP } from '../timeline/Timeline'; @@ -45,7 +41,6 @@ function getOperatorBarColors(typeName: string | undefined): { fill: string; str export interface OperatorGanttChartProps { operators: OperatorActiveSpanEntry[]; - startTime: bigint; durationSeconds: number; height?: number; /** Whether dark mode is active. Passed explicitly to decouple from ThemeContext. */ @@ -54,7 +49,6 @@ export interface OperatorGanttChartProps { export function OperatorGanttChart({ operators, - startTime, durationSeconds, height = DEFAULT_HEIGHT, isDark, @@ -68,11 +62,7 @@ export function OperatorGanttChart({ const [nodePalette] = useNodeColorPalette(); const barLabelTextColor = textColor; const selectedNodeIds = useSelectedNodeIds(); - const startTimeMs = useMemo(() => nanosToMs(startTime), [startTime]); - const xAxisMax = useMemo( - () => startTimeMs + durationSeconds * 1_000, - [startTimeMs, durationSeconds] - ); + const xAxisMax = useMemo(() => durationSeconds * 1_000, [durationSeconds]); const { yAxisCategories, rowCount } = useMemo(() => { if (operators.length === 0) return { yAxisCategories: [] as number[], rowCount: 0 }; @@ -224,8 +214,8 @@ export function OperatorGanttChart({ }, grid: gridOptions, xAxis: { - type: 'time', - min: startTimeMs, + type: 'value', + min: 0, max: xAxisMax, show: true, axisLabel: { show: false }, @@ -284,7 +274,7 @@ export function OperatorGanttChart({ }, ], }), - [gridOptions, startTimeMs, xAxisMax, yAxisCategories, customSeriesData, renderItem] + [gridOptions, xAxisMax, yAxisCategories, customSeriesData, renderItem] ); const handleClick = useMemo( diff --git a/ui/packages/@quent/components/src/operator-timeline/utils.test.ts b/ui/packages/@quent/components/src/operator-timeline/utils.test.ts index 6d76876fd..4eac00064 100644 --- a/ui/packages/@quent/components/src/operator-timeline/utils.test.ts +++ b/ui/packages/@quent/components/src/operator-timeline/utils.test.ts @@ -299,31 +299,29 @@ describe('stackOperatorsIntoRows', () => { // ---- spanToMs -------------------------------------------------------------- describe('spanToMs', () => { - it('converts a zero span at epoch zero to {startMs: 0, endMs: 0}', () => { + it('converts a zero span to {startMs: 0, endMs: 0}', () => { expect(spanToMs({ start: 0, end: 0 }, 0n)).toEqual({ startMs: 0, endMs: 0 }); }); - it('converts span seconds to milliseconds offset from startTimeNs', () => { - // startTimeNs = 1ms = 1_000_000n, span = {start: 1s, end: 2s} + it('converts span seconds to relative milliseconds (startTimeNs is ignored)', () => { + // span = {start: 1s, end: 2s}; offsets are relative to query start. expect(spanToMs({ start: 1, end: 2 }, 1_000_000n)).toEqual({ - startMs: 1001, - endMs: 2001, + startMs: 1000, + endMs: 2000, }); }); it('handles fractional seconds in the span', () => { - // startTimeNs = 0, span = {start: 0.5s, end: 1.5s} expect(spanToMs({ start: 0.5, end: 1.5 }, 0n)).toEqual({ startMs: 500, endMs: 1500, }); }); - it('handles a large epoch startTimeNs', () => { - // 1 second = 1_000_000_000n ns → 1000ms; span adds 0 + it('ignores a large epoch startTimeNs (domain is relative)', () => { expect(spanToMs({ start: 0, end: 0 }, 1_000_000_000n)).toEqual({ - startMs: 1000, - endMs: 1000, + startMs: 0, + endMs: 0, }); }); }); diff --git a/ui/packages/@quent/components/src/operator-timeline/utils.ts b/ui/packages/@quent/components/src/operator-timeline/utils.ts index a87ff7a34..e814a87d8 100644 --- a/ui/packages/@quent/components/src/operator-timeline/utils.ts +++ b/ui/packages/@quent/components/src/operator-timeline/utils.ts @@ -6,7 +6,6 @@ import type { EntityRef } from '@quent/utils'; import type { Operator } from '@quent/utils'; import type { PlanTree } from '@quent/utils'; import type { OperatorActiveSpanEntry } from './types'; -import { nanosToMs } from '../lib/timeline.utils'; import { parseCustomStatistics } from '../lib/queryBundle.utils'; /** Clip a rect to bounds (same behavior as ECharts custom-gantt-flight example). */ @@ -94,15 +93,16 @@ export function stackOperatorsIntoRows< } /** - * SpanSec from the API is in seconds relative to query start (epoch). - * Convert to absolute ms using query start time. + * SpanSec from the API is in seconds relative to query start. + * Returns ms offsets relative to query start (no absolute epoch base) so the + * chart x-domain stays float64-exact. */ export function spanToMs( span: { start: number; end: number }, - startTimeNs: bigint + _startTimeNs: bigint ): { startMs: number; endMs: number } { - const startMs = nanosToMs(startTimeNs) + span.start * 1_000; - const endMs = nanosToMs(startTimeNs) + span.end * 1_000; + const startMs = span.start * 1_000; + const endMs = span.end * 1_000; return { startMs, endMs }; } diff --git a/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx b/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx index 07557d75c..cbdb9f4a5 100644 --- a/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx +++ b/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx @@ -314,7 +314,6 @@ export function ResourceTimeline({ )} diff --git a/ui/packages/@quent/components/src/timeline/Timeline.tsx b/ui/packages/@quent/components/src/timeline/Timeline.tsx index 758581870..f66199fcd 100644 --- a/ui/packages/@quent/components/src/timeline/Timeline.tsx +++ b/ui/packages/@quent/components/src/timeline/Timeline.tsx @@ -19,7 +19,7 @@ import { TIMELINE_MONO_FONT, useTimelineEchartsTheme, } from './timelineEchartsTheme'; -import { MIN_ZOOM_WINDOW_S, nanosToMs } from '../lib/timeline.utils'; +import { MIN_ZOOM_WINDOW_S } from '../lib/timeline.utils'; import { useVisibleMaxValue } from './useVisibleMaxValue'; import { useChartConnect } from '../lib/useChartConnect'; import { Opts } from 'echarts-for-react/lib/types'; @@ -40,7 +40,6 @@ export interface TimelineHoverPosition { /** Stacked-area timeline chart backed by ECharts, with zoom sync and optional tooltip. */ export function Timeline({ - startTime, durationSeconds, series, timestamps, @@ -49,7 +48,6 @@ export function Timeline({ isDark, onHoverChange, }: { - startTime: bigint; /** Full query duration — used to set xAxis range so dataZoom percentages align across all connected charts */ durationSeconds: number; series: TimelineSeries; @@ -177,9 +175,7 @@ export function Timeline({ return (v: number) => firstEntry?.formatter(v, 0) ?? String(v); }, [series]); - const startTimeMs = useMemo(() => nanosToMs(startTime), [startTime]); - - const maxValue = useVisibleMaxValue(series, timestamps, startTimeMs); + const maxValue = useVisibleMaxValue(series, timestamps); const yAxisOptions = useMemo( () => [ @@ -206,11 +202,11 @@ export function Timeline({ const xAxisOptions = useMemo( () => ({ boundaryGap: [0, 0] as [number, number], - type: 'time', + type: 'value', animation: false, show: true, - min: startTimeMs, - max: startTimeMs + durationSeconds * 1_000, + min: 0, + max: durationSeconds * 1_000, axisLine: { onZero: true }, axisLabel: { show: false }, axisPointer: { @@ -220,7 +216,7 @@ export function Timeline({ label: { show: false }, }, }), - [startTimeMs, durationSeconds] + [durationSeconds] ); const gridOptions = useMemo(() => ({ ...TIMELINE_SPACING }), []); diff --git a/ui/packages/@quent/components/src/timeline/TimelineController.tsx b/ui/packages/@quent/components/src/timeline/TimelineController.tsx index e823cd0d7..0aa9ef9d7 100644 --- a/ui/packages/@quent/components/src/timeline/TimelineController.tsx +++ b/ui/packages/@quent/components/src/timeline/TimelineController.tsx @@ -14,7 +14,6 @@ import { getAdaptiveNumBins, getTimelineXAxisIntervalMs, MIN_ZOOM_WINDOW_S, - nanosToMs, registerAxisPointerSync, unregisterAxisPointerSync, } from '../lib/timeline.utils'; @@ -60,8 +59,6 @@ export function TimelineController({ const { themeName, controllerGridBackgroundColor } = useTimelineEchartsTheme(isDark); const paletteTheme: PaletteTheme = isDark ? 'dark' : 'light'; - const startTimeMillis = useMemo(() => nanosToMs(startTime), [startTime]); - const { timestamps, seriesData } = useMemo(() => { if (timelineData) { const { timestamps: ts, series } = buildBinnedTimelineSeries( @@ -76,10 +73,10 @@ export function TimelineController({ } else { const numBins = getAdaptiveNumBins(); const binDurationMs = (durationSeconds * 1000) / numBins; - const ts = Array.from({ length: numBins }, (_, i) => startTimeMillis + i * binDurationMs); + const ts = Array.from({ length: numBins }, (_, i) => i * binDurationMs); return { timestamps: ts, seriesData: null }; } - }, [timelineData, startTime, startTimeMillis, durationSeconds, paletteTheme]); + }, [timelineData, startTime, durationSeconds, paletteTheme]); const hasSeriesData = useMemo(() => Boolean(seriesData && seriesData.length > 0), [seriesData]); @@ -123,7 +120,7 @@ export function TimelineController({ return [staticDisplaySeries, zoomControlSeries]; }, [timestamps, hasSeriesData, seriesData]); - const endTimeMillis = startTimeMillis + durationSeconds * 1000; + const endTimeMillis = durationSeconds * 1000; // Measured container width drives the label-count budget so narrow viewports don't crowd the axis. const containerRef = useRef(null); @@ -148,14 +145,14 @@ export function TimelineController({ CONTROLLER_MAX_LABELS, Math.max(CONTROLLER_MIN_LABELS, labelBudget) ); - const interval = getTimelineXAxisIntervalMs(endTimeMillis - startTimeMillis, targetSplits); + const interval = getTimelineXAxisIntervalMs(endTimeMillis, targetSplits); return { boundaryGap: [0, 0] as [number, number], type: 'value', show: true, position: 'top', - min: startTimeMillis, + min: 0, max: endTimeMillis, interval, // Re-enable ticks the shared theme disables; default `inside: false` @@ -167,7 +164,7 @@ export function TimelineController({ alignMinLabel: 'left', alignMaxLabel: 'right', formatter: (value: number) => { - return formatDuration(Number(value) - startTimeMillis); + return formatDuration(Number(value)); }, }, splitLine: { show: true, lineStyle: { type: 'solid' } }, @@ -179,14 +176,14 @@ export function TimelineController({ handle: { show: false }, }, }; - }, [startTimeMillis, endTimeMillis, containerWidth]); + }, [endTimeMillis, containerWidth]); const zoomXAxisOptions = useMemo( () => ({ boundaryGap: [0, 0] as [number, number], type: 'value', show: false, - min: startTimeMillis, + min: 0, max: endTimeMillis, axisLine: { show: false }, axisTick: { show: false }, @@ -195,7 +192,7 @@ export function TimelineController({ // Suppress pointer on the dataZoom'd axis — only xAxis[0] draws the crosshair. axisPointer: { show: false }, }), - [startTimeMillis, endTimeMillis] + [endTimeMillis] ); const yAxisOptions = useMemo(() => { diff --git a/ui/packages/@quent/components/src/timeline/TimelineRuler.tsx b/ui/packages/@quent/components/src/timeline/TimelineRuler.tsx index 20b0e4741..078fd9376 100644 --- a/ui/packages/@quent/components/src/timeline/TimelineRuler.tsx +++ b/ui/packages/@quent/components/src/timeline/TimelineRuler.tsx @@ -7,7 +7,7 @@ import { echarts } from '../lib/echarts'; import type { EChartsOption } from '../lib/echarts'; import { useZoomRange } from '@quent/hooks'; import { formatDurationForAxisInterval } from '@quent/utils'; -import { nanosToMs, getTimelineXAxisIntervalMs, MIN_ZOOM_WINDOW_S } from '../lib/timeline.utils'; +import { getTimelineXAxisIntervalMs, MIN_ZOOM_WINDOW_S } from '../lib/timeline.utils'; import { useChartResize } from '../lib/useChartResize'; import { useTimelineEchartsTheme, @@ -28,21 +28,19 @@ const RULER_GRID_TOP = 20; export type TimelineRulerMode = 'absolute' | 'relative'; type TimelineRulerProps = { - startTime: bigint; isDark: boolean; mode?: TimelineRulerMode; }; /** Sticky axis ruler showing elapsed time for the current zoom window. */ -export function TimelineRuler({ startTime, isDark, mode = 'relative' }: TimelineRulerProps) { +export function TimelineRuler({ isDark, mode = 'relative' }: TimelineRulerProps) { const { themeName, axisTickColor, axisLabelColor, solidLabelBackgroundColor } = useTimelineEchartsTheme(isDark); const { handleChartReady } = useChartResize(); - const startTimeMs = useMemo(() => nanosToMs(startTime), [startTime]); const zoomRange = useZoomRange(); - const zoomedStartMs = startTimeMs + zoomRange.start * 1000; - const zoomedEndMs = startTimeMs + zoomRange.end * 1000; + const zoomedStartMs = zoomRange.start * 1000; + const zoomedEndMs = zoomRange.end * 1000; const zoomedSpanMs = Math.max(zoomedEndMs - zoomedStartMs, MIN_ZOOM_WINDOW_S * 1000); const interval = useMemo( @@ -52,7 +50,7 @@ export function TimelineRuler({ startTime, isDark, mode = 'relative' }: Timeline const option: EChartsOption = useMemo(() => { const formatLabel = (value: number): string => { - const absoluteMs = value - startTimeMs; + const absoluteMs = value; const relativeMs = value - zoomedStartMs; const isMinMax = value === zoomedStartMs || value === zoomedEndMs; @@ -135,7 +133,6 @@ export function TimelineRuler({ startTime, isDark, mode = 'relative' }: Timeline zoomedStartMs, zoomedEndMs, interval, - startTimeMs, axisTickColor, axisLabelColor, solidLabelBackgroundColor, diff --git a/ui/packages/@quent/components/src/timeline/TimelineTooltip.test.tsx b/ui/packages/@quent/components/src/timeline/TimelineTooltip.test.tsx index 815a3b9fa..3d57b072b 100644 --- a/ui/packages/@quent/components/src/timeline/TimelineTooltip.test.tsx +++ b/ui/packages/@quent/components/src/timeline/TimelineTooltip.test.tsx @@ -14,15 +14,7 @@ describe('TooltipContent active marks', () => { const series = [{ color: '#8884d8', name: 'computing', value: 1 }]; const renderWithMarks = (marks: ActiveMark[]) => - render( - - ); + render(); it('renders attribute rows with byte and rate formatting', () => { renderWithMarks([ diff --git a/ui/packages/@quent/components/src/timeline/TimelineTooltip.tsx b/ui/packages/@quent/components/src/timeline/TimelineTooltip.tsx index 3c9972b69..89806b483 100644 --- a/ui/packages/@quent/components/src/timeline/TimelineTooltip.tsx +++ b/ui/packages/@quent/components/src/timeline/TimelineTooltip.tsx @@ -8,7 +8,6 @@ import { cn, type DynamicAttribute, } from '@quent/utils'; -import { nanosToMs } from '../lib/timeline.utils'; import { DataText } from '../ui/data-text'; /** A timeline mark under the hover cursor, as shown in the tooltip. */ @@ -251,14 +250,12 @@ function ActiveMarksSection({ marks }: { marks: ActiveMark[] }) { function OverlayBarTooltip({ timestamp, bars, - startTime, fmt, windowMs, activeMarks, }: { timestamp: number; bars: StateBar[]; - startTime: bigint; fmt: ValueFormatter; windowMs: number; activeMarks?: ActiveMark[]; @@ -275,7 +272,7 @@ function OverlayBarTooltip({ )} > - {formatDurationForWindow(timestamp - nanosToMs(startTime), windowMs)} + {formatDurationForWindow(timestamp, windowMs)}
- {formatDurationForWindow(timestamp - nanosToMs(startTime), windowMs)} + {formatDurationForWindow(timestamp, windowMs)}
    {series diff --git a/ui/packages/@quent/components/src/timeline/TimelineTooltipPortal.tsx b/ui/packages/@quent/components/src/timeline/TimelineTooltipPortal.tsx index ff5705867..ddbe2f905 100644 --- a/ui/packages/@quent/components/src/timeline/TimelineTooltipPortal.tsx +++ b/ui/packages/@quent/components/src/timeline/TimelineTooltipPortal.tsx @@ -21,14 +21,12 @@ export function TimelineTooltipPortal({ series, timestamps, marks, - startTime, }: { /** Stable id of the Timeline that owns this portal. */ ownerId: string; series: TimelineSeries; timestamps: number[]; marks?: TimelineMark[]; - startTime: bigint; }) { const hover = useTimelineHover(); const zoomRange = useZoomRange(); @@ -49,7 +47,6 @@ export function TimelineTooltipPortal({ series={series} timestamps={timestamps} marks={marks} - startTime={startTime} windowMs={(zoomRange.end - zoomRange.start) * 1000} /> ); @@ -62,7 +59,6 @@ function PositionedTooltip({ series, timestamps, marks, - startTime, windowMs, }: { clientX: number; @@ -71,7 +67,6 @@ function PositionedTooltip({ series: TimelineSeries; timestamps: number[]; marks?: TimelineMark[]; - startTime: bigint; windowMs: number; }) { const { snappedTimestamp, tooltipSeries, activeMarks } = useMemo(() => { @@ -141,7 +136,6 @@ function PositionedTooltip({ { - const zoomStartMs = startTimeMs + zoomRange.start * 1000; - const zoomEndMs = startTimeMs + zoomRange.end * 1000; + const zoomStartMs = zoomRange.start * 1000; + const zoomEndMs = zoomRange.end * 1000; return computeVisibleMaxValue(series, timestamps, zoomStartMs, zoomEndMs); - }, [series, timestamps, startTimeMs, zoomRange]); + }, [series, timestamps, zoomRange]); } diff --git a/ui/pnpm-lock.yaml b/ui/pnpm-lock.yaml index 76cc4232b..333b0cdc5 100644 --- a/ui/pnpm-lock.yaml +++ b/ui/pnpm-lock.yaml @@ -31,8 +31,8 @@ catalogs: specifier: ^2.1.1 version: 2.1.1 echarts: - specifier: ^5.6.0 - version: 5.6.0 + specifier: ^6.1.0 + version: 6.1.0 echarts-for-react: specifier: ^3.0.6 version: 3.0.6 @@ -133,10 +133,10 @@ importers: version: 2.1.1 echarts: specifier: 'catalog:' - version: 5.6.0 + version: 6.1.0 echarts-for-react: specifier: 'catalog:' - version: 3.0.6(echarts@5.6.0)(react@19.2.7) + version: 3.0.6(echarts@6.1.0)(react@19.2.7) elkjs: specifier: ^0.11.1 version: 0.11.1 @@ -313,10 +313,10 @@ importers: version: 12.10.1(@types/react@19.2.14)(react-dom@19.2.7(react@19.2.7))(react@19.2.7) echarts: specifier: 'catalog:' - version: 5.6.0 + version: 6.1.0 echarts-for-react: specifier: 'catalog:' - version: 3.0.6(echarts@5.6.0)(react@19.2.7) + version: 3.0.6(echarts@6.1.0)(react@19.2.7) jotai: specifier: 'catalog:' version: 2.20.1(@babel/core@8.0.1)(@babel/template@8.0.0)(@types/react@19.2.14)(react@19.2.7) @@ -2646,8 +2646,8 @@ packages: echarts: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 react: ^15.0.0 || >=16.0.0 - echarts@5.6.0: - resolution: {integrity: sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==} + echarts@6.1.0: + resolution: {integrity: sha512-q0yaFPggC9FUdsWH4blavRWFmxdrIodbkoKNAjJudAI6CA9gNPxHtV2RcZNEepZVlk4yvBYkOkbk6HIVpIyHZA==} electron-to-chromium@1.5.307: resolution: {integrity: sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg==} @@ -3969,8 +3969,8 @@ packages: zod@4.4.3: resolution: {integrity: sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==} - zrender@5.6.1: - resolution: {integrity: sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==} + zrender@6.1.0: + resolution: {integrity: sha512-oEGMDB6pOP2S6OwRR4PdVv610zrjnA3Bh+JnSG12fYJlBKjtNAoEb5fSUoCOOINlH96I2fU38/A2UpRKs67xYQ==} zustand@4.5.7: resolution: {integrity: sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==} @@ -6112,17 +6112,17 @@ snapshots: dts-resolver@3.0.0: {} - echarts-for-react@3.0.6(echarts@5.6.0)(react@19.2.7): + echarts-for-react@3.0.6(echarts@6.1.0)(react@19.2.7): dependencies: - echarts: 5.6.0 + echarts: 6.1.0 fast-deep-equal: 3.1.3 react: 19.2.7 size-sensor: 1.0.3 - echarts@5.6.0: + echarts@6.1.0: dependencies: tslib: 2.3.0 - zrender: 5.6.1 + zrender: 6.1.0 electron-to-chromium@1.5.307: {} @@ -7306,7 +7306,7 @@ snapshots: zod@4.4.3: {} - zrender@5.6.1: + zrender@6.1.0: dependencies: tslib: 2.3.0 diff --git a/ui/pnpm-workspace.yaml b/ui/pnpm-workspace.yaml index c6961cb22..d8c8f27f7 100644 --- a/ui/pnpm-workspace.yaml +++ b/ui/pnpm-workspace.yaml @@ -16,7 +16,7 @@ catalog: '@types/react-dom': ^19.2.3 '@xyflow/react': ^12.10.1 clsx: ^2.1.1 - echarts: ^5.6.0 + echarts: ^6.1.0 echarts-for-react: ^3.0.6 jotai: ^2.20.1 jotai-family: ^1.0.2 @@ -32,16 +32,3 @@ allowBuilds: esbuild: true msw: true protobufjs: true - -# Advisories that `pnpm audit` should drop from its failure list. -# Each entry MUST be paired with a same-key comment explaining why it is safe -# to ignore and what the exit criteria for removing it are. -auditConfig: - ignoreGhsas: - # GHSA-fgmj-fm8m-jvvx / CVE-2026-45249 — echarts <6.1.0 XSS via the Lines- - # series default tooltip. Requires (a) `type: 'lines'`, (b) no custom - # `tooltip.formatter`, (c) raw HTML in `series.data[i].name`. Quent uses - # `type: 'line'`, `custom`, and `sankey` — no `type: 'lines'` anywhere — - # so the vulnerable code path is unreachable. Remove this entry when we - # bump to echarts 6.1.0 (pending v5→v6 migration). - - GHSA-fgmj-fm8m-jvvx diff --git a/ui/src/components/DataFlowOverlay.test.tsx b/ui/src/components/DataFlowOverlay.test.tsx index 279fed0bc..2d28da844 100644 --- a/ui/src/components/DataFlowOverlay.test.tsx +++ b/ui/src/components/DataFlowOverlay.test.tsx @@ -156,7 +156,7 @@ function Harness({ return ( children ?? ( <> - + ) @@ -456,7 +456,7 @@ describe('DAGLegend under tier selection', () => { return render( - + diff --git a/ui/src/components/QueryPlan.tsx b/ui/src/components/QueryPlan.tsx index 11d0be1a4..fd4b89fcc 100644 --- a/ui/src/components/QueryPlan.tsx +++ b/ui/src/components/QueryPlan.tsx @@ -213,7 +213,7 @@ export function QueryPlan({ queryId, engineId }: { queryId: string; engineId: st
- + diff --git a/ui/src/components/QueryResourceTree.tsx b/ui/src/components/QueryResourceTree.tsx index 4c171093f..0651eff20 100644 --- a/ui/src/components/QueryResourceTree.tsx +++ b/ui/src/components/QueryResourceTree.tsx @@ -258,7 +258,7 @@ function QueryResourceTreeContent({ queryBundle, engineId }: QueryResourceTreePr /> ), - subHeaderContent: , + subHeaderContent: , render: ({ item }: { item: TreeTableItem }) => { switch (item.type) { case OPERATOR_TIMELINE_ROW_TYPE: { @@ -268,7 +268,6 @@ function QueryResourceTreeContent({ queryBundle, engineId }: QueryResourceTreePr return ( Date: Tue, 21 Jul 2026 22:43:26 -0600 Subject: [PATCH 2/7] refactor: min bin size -> 1ns --- ui/packages/@quent/components/src/lib/timeline.utils.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/packages/@quent/components/src/lib/timeline.utils.ts b/ui/packages/@quent/components/src/lib/timeline.utils.ts index e99784811..843757d6d 100644 --- a/ui/packages/@quent/components/src/lib/timeline.utils.ts +++ b/ui/packages/@quent/components/src/lib/timeline.utils.ts @@ -38,13 +38,12 @@ import { MAX_TIMELINE_BINS } from '@quent/utils'; void getColorForKey; const LONG_ENTITIES_BIN_MULTIPLIER = 30; -/** Minimum bin duration in nanoseconds — prevents ECharts from stacking bins when zoomed too far. */ -export const MIN_BIN_DURATION_NS = 250; +/** Minimum bin duration in nanoseconds — the backend cannot produce sub-1ns bins. */ +export const MIN_BIN_DURATION_NS = 1; /** - * Minimum visible zoom window in seconds. - * Below this, each bin would cover less than MIN_BIN_DURATION_NS nanoseconds. - * 10 ns/bin × 400 bins = 4 μs + * Minimum visible zoom window in seconds: the smallest window the backend can + * bin at 1 ns/bin. 1 ns/bin × MAX_TIMELINE_BINS bins. */ export const MIN_ZOOM_WINDOW_S = (MIN_BIN_DURATION_NS * MAX_TIMELINE_BINS) / 1_000_000_000; From c2cecb12db9ebdd85a6cf9fbf801eedf6ad6bde9 Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Thu, 23 Jul 2026 16:56:45 -0600 Subject: [PATCH 3/7] refactor: slightly larger (10ns) bins, ditch markers on top of series for cleaner look --- ui/packages/@quent/components/src/lib/timeline.utils.ts | 2 +- ui/packages/@quent/components/src/timeline/Timeline.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/packages/@quent/components/src/lib/timeline.utils.ts b/ui/packages/@quent/components/src/lib/timeline.utils.ts index 843757d6d..315ea7d6e 100644 --- a/ui/packages/@quent/components/src/lib/timeline.utils.ts +++ b/ui/packages/@quent/components/src/lib/timeline.utils.ts @@ -39,7 +39,7 @@ void getColorForKey; const LONG_ENTITIES_BIN_MULTIPLIER = 30; /** Minimum bin duration in nanoseconds — the backend cannot produce sub-1ns bins. */ -export const MIN_BIN_DURATION_NS = 1; +export const MIN_BIN_DURATION_NS = 10; /** * Minimum visible zoom window in seconds: the smallest window the backend can diff --git a/ui/packages/@quent/components/src/timeline/Timeline.tsx b/ui/packages/@quent/components/src/timeline/Timeline.tsx index f66199fcd..eb1165100 100644 --- a/ui/packages/@quent/components/src/timeline/Timeline.tsx +++ b/ui/packages/@quent/components/src/timeline/Timeline.tsx @@ -80,8 +80,8 @@ export function Timeline({ type: 'line', stack: isOverlay ? `overlay-total` : 'total', step: 'middle', - symbol: 'circle', - symbolSize: (value: number[]) => (value[1] === 0 || isOverlay ? 0 : 4), + // `'none'` (not just showSymbol:false) so ECharts doesn't pop a symbol on hover. + symbol: 'none', hoverAnimation: false, showSymbol: false, ...TIMELINE_X_AXIS_ANIMATION, From 53812e495ae5ba5d196d3ea7c6d2c4be5b210d11 Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Thu, 23 Jul 2026 16:59:13 -0600 Subject: [PATCH 4/7] chore: drop relative-time-axis planning doc from branch Planning note accidentally committed with the echarts 6 upgrade; not part of the shipped change. --- ui/docs/relative-time-axis-plan.md | 124 ----------------------------- 1 file changed, 124 deletions(-) delete mode 100644 ui/docs/relative-time-axis-plan.md diff --git a/ui/docs/relative-time-axis-plan.md b/ui/docs/relative-time-axis-plan.md deleted file mode 100644 index 5da609515..000000000 --- a/ui/docs/relative-time-axis-plan.md +++ /dev/null @@ -1,124 +0,0 @@ - - - -# Relative nanosecond time axis for ECharts timelines - -## Status - -**Scoped / approved for initial implementation.** This document covers only the -first slice: migrating the charts currently used in the app from an absolute -epoch-millisecond axis to a **relative nanosecond-offset** axis. Broader "make -ECharts BigInt-aware as a library" work is explicitly out of scope for now (see -[Deferred](#deferred-not-in-this-slice)). - -## Why now: the ECharts 6 driver - -The trigger for doing this slice first is that **ECharts 6 breaks our current -approach**, so this is a prerequisite for upgrading. - -### Finding (confirmed by executing 5.6.0 vs 6.1.0) - -Today every timeline chart feeds ECharts an **absolute epoch value in ms** on a -`type: 'time'` axis (`nanosToMs(startTime) + offset`). ECharts 6's `time` axis -**quantizes values to whole-millisecond (`Date`) resolution**, destroying all -sub-millisecond structure. For an identical sub-ms window (`min = startMs`, -`max = startMs + 0.00175`, 8 points 250 ns apart), `convertToPixel` returns: - -| x-axis / base epoch / window | v5.6.0 | v6.1.0 | -|---|---|---| -| `time`, `1.72e12`, `0.00175 ms` | span `0.00171`, **8/8 distinct pixels** | extent balloons to **±1 day**, **1/8** (all collapse to one pixel) | -| `time`, `0`, `0.00175 ms` | span `0.00175`, **8/8 distinct** | **±1 day**, **1/8** | -| `time`, `1.72e12`, `2 ms` | span `2`, **8/8 distinct** | span `2`, **3/8** (data snapped to whole ms) | -| `value`, `1.72e12`, `0.00175 ms` | span `0.00171`, **8/8** | span `0.00171`, **8/8 distinct** | - -Key conclusions: - -- It is **magnitude-independent** (breaks at `base = 0` too) → not a float64 - precision ceiling, but deliberate integer-ms quantization on the `time` axis. -- The **`value` axis is unaffected** — v6 preserves fractional/float spans there. -- v6 also **intermittently hangs** (synchronous multi-minute tick-generation - loops) on sub-ms `time` windows — a worse, secondary failure mode. - -Diff notes: `TimeScale.parse`, `scaleRawExtentInfo.ts`, -`axisHelper.ts#niceScaleExtent`, `data/helper/dataValueHelper.ts`, and -`util/number.ts#parseDate` are unchanged between 5.6 and 6.x. The visible -amplifier is the (identical) equal-extent guard in `src/scale/Time.ts` -`calcNiceExtent`: when the sub-ms window collapses to `min === max`, it expands -to `±ONE_DAY`, so every real point lands on the same pixel. - -### The fix, and why it is safe for our use case - -Move the ECharts numeric domain from absolute epoch ms on a `time` axis to a -**relative nanosecond offset (`ts − startTime`, as a plain integer) on a `value` -axis**. The `value` axis is the one path proven to stay correct on v6, and it -carries full precision. - -**Precision budget (float64 exact-integer range `2^53`):** - -- Exact 1 ns resolution for any query up to **`2^53` ns ≈ 104.25 days**. -- Degrades gracefully past that (2 ns at ~104–208 days, …); stays under our - `MIN_BIN_DURATION_NS = 250` floor until **~2^60 ns ≈ 36 years**. -- Real queries run seconds→minutes, i.e. **6–8 orders of magnitude** of margin. - -Bonus: today's absolute-epoch-ms ulp at `~1.72e12` is already `~244 ns` — the -very reason `MIN_BIN_DURATION_NS = 250` exists. Relative-ns replaces that -~244 ns floor with exact 1 ns, so this hack can be removed. - -## Design principle - -- BigInt lives **only at the data boundary**. A single codec converts - `bigint` ns ↔ relative `number` offset for the axis, and relative `number` ↔ - display string for labels/tooltips. -- ECharts never sees a BigInt; every timeline x-axis becomes `type: 'value'` - in the **relative-ns domain**. Zoom stays percentage-based (unchanged). -- Display formatting (elapsed durations) is unchanged — it already works in - ms/µs/ns via `@quent/utils` formatters. - -## Scope of this slice - -### In scope - -1. **Shared codec** (`@quent/utils` + `timeline.utils`), tested: - - `nsOffset(ts: bigint, origin: bigint): number` — relative offset in ns. - - `offsetToNs(offset: number, origin: bigint): bigint` — inverse for - round-tripping pointer/zoom values back to absolute BigInt. - - Offset-domain formatter helpers (wrap existing `formatDuration*`). - - Unit tests proving 1 ns / 250 ns steps stay distinct where absolute-ms - collapses them today. - -2. **Migrate the charts used in the app to the relative-ns `value` domain:** - - `Timeline.tsx` — `type: 'time'` → `type: 'value'`; `data: [offset, value]`; - `min/max` in offsets; `convertFromPixel` results are offsets (already - numeric, feed straight into `snapToBinIndex`). - - `OperatorGanttChart.tsx` — `type: 'time'` → `type: 'value'`; - `value: [startOffset, endOffset, rowIndex]`; `renderItem` `api.value(0/1)` - become offsets. - - `TimelineController.tsx` / `TimelineRuler.tsx` — already `type: 'value'` - but on absolute epoch ms; switch min/max/label math to offsets - (labels simplify to `formatDuration(offset)`). - - `DagPlayhead.tsx` — `broadcastSyncedPointer` sends an offset; the - axis-pointer registry in `timeline.utils.ts` operates in the same offset - domain so crosshair sync stays consistent. - - `operator-timeline/utils.ts` (`spanToMs`, `stackOperatorsIntoRows`) → - offset-based equivalents. - -3. **Remove / lower** `MIN_BIN_DURATION_NS` once bins are distinct at ns scale. - -4. **Coordinated landing:** all five surfaces share crosshair/zoom sync, so the - domain switch lands as one change, not per-chart. - -### Validation - -- Existing unit tests updated for the offset domain; new codec tests. -- Nanosecond timelines render distinct bins at max zoom. -- **ECharts 6 upgrade check:** re-run the v6 probe (relative-ns `value` axis → - 8/8 distinct pixels; no hang) to confirm the upgrade is unblocked. -- `pnpm ci:check` green. - -## Deferred (not in this slice) - -- Centralizing the codec + axis/formatter builders into `lib/echarts.ts` as a - reusable "BigInt time" adapter for future charts. -- Any general ECharts library extension (custom scale/axis, upstream work). - Note: native BigInt in core is impractical — its `DataStore` is backed by - `Float64Array`. From 0fbaa1ef9139a67e661197e853f3cd8590986f2e Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Thu, 23 Jul 2026 17:06:16 -0600 Subject: [PATCH 5/7] refactor: finish removing start time param, unnecessary comments --- .../@quent/components/src/lib/timeline.utils.test.ts | 6 +++--- .../@quent/components/src/lib/timeline.utils.ts | 2 -- .../components/src/timeline/ResourceTimeline.tsx | 11 +---------- .../@quent/components/src/timeline/Timeline.tsx | 1 - .../components/src/timeline/TimelineController.tsx | 3 +-- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/ui/packages/@quent/components/src/lib/timeline.utils.test.ts b/ui/packages/@quent/components/src/lib/timeline.utils.test.ts index 3846df659..eefaf9fd1 100644 --- a/ui/packages/@quent/components/src/lib/timeline.utils.test.ts +++ b/ui/packages/@quent/components/src/lib/timeline.utils.test.ts @@ -390,7 +390,7 @@ const taskFsm: FiniteStateMachine = { describe('buildTimelineMarks attributes', () => { it('copies recorded and derived attributes onto marks', () => { - const marks = buildTimelineMarks([taskFsm], 0n, 'light', new Set([THREAD_ID])); + const marks = buildTimelineMarks([taskFsm], 'light', new Set([THREAD_ID])); expect(marks).toBeDefined(); // Only the computing transition has a usage on the filtered resource. expect(marks).toHaveLength(1); @@ -406,7 +406,7 @@ describe('buildTimelineMarks attributes', () => { }); it('omits attribute keys for attribute-less transitions', () => { - const marks = buildTimelineMarks([taskFsm], 0n, 'light', null); + const marks = buildTimelineMarks([taskFsm], 'light', null); expect(marks).toHaveLength(2); const queueing = marks!.find(m => m.stateName === 'queueing')!; expect(queueing.derivedAttributes).toBeUndefined(); @@ -422,7 +422,7 @@ describe('buildTimelineMarks attributes', () => { return rest; }), } as unknown as FiniteStateMachine; - const marks = buildTimelineMarks([legacyFsm], 0n, 'light', new Set([THREAD_ID])); + const marks = buildTimelineMarks([legacyFsm], 'light', new Set([THREAD_ID])); expect(marks).toHaveLength(1); expect(marks![0]!.attributes).toBeUndefined(); expect(marks![0]!.derivedAttributes).toBeUndefined(); diff --git a/ui/packages/@quent/components/src/lib/timeline.utils.ts b/ui/packages/@quent/components/src/lib/timeline.utils.ts index 315ea7d6e..9eeaf5b87 100644 --- a/ui/packages/@quent/components/src/lib/timeline.utils.ts +++ b/ui/packages/@quent/components/src/lib/timeline.utils.ts @@ -70,7 +70,6 @@ export function getLongEntitiesThreshold(windowSeconds: number): number { export function buildBinnedTimelineSeries( data: ResourceTimeline, config: BinnedSpanSec, - _startTime: bigint, theme: PaletteTheme, capacities?: CapacityDecl[], quantitySpecs?: { [key in string]?: QuantitySpec }, @@ -171,7 +170,6 @@ export function getLongFsms(data: ResourceTimeline): FiniteStateMachine[] { */ export function buildTimelineMarks( longFsms: FiniteStateMachine[], - _startTime: bigint, theme: PaletteTheme, resourceIdsForFilter?: Set | null, fsmTypes?: { [key in string]?: FsmTypeDecl }, diff --git a/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx b/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx index cbdb9f4a5..d931d25ad 100644 --- a/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx +++ b/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx @@ -191,7 +191,6 @@ export function ResourceTimeline({ const base = buildBinnedTimelineSeries( data.data, data.config, - startTime, paletteTheme, capacities, quantitySpecs, @@ -201,13 +200,7 @@ export function ResourceTimeline({ const filterSet = resourceType === EntityTypeKey.Resource ? new Set([resourceId]) : new Set(); - const timelineMarks = buildTimelineMarks( - longFsms, - startTime, - paletteTheme, - filterSet, - fsmTypes - ); + const timelineMarks = buildTimelineMarks(longFsms, paletteTheme, filterSet, fsmTypes); if (operatorId && operatorLabel) { if (overlayPreloadedData) { @@ -218,7 +211,6 @@ export function ResourceTimeline({ const opResult = buildBinnedTimelineSeries( overlayPreloadedData.data, overlayPreloadedData.config, - startTime, paletteTheme, capacities, quantitySpecs, @@ -230,7 +222,6 @@ export function ResourceTimeline({ series: mergeOverlaySeries(base.series, opResult.series, operatorLabel), marks: buildTimelineMarks( longFsms, - startTime, paletteTheme, filterSet, fsmTypes, diff --git a/ui/packages/@quent/components/src/timeline/Timeline.tsx b/ui/packages/@quent/components/src/timeline/Timeline.tsx index eb1165100..78dd3d3b8 100644 --- a/ui/packages/@quent/components/src/timeline/Timeline.tsx +++ b/ui/packages/@quent/components/src/timeline/Timeline.tsx @@ -80,7 +80,6 @@ export function Timeline({ type: 'line', stack: isOverlay ? `overlay-total` : 'total', step: 'middle', - // `'none'` (not just showSymbol:false) so ECharts doesn't pop a symbol on hover. symbol: 'none', hoverAnimation: false, showSymbol: false, diff --git a/ui/packages/@quent/components/src/timeline/TimelineController.tsx b/ui/packages/@quent/components/src/timeline/TimelineController.tsx index 0aa9ef9d7..c8d5fd66f 100644 --- a/ui/packages/@quent/components/src/timeline/TimelineController.tsx +++ b/ui/packages/@quent/components/src/timeline/TimelineController.tsx @@ -64,7 +64,6 @@ export function TimelineController({ const { timestamps: ts, series } = buildBinnedTimelineSeries( timelineData.data, timelineData.config, - startTime, paletteTheme ); const entries = Object.entries(series); @@ -76,7 +75,7 @@ export function TimelineController({ const ts = Array.from({ length: numBins }, (_, i) => i * binDurationMs); return { timestamps: ts, seriesData: null }; } - }, [timelineData, startTime, durationSeconds, paletteTheme]); + }, [timelineData, durationSeconds, paletteTheme]); const hasSeriesData = useMemo(() => Boolean(seriesData && seriesData.length > 0), [seriesData]); From 714dc3ea55b7541f431b94ecaa0fda0fda067045 Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Thu, 23 Jul 2026 17:13:24 -0600 Subject: [PATCH 6/7] refactor: finish removing startTime, everything is relative --- .../src/operator-timeline/utils.test.ts | 46 ++++++++----------- .../components/src/operator-timeline/utils.ts | 17 +++---- .../src/resource-tree/UsageColumn.tsx | 3 -- .../src/timeline/ResourceTimeline.tsx | 3 -- .../src/timeline/TimelineController.tsx | 2 - ui/src/components/QueryResourceTree.tsx | 7 +-- 6 files changed, 28 insertions(+), 50 deletions(-) diff --git a/ui/packages/@quent/components/src/operator-timeline/utils.test.ts b/ui/packages/@quent/components/src/operator-timeline/utils.test.ts index 4eac00064..ad399f782 100644 --- a/ui/packages/@quent/components/src/operator-timeline/utils.test.ts +++ b/ui/packages/@quent/components/src/operator-timeline/utils.test.ts @@ -300,30 +300,22 @@ describe('stackOperatorsIntoRows', () => { describe('spanToMs', () => { it('converts a zero span to {startMs: 0, endMs: 0}', () => { - expect(spanToMs({ start: 0, end: 0 }, 0n)).toEqual({ startMs: 0, endMs: 0 }); + expect(spanToMs({ start: 0, end: 0 })).toEqual({ startMs: 0, endMs: 0 }); }); - it('converts span seconds to relative milliseconds (startTimeNs is ignored)', () => { - // span = {start: 1s, end: 2s}; offsets are relative to query start. - expect(spanToMs({ start: 1, end: 2 }, 1_000_000n)).toEqual({ + it('converts span seconds to relative milliseconds', () => { + expect(spanToMs({ start: 1, end: 2 })).toEqual({ startMs: 1000, endMs: 2000, }); }); it('handles fractional seconds in the span', () => { - expect(spanToMs({ start: 0.5, end: 1.5 }, 0n)).toEqual({ + expect(spanToMs({ start: 0.5, end: 1.5 })).toEqual({ startMs: 500, endMs: 1500, }); }); - - it('ignores a large epoch startTimeNs (domain is relative)', () => { - expect(spanToMs({ start: 0, end: 0 }, 1_000_000_000n)).toEqual({ - startMs: 0, - endMs: 0, - }); - }); }); // ---- operatorsWithActiveSpans ---------------------------------------------- @@ -331,35 +323,35 @@ describe('spanToMs', () => { describe('operatorsWithActiveSpans', () => { it('returns [] when operators is absent', () => { const bundle = { entities: {} } as unknown as QueryBundle; - expect(operatorsWithActiveSpans(bundle, 0n, 'p1')).toEqual([]); + expect(operatorsWithActiveSpans(bundle, 'p1')).toEqual([]); }); it('returns [] when planId is null', () => { const bundle = makeBundle({ op1: makeOp({ plan_id: 'p1', active_span: { start: 0, end: 1 } }), }); - expect(operatorsWithActiveSpans(bundle, 0n, null)).toEqual([]); + expect(operatorsWithActiveSpans(bundle, null)).toEqual([]); }); it('returns [] when planId is empty string', () => { const bundle = makeBundle({ op1: makeOp({ plan_id: 'p1', active_span: { start: 0, end: 1 } }), }); - expect(operatorsWithActiveSpans(bundle, 0n, '')).toEqual([]); + expect(operatorsWithActiveSpans(bundle, '')).toEqual([]); }); it('returns [] when no operator has a matching plan_id', () => { const bundle = makeBundle({ op1: makeOp({ plan_id: 'p2', active_span: { start: 0, end: 1 } }), }); - expect(operatorsWithActiveSpans(bundle, 0n, 'p1')).toEqual([]); + expect(operatorsWithActiveSpans(bundle, 'p1')).toEqual([]); }); it('filters out operators without an active_span', () => { const bundle = makeBundle({ op1: makeOp({ id: 'op1', plan_id: 'p1', active_span: null }), }); - expect(operatorsWithActiveSpans(bundle, 0n, 'p1')).toEqual([]); + expect(operatorsWithActiveSpans(bundle, 'p1')).toEqual([]); }); it('returns an entry for a matching operator with an active_span', () => { @@ -372,7 +364,7 @@ describe('operatorsWithActiveSpans', () => { instance_name: 'my-scan', }), }); - const result = operatorsWithActiveSpans(bundle, 0n, 'p1'); + const result = operatorsWithActiveSpans(bundle, 'p1'); expect(result).toHaveLength(1); expect(result[0]).toMatchObject({ operatorId: 'op1', @@ -395,13 +387,13 @@ describe('operatorsWithActiveSpans', () => { instance_name: null, }), }); - const [entry] = operatorsWithActiveSpans(bundle, 0n, 'p1'); + const [entry] = operatorsWithActiveSpans(bundle, 'p1'); expect(entry.label).toBe('Join'); }); it('filters out null entries in the operators map', () => { const bundle = makeBundle({ op1: null }); - expect(operatorsWithActiveSpans(bundle, 0n, 'p1')).toEqual([]); + expect(operatorsWithActiveSpans(bundle, 'p1')).toEqual([]); }); it('stacks overlapping operators into multiple rows', () => { @@ -409,7 +401,7 @@ describe('operatorsWithActiveSpans', () => { op1: makeOp({ id: 'op1', plan_id: 'p1', active_span: { start: 0, end: 10 } }), op2: makeOp({ id: 'op2', plan_id: 'p1', active_span: { start: 2, end: 8 } }), }); - const result = operatorsWithActiveSpans(bundle, 0n, 'p1'); + const result = operatorsWithActiveSpans(bundle, 'p1'); expect(result).toHaveLength(2); const rows = new Set(result.map(e => e.rowIndex)); expect(rows.size).toBe(2); @@ -424,7 +416,7 @@ describe('operatorsWithActiveSpansForWorker', () => { entities: {}, plan_tree: { id: 'root', worker: null, children: [] }, } as unknown as QueryBundle; - expect(operatorsWithActiveSpansForWorker(bundle, 0n, 'w1')).toEqual([]); + expect(operatorsWithActiveSpansForWorker(bundle, 'w1')).toEqual([]); }); it('returns [] when no plan belongs to the worker', () => { @@ -432,7 +424,7 @@ describe('operatorsWithActiveSpansForWorker', () => { { op1: makeOp({ plan_id: 'p1', active_span: { start: 0, end: 1 } }) }, { id: 'root', worker: 'w2', children: [] } ); - expect(operatorsWithActiveSpansForWorker(bundle, 0n, 'w1')).toEqual([]); + expect(operatorsWithActiveSpansForWorker(bundle, 'w1')).toEqual([]); }); it('returns entries for operators whose plan belongs to the worker', () => { @@ -452,7 +444,7 @@ describe('operatorsWithActiveSpansForWorker', () => { }, planTree ); - const result = operatorsWithActiveSpansForWorker(bundle, 0n, 'w1'); + const result = operatorsWithActiveSpansForWorker(bundle, 'w1'); expect(result).toHaveLength(1); expect(result[0].operatorId).toBe('op1'); expect(result[0].planId).toBe('p1'); @@ -474,7 +466,7 @@ describe('operatorsWithActiveSpansForWorker', () => { }, planTree ); - const result = operatorsWithActiveSpansForWorker(bundle, 0n, 'w1'); + const result = operatorsWithActiveSpansForWorker(bundle, 'w1'); expect(result).toHaveLength(2); }); @@ -494,7 +486,7 @@ describe('operatorsWithActiveSpansForWorker', () => { }, planTree ); - const result = operatorsWithActiveSpansForWorker(bundle, 0n, 'w1'); + const result = operatorsWithActiveSpansForWorker(bundle, 'w1'); expect(result).toHaveLength(1); expect(result[0].operatorId).toBe('op1'); }); @@ -509,6 +501,6 @@ describe('operatorsWithActiveSpansForWorker', () => { { op1: makeOp({ plan_id: 'p1', active_span: null }) }, planTree ); - expect(operatorsWithActiveSpansForWorker(bundle, 0n, 'w1')).toEqual([]); + expect(operatorsWithActiveSpansForWorker(bundle, 'w1')).toEqual([]); }); }); diff --git a/ui/packages/@quent/components/src/operator-timeline/utils.ts b/ui/packages/@quent/components/src/operator-timeline/utils.ts index e814a87d8..372571e58 100644 --- a/ui/packages/@quent/components/src/operator-timeline/utils.ts +++ b/ui/packages/@quent/components/src/operator-timeline/utils.ts @@ -97,10 +97,10 @@ export function stackOperatorsIntoRows< * Returns ms offsets relative to query start (no absolute epoch base) so the * chart x-domain stays float64-exact. */ -export function spanToMs( - span: { start: number; end: number }, - _startTimeNs: bigint -): { startMs: number; endMs: number } { +export function spanToMs(span: { start: number; end: number }): { + startMs: number; + endMs: number; +} { const startMs = span.start * 1_000; const endMs = span.end * 1_000; return { startMs, endMs }; @@ -109,13 +109,12 @@ export function spanToMs( function buildOperatorActiveSpanEntry( operatorId: string, op: Operator, - startTimeNs: bigint, fallbackPlanId?: string ): OperatorActiveSpanEntry | null { const span = op.active_span; if (span == null) return null; - const { startMs, endMs } = spanToMs(span, startTimeNs); + const { startMs, endMs } = spanToMs(span); const typeName = op.operator_type_name ?? ''; const label = op.instance_name ?? op.operator_type_name ?? operatorId.slice(0, 8); @@ -138,7 +137,6 @@ function buildOperatorActiveSpanEntry( */ export function operatorsWithActiveSpans( queryBundle: QueryBundle, - startTimeNs: bigint, planId?: string | null ): OperatorActiveSpanEntry[] { const operators = queryBundle.entities.operators; @@ -152,7 +150,7 @@ export function operatorsWithActiveSpans( .sort(([a], [b]) => a.localeCompare(b)); for (const [operatorId, op] of sorted) { - const entry = buildOperatorActiveSpanEntry(operatorId, op, startTimeNs, planId); + const entry = buildOperatorActiveSpanEntry(operatorId, op, planId); if (entry) entries.push(entry); } @@ -166,7 +164,6 @@ export function operatorsWithActiveSpans( */ export function operatorsWithActiveSpansForWorker( queryBundle: QueryBundle, - startTimeNs: bigint, workerId: string ): OperatorActiveSpanEntry[] { const operators = queryBundle.entities.operators; @@ -182,7 +179,7 @@ export function operatorsWithActiveSpansForWorker( .sort(([a], [b]) => a.localeCompare(b)); for (const [operatorId, op] of sorted) { - const entry = buildOperatorActiveSpanEntry(operatorId, op, startTimeNs); + const entry = buildOperatorActiveSpanEntry(operatorId, op); if (entry) entries.push(entry); } diff --git a/ui/packages/@quent/components/src/resource-tree/UsageColumn.tsx b/ui/packages/@quent/components/src/resource-tree/UsageColumn.tsx index e94a8b2b3..8147bcdb2 100644 --- a/ui/packages/@quent/components/src/resource-tree/UsageColumn.tsx +++ b/ui/packages/@quent/components/src/resource-tree/UsageColumn.tsx @@ -14,7 +14,6 @@ type UsageColumnProps = { queryBundle: QueryBundle; selectedTypes: Map; selectedFsmTypes?: Map; - startTime: bigint; durationSeconds: number; /** Whether dark mode is active. Passed explicitly to decouple from ThemeContext. */ isDark: boolean; @@ -27,7 +26,6 @@ export function UsageColumn({ queryBundle, selectedTypes, selectedFsmTypes, - startTime, durationSeconds, isDark, }: UsageColumnProps): React.ReactNode { @@ -64,7 +62,6 @@ export function UsageColumn({ queryId={queryBundle.query_id} resourceId={item.id} resourceType={resourceType} - startTime={startTime} durationSeconds={durationSeconds} fsmTypeName={fsmTypeName} resourceTypeName={selectedType} diff --git a/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx b/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx index d931d25ad..4422a1c51 100644 --- a/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx +++ b/ui/packages/@quent/components/src/timeline/ResourceTimeline.tsx @@ -47,7 +47,6 @@ type ResourceTimelineProps = { queryId: string; resourceId: string; resourceType: string; - startTime: bigint; durationSeconds: number; fsmTypeName?: string | undefined; resourceTypeName?: string; @@ -77,7 +76,6 @@ export function ResourceTimeline({ queryId, resourceId, resourceType, - startTime, durationSeconds, fsmTypeName, resourceTypeName, @@ -248,7 +246,6 @@ export function ResourceTimeline({ fetchedData, operatorId, overlayPreloadedData, - startTime, capacities, quantitySpecs, fsmTypes, diff --git a/ui/packages/@quent/components/src/timeline/TimelineController.tsx b/ui/packages/@quent/components/src/timeline/TimelineController.tsx index c8d5fd66f..7e265da68 100644 --- a/ui/packages/@quent/components/src/timeline/TimelineController.tsx +++ b/ui/packages/@quent/components/src/timeline/TimelineController.tsx @@ -39,7 +39,6 @@ const CONTROLLER_GRID_BOTTOM = 10; const DATAZOOM_TOP_OFFSET = 5; type TimelineControllerProps = { - startTime: bigint; durationSeconds: number; height?: number; timelineData?: SingleTimelineResponse | null; @@ -49,7 +48,6 @@ type TimelineControllerProps = { /** Zoom controller bar with datazoom slider and optional background timeline data. */ export function TimelineController({ - startTime, durationSeconds, height = CONTROLLER_HEIGHT, timelineData, diff --git a/ui/src/components/QueryResourceTree.tsx b/ui/src/components/QueryResourceTree.tsx index 0651eff20..d9f615614 100644 --- a/ui/src/components/QueryResourceTree.tsx +++ b/ui/src/components/QueryResourceTree.tsx @@ -194,10 +194,10 @@ function QueryResourceTreeContent({ queryBundle, engineId }: QueryResourceTreePr const operatorEntriesByWorker = useMemo(() => { const map = new Map>(); for (const workerId of workerIdsFromPlanTree) { - map.set(workerId, operatorsWithActiveSpansForWorker(queryBundle, startTime, workerId)); + map.set(workerId, operatorsWithActiveSpansForWorker(queryBundle, workerId)); } return map; - }, [queryBundle, startTime, workerIdsFromPlanTree]); + }, [queryBundle, workerIdsFromPlanTree]); const columns = useMemo(() => { return [ @@ -250,7 +250,6 @@ function QueryResourceTreeContent({ queryBundle, engineId }: QueryResourceTreePr headerContent: (
@@ -293,7 +291,6 @@ function QueryResourceTreeContent({ queryBundle, engineId }: QueryResourceTreePr }, ] satisfies Column[]; }, [ - startTime, durationSeconds, fetchedRootTimeline, isDark, From 4cd9cc42e3b2b77428968562ea291d8803265517 Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Tue, 28 Jul 2026 11:55:00 -0600 Subject: [PATCH 7/7] fix: update hardcoded calculations with constant calculations --- .../@quent/components/src/lib/useMinZoomSpanPct.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/packages/@quent/components/src/lib/useMinZoomSpanPct.test.ts b/ui/packages/@quent/components/src/lib/useMinZoomSpanPct.test.ts index 6d5a86d45..6e8468d6c 100644 --- a/ui/packages/@quent/components/src/lib/useMinZoomSpanPct.test.ts +++ b/ui/packages/@quent/components/src/lib/useMinZoomSpanPct.test.ts @@ -4,15 +4,16 @@ import { describe, it, expect } from 'vitest'; import { renderHook } from '@testing-library/react'; import { useMinZoomSpanPct } from './useMinZoomSpanPct'; +import { MIN_ZOOM_WINDOW_S } from './timeline.utils'; describe('useMinZoomSpanPct', () => { it('converts the minimum zoom window to a percentage of the query duration', () => { - const { result } = renderHook(() => useMinZoomSpanPct(1)); - expect(result.current).toBe(0.005); + const { result } = renderHook(() => useMinZoomSpanPct(10)); + expect(result.current).toBeCloseTo(MIN_ZOOM_WINDOW_S * 10, 12); }); it('caps the minimum span at the full query duration', () => { - const { result } = renderHook(() => useMinZoomSpanPct(0.00001)); + const { result } = renderHook(() => useMinZoomSpanPct(MIN_ZOOM_WINDOW_S / 2)); expect(result.current).toBe(100); });