Skip to content

fix(chat): give a chat row the menu's clock, so a run's time matches its day - #1876

Merged
gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:fix/chat-menu-row-clock
Oct 31, 2026
Merged

gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:fix/chat-menu-row-clock

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

chat-menu.test.tsx › "counts the Inbox, and lists Agents at work…" fails on any day other than its fixture's, 2026-10-30. On CI it starts failing after 00:00 UTC on 31 October, on every PR.

The cause is in the component, not the test:

  • ChatMenuView takes a now for its day groups.
  • But ChatRow's line (chatLineOf → rowTime) asked the system clock whether a run's time was today's. So with the test's now at noon on 30 Oct and the system clock on 31 Oct, the row showed "Done · Oct 30" instead of "Done · 08:02".
  • In the app, the same mismatch could show a run's date while its day group says "Today", around midnight.

The fix:

  • chatLineOf(chat, t, now = new Date());
  • ChatRow takes an optional now;
  • the menu passes its own.
  • All chats and Search keep the current time, as before.

Related issue

None. Found while running the suite past midnight.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

Run yarn vitest run src/components/chat on a day other than 2026-10-30. chat-menu.test.tsx passes; it failed on main.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes (0 errors; 7 old warnings in files this PR doesn't touch)
  • yarn typecheck passes
  • yarn format:check passes
  • Changes are focused — one concern per PR
  • Help article updated under help/ (or no user-visible change): no Help change

Chat components: 23 files / 233 tests pass, run on 31 October local time.

🤖 Generated with Claude Code

…its day

ChatMenuView takes `now` for its day groups, but ChatRow's line asked
rowTime for the time with the system clock. Past midnight a run from
"today" showed its date, and chat-menu.test's "Done · 08:02" failed
whenever the suite ran on another day than its fixture's (on CI, after
00:00 UTC). The row now takes the menu's `now`; other callers keep the
current time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Heads-up: since 00:00 UTC on 31 Oct, chat-menu.test.tsx › "counts the Inbox, and lists Agents at work…" fails on main and on every PR's CI. For example, #1880's web job is 7,734 of 7,735, and that test is the one failure.

This PR fixes it: the row now takes the menu's clock. Merging it first turns the other PRs' web job green again on their next run.

All chats passes its own clock (the one its Updated column uses) to
chatLineOf, so a row's time and its Updated value come from one clock.
A test pins the page's clock to a fixed day and fails without it.
gkhngyk
gkhngyk previously approved these changes Oct 31, 2026

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The menu groups chats by its own now, and the row line now uses the same clock, so a run's time matches its day group. chatLineOf's other callers are All chats (which has no day groups and its own minute clock, so it can't show the mismatch) and search (no groups, no clock). Optional follow-up: pass All chats' useNow to chatLineOf too, for consistency. No migrations; merges clean on main.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The menu groups chats by its own now, and the row line now uses the same clock, so a run's time matches its day group. chatLineOf's other callers are All chats (which has no day groups and its own minute clock, so it can't show the mismatch) and search (no groups, no clock). Optional follow-up: pass All chats' useNow to chatLineOf too, for consistency. No migrations; merges clean on main.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging in order with the other approved PRs. This head merges current main; its tree is what main will be after this squash, checked with the full server and web suites, tsc, lint, format and next build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants