fix(ui): cap sub-day rollup routing at 24 hours

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
joshua 2026-10-26 02:37:31 +00:00
parent 10cc1d0192
commit 26f82f35db

View file

@ -8,11 +8,11 @@ export interface RelativeTimeOption {
}
/** Widest window the sub-day (ClickHouse rollup) usage path serves; longer ranges use the daily tables. */
export const SUB_DAY_MAX_RANGE_MS = 7 * 24 * 60 * 60 * 1000;
export const SUB_DAY_MAX_RANGE_MS = 24 * 60 * 60 * 1000;
/**
* A range that does not start at a local midnight is a sub-day investigation window
* (Last 1h, 14:05 to 14:35): it is served from spend-log rollups and never snapped to day edges.
* A window of at most 24 hours that does not start at a local midnight is a sub-day investigation
* window (Last 1h, 14:05 to 14:35): it is served from spend-log rollups and never snapped to day edges.
*/
export const isSubDayRange = (from: Date, to: Date): boolean =>
!moment(from).isSame(moment(from).startOf("day")) && to.getTime() - from.getTime() <= SUB_DAY_MAX_RANGE_MS;