Skip to content

Lite: Queries-tab comparisons read a window shifted by the server's UTC offset #4284

Description

@erikdarlingdata

Found while fixing the same bug in #4279's new "Showing since" banner.

Lite stores collection_time in UTC. The Queries tab's comparison reads compare their start and end times straight against it, with no offset conversion. They are GetQueryStatsComparisonAsync and its procedure-stats and Query Store twins in Lite/Services/LocalDataService.*.cs. But two callers pass them server-local times:

  • A slicer drag. Each On...SlicerChanged handler in Lite/Controls/ServerTab.Slicers.cs converts e.StartUtc and e.EndUtc to server time (fromServer, toServer). It passes those to Refresh...ComparisonAsync. The grid read beside it converts them back to UTC through GetTimeRange. The comparison does not.
  • A custom range. Lite/Controls/ServerTab.Refresh.cs builds cStart and cEnd from the date pickers in server time and passes them to the same three comparison calls. GetComparisonRange() (Lite/Controls/ServerTab.Comparison.cs:59) builds the baseline the same way (lines 66-77).

So on any server not on UTC, the comparison reads a window shifted by the server's UTC offset. After a slicer drag, the current window is shifted but the baseline, from a preset range, is not. With the default "Last N hours" range and no slicer drag, both windows are UTC and correct.

Fix: give the comparison calls the UTC window the grid read. #4279 added LocalDataService.GetQueriesTabWindowUtc for the banner, and the slicer's own e.StartUtc and e.EndUtc are already UTC. Move GetComparisonRange() onto UTC at the same time, so the current and baseline windows stay on one basis. Check the comparison banner's displayed times after the change. ServerTimeHelper.FormatServerTime expects UTC.

The Darling viewer's Queries tab passes UTC windows to its comparisons.

Activity

  1. erikdarlingdata commented on Sep 25, 2026

    @erikdarlingdata
    OwnerAuthor

    Ruling for the fix lane:

    1. Every Queries-tab comparison call gets the UTC window its grid read. The slicer handlers pass e.StartUtc and e.EndUtc. The refresh and Compare-dropdown paths pass the window from LocalDataService.GetQueriesTabWindowUtc, the same one the banner beside each call already uses.
    2. GetComparisonRange takes the current UTC window and shifts it back. The Darling viewer's copy (ViewerServerTab.QueriesComparison.cs) already works this way. Yesterday is 1 day back, and Last week and Same day last week are 7 days back.
    3. One behavior changes on purpose. After a slicer drag, the baseline is the dragged window shifted back, not the whole preset range. Both windows then cover the same span.
    4. The comparison banner's baseline times are checked after the change, because ServerTimeHelper.FormatServerTime expects UTC.
    5. Tests use one server east of UTC and one west of UTC. The preset, custom-range and slicer paths must give the comparison the grid's UTC window. The baseline must be that window shifted by 1 or 7 days. If any comparison call gets a server-local time, a source check fails.

    The Darling viewer already passes UTC windows to its comparisons, so it needs no change.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01TszxYhJJbTEh4LrZ56NYo3

  2. added
    in-progressActively being worked by a local session or its agents (PR open or in flight)
    on Sep 25, 2026
  3. added a commit that references this issue on Sep 25, 2026
    e4f6a21
  4. erikdarlingdata commented on Sep 25, 2026

    @erikdarlingdata
    OwnerAuthor

    Closed by the watcher: delivered in PR #4302, merged to dev.

  5. removed
    in-progressActively being worked by a local session or its agents (PR open or in flight)
    on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions