test: make durable-totals live-session fixture time-of-day independent

The seeded 'today' session used a fixed noon timestamp; under the suite's
TZ=UTC pin any run between 00:00 and ~12:30 UTC placed it in the future,
so the provider-filtered durable path (today-range ends at now) dropped it
and the parity assertion failed. Seed timestamps proportionally between
start-of-today and now so they are always today and always in the past.
This commit is contained in:
iamtoruk 2026-07-26 17:33:42 -07:00
parent b3e483ad3b
commit ec449afa3f

View file

@ -89,8 +89,14 @@ async function seedLiveTodaySession(): Promise<void> {
const projectDir = join(ROOT, 'home', '.claude', 'projects', 'p')
await mkdir(projectDir, { recursive: true })
const now = new Date()
const ts = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 12, 0, 0).toISOString()
const ts2 = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 12, 30, 0).toISOString()
// Timestamps must be today AND already in the past: the provider-filtered
// durable path parses a today-range ending at `now`, so a fixed clock time
// (e.g. noon under the suite's TZ=UTC pin) sits in the future for any run
// before that hour and gets range-filtered out, failing parity flakily.
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate())
const at = (f: number) => new Date(todayStart.getTime() + (now.getTime() - todayStart.getTime()) * f)
const ts = at(0.4).toISOString()
const ts2 = at(0.6).toISOString()
const line = (id: string, t: string): string => JSON.stringify({
type: 'assistant',
timestamp: t,