From e84988b2a30618a35e8a1be685bede592bd8ceec Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Fri, 29 May 2026 07:59:47 -0500 Subject: [PATCH] fix(stats): ignore partial may 27 athena data (#29891) --- packages/stats/core/src/stat-sync.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/stats/core/src/stat-sync.ts b/packages/stats/core/src/stat-sync.ts index b3aba13613..50f4e1b64e 100644 --- a/packages/stats/core/src/stat-sync.ts +++ b/packages/stats/core/src/stat-sync.ts @@ -9,6 +9,7 @@ import { ProviderStatRepo, rowsFromAggregates as providerRowsFromAggregates } fr import { startOfIsoWeek } from "./domain/stat" const DATALAKE_INGESTION_LAG_MS = 5 * 60_000 +const STATS_DATA_START_MS = new Date("2026-05-28T00:00:00.000Z").getTime() const WEEK_MS = 7 * 86_400_000 export type SyncStatsResult = { ok: true; rows: number; startedAt: string; periodStart: string; periodEnd: string } @@ -21,7 +22,8 @@ export const syncStats: () => Effect.Effect< > = Effect.fn("StatSync.sync")(function* () { const startedAt = yield* DateTime.nowAsDate const periodEnd = new Date(Math.floor((startedAt.getTime() - DATALAKE_INGESTION_LAG_MS) / 60_000) * 60_000) - const periodStart = new Date(startOfIsoWeek(periodEnd).getTime() - WEEK_MS) + // May 27 was partial, so keep Athena stats anchored at the first complete day. + const periodStart = new Date(Math.max(startOfIsoWeek(periodEnd).getTime() - WEEK_MS, STATS_DATA_START_MS)) const athena = yield* Athena const modelStats = yield* ModelStatRepo const providerStats = yield* ProviderStatRepo