test(show): pin the timestamp expectation to en-US/UTC like the formatter - #169
Conversation
…tter
formatConversationAsMarkdown renders timestamps with
toLocaleString('en-US', { timeZone: 'UTC' }) (obra#120, obra#130), but the test still
built its expectation with a bare toLocaleString(), so the expectation depends
on the host locale and timezone while the formatter's output does not. The
suite passes on en-US/UTC CI runners and fails for anyone running it locally
outside that setup (Europe/Warsaw: expected "9/19/2025, 7:34:29 PM", got
"9/19/2025, 5:34:29 PM"; de-DE on UTC also fails).
Format the expectation the same way the code does. Verified passing under
Europe/Warsaw, America/New_York and UTC, including LC_ALL=de_DE.UTF-8.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L7qt58cTm5rFNfV38EQfEN
obra
left a comment
There was a problem hiding this comment.
Verified and landing. Thank you — this is a real portability bug and the diagnosis is exactly right.
formatConversationAsMarkdown pins timestamps at src/show.ts:97:
const timestamp = new Date(msg.timestamp).toLocaleString('en-US', { timeZone: 'UTC' });and the expectation used a bare toLocaleString(). Those agree only on an en-US/UTC host, which is what CI happens to be — so the suite was green for everyone who could run it and red for everyone who couldn't.
Confirmed with a negative control, because a test change that passes everywhere proves nothing on its own:
base 28f0933a, TZ=Europe/Warsaw -> 1 failed | 21 passed
PR 6854e8d5, TZ=Europe/Warsaw -> 22 passed
Then across the environments the fix targets — TZ=UTC, TZ=America/New_York, and TZ=UTC LC_ALL=de_DE.UTF-8 — all 22 pass. No CI ran on the fork branch, so that local matrix is standing in for it.
One note, not a change request. The expectation now mirrors the implementation's exact call, so if someone changes the formatter's locale the test follows silently rather than failing. The alternative — asserting the literal "9/19/2025, 5:34:29 PM" — would catch that, at the cost of breaking whenever Node's ICU data shifts its formatting. For a timestamp render I think you've picked the right side of that trade; I'm flagging it only so the next person knows it was a choice.
Problem
formatConversationAsMarkdownrenders timestamps withtoLocaleString('en-US', { timeZone: 'UTC' })(#120, #130), but the test intest/show.test.tsstill builds its expectation with a baretoLocaleString(), i.e. the host's locale and timezone. The two only agree on en-US / UTC hosts, so the suite passes on CI and fails for anyone running it locally elsewhere:Fix
Format the expectation the same way the code does. One-line test change, no runtime change.
Verified passing under
TZ=Europe/Warsaw,TZ=America/New_YorkandTZ=UTC, includingLC_ALL=de_DE.UTF-8.🤖 Generated with Claude Code
https://claude.ai/code/session_01L7qt58cTm5rFNfV38EQfEN