Repository navigation
test(usage): make UsagePage read-window test DST-safe - #1668
Conversation
The Usage page starts its reads at `since(now)`: local midnight 29 days ago. The test asserted that start was more than 29 × 24 h before now, which is only true while no daylight-saving change falls inside the window. When clocks have gone forward within the last 29 days, one of those days is 23 h long, so that midnight is 29 × 24 h − 1 h before the current midnight and the test fails whenever it runs between local midnight and 1 am (seen at 00:24 AEDT, 36 minutes short, after the 4 October spring-forward). Compare the read's `since` with the `since(now)` helper the page uses instead. stats.test.ts already pins `since` to `dayStart(now, 29)`, so this still checks the page wires the documented window without redoing calendar arithmetic. Reproduced by faking the clock to 2026-10-20T00:24+11:00 under TZ=Australia/Sydney: the old assertion fails there and the new one passes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
kalvinnchau
left a comment
There was a problem hiding this comment.
🤖 No actionable findings at 8c90b4f. The assertion preserves page-to-reader wiring coverage while the separate stats test pins the calendar-day contract. DST reproductions passed at head and failed on base; current-head Vitest CI passed. Validation covered unit/component and date-contract behavior, not native or real-relay workflows.
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Star Lord’s automated source review via Wes’s account, integrating independent Rocket, Mantis and Groot reviews: no changes requested (source assessment 9/10). The assertion now checks the calendar-day window used by UsagePage, while stats.test.ts separately checks the 29-day offset; production behavior is unchanged.
Head 8c90b4f0d7a891442817b26f2ff61b53382c38ed, base 3a4cccebf37038ade5053e7f0edcb141642bc16d, merge-base e7dbf6a257adfaf6e97851f490acb58a80e47e68. Source-only; no tests or app execution, and the author’s DST reproduction was not rerun; hosted CI required is successful, while live-clock midnight sensitivity remains an optional follow-up.
…ted-setup * origin/main: (24 commits) feat(agents): share agents to the community catalog and export snapshots (#1649) feat(navigation): dialogs never become Back/Forward destinations (#1696) fix(builderlab): sign in when finishing a hosted agent's setup (#1768) fix(messages): link #name prose to open channels the directory has named (#1706) feat(agents): keep the Mac awake while agents work (#1718) perf(panels): skip layout for covered workspace tabs (#1542) feat(composer): offer model and effort in a DM with an agent without a mention (#1621) test(workflows): wait for dialog initial focus before pasting YAML in WorkflowEditor test (#1705) fix(builderlab): show all captured activity without a conversation toggle (#1764) feat(agents): add a UI for Attention watches (#1663) Keep thread reply branches one level deep (#1751) fix(messages): keep table scrollbars inside webkit message rows (#1677) feat(agents): sync agent config through config channels (#1226) fix(agents): offer a new hosted agent in Solo chats right away (#1759) test(usage): make UsagePage read-window test DST-safe (#1668) fix(panels): scope split motion selectors to layout owners (#1681) feat(agents): simplify imports and clarify community scope (#1660) fix(pi): stop posting replies the agent did not send (#1758) feat(identity): support a local debug restore helper (#1517) test(perf): cover rich thread open close and reopen (#1683) ... Signed-off-by: Riley Crane <rileycrane@squareup.com>
…into rileycrane/bestie-hourly-wake * origin/rileycrane/bestie-hosted-setup: (25 commits) Give Bestie's test fixture the native keepAwake that main now requires feat(agents): share agents to the community catalog and export snapshots (#1649) feat(navigation): dialogs never become Back/Forward destinations (#1696) fix(builderlab): sign in when finishing a hosted agent's setup (#1768) fix(messages): link #name prose to open channels the directory has named (#1706) feat(agents): keep the Mac awake while agents work (#1718) perf(panels): skip layout for covered workspace tabs (#1542) feat(composer): offer model and effort in a DM with an agent without a mention (#1621) test(workflows): wait for dialog initial focus before pasting YAML in WorkflowEditor test (#1705) fix(builderlab): show all captured activity without a conversation toggle (#1764) feat(agents): add a UI for Attention watches (#1663) Keep thread reply branches one level deep (#1751) fix(messages): keep table scrollbars inside webkit message rows (#1677) feat(agents): sync agent config through config channels (#1226) fix(agents): offer a new hosted agent in Solo chats right away (#1759) test(usage): make UsagePage read-window test DST-safe (#1668) fix(panels): scope split motion selectors to layout owners (#1681) feat(agents): simplify imports and clarify community scope (#1660) fix(pi): stop posting replies the agent did not send (#1758) feat(identity): support a local debug restore helper (#1517) ... Signed-off-by: Riley Crane <rileycrane@squareup.com>
Summary
Fixes a flaky test in
src/bundled/usage/UsagePage.test.tsxthat fails around daylight-saving changes.The Usage page starts its reads at
since(now), which is local midnight 29 days ago. The test checked that this start was more than 29 × 24 h before now. That only holds when no daylight-saving change falls inside the window. If clocks went forward within the last 29 days, one of those days is 23 h long. The test then fails whenever it runs between local midnight and 1 am. It was seen failing at 00:24 AEDT after the 4 October spring-forward, 36 minutes short.The test now compares the read's
sincewith the samesince(now)helper the page uses.stats.test.tsalready pinssincetodayStart(now, 29), so this still checks that the page uses the documented 30-day window, without repeating the calendar arithmetic in the test.Test-only change. No production code changes.
Validation
2026-10-20T00:24+11:00underTZ=Australia/Sydney: the old assertion fails and the new one passes.🤖 Generated with Claude Code