From 6a79f5f62ed189256788c0ce217b7ccb93a73398 Mon Sep 17 00:00:00 2001 From: Ethan Date: Mon, 18 May 2026 18:21:00 +1000 Subject: [PATCH] fix: ignore drifting timestamp in stories (#25429) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `SectionHeadersCollapse` story (and every other Chromatic-snapshotted story rendering the agents sidebar) was flaky because each chat row renders `shortRelativeTime(chat.updated_at)` — `"now"`, `"5m"`, `"7h"`, `"1d"`, etc. The values are computed against the live wall clock from fixed fixture timestamps, so the rendered text drifts on every run (e.g. `"7h"` → `"now"` mid-day) and Chromatic diffs the change. This wraps the timestamp in ``, the dominant codebase convention for time-varying text. `data-chromatic="ignore"` appears 35 times across 20 files in `site/src`, including `utils/schedule.tsx:139,153`, `components/LastSeen/LastSeen.tsx:42`, `modules/provisioners/Provisioner.tsx:80`, `pages/OrganizationSettingsPage/.../ProvisionerRow.tsx:119`, `JobRow.tsx:139`, `ProvisionerKeyRow.tsx:81`, `pages/AIBridgePage/RequestLogsPage/RequestLogsRow/RequestLogsRow.tsx` (multiple rows), `pages/HealthPage/WorkspaceProxyPage.tsx:144`, and `pages/UserSettingsPage/TokensPage/TokensPageView.tsx:117`. By comparison, only one component (`AppStatuses`) plumbs a reference date through props, and there is no `Date.now`-stubbing precedent that would actually stabilize `dayjs()`-based output like `shortRelativeTime`. The wrap is scoped tightly: only the text node returned by `shortRelativeTime` is ignored, so the sibling unread-indicator dot and surrounding layout still participate in snapshots. --- .../pages/AgentsPage/components/Sidebar/AgentsSidebar.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/site/src/pages/AgentsPage/components/Sidebar/AgentsSidebar.tsx b/site/src/pages/AgentsPage/components/Sidebar/AgentsSidebar.tsx index ba1ad6e14d..32a27065aa 100644 --- a/site/src/pages/AgentsPage/components/Sidebar/AgentsSidebar.tsx +++ b/site/src/pages/AgentsPage/components/Sidebar/AgentsSidebar.tsx @@ -769,7 +769,11 @@ const ChatTreeNode: FC = ({ chat, isChildNode }) => { aria-hidden="true" /> ) : ( - shortRelativeTime(chat.updated_at) + // data-chromatic="ignore" keeps Chromatic snapshots + // stable as wall-clock time advances (e.g. "now" → "5m"). + + {shortRelativeTime(chat.updated_at)} + )}