Skip to content

Admin times are proved against two runtime locales, and Sessions and Jobs get the default-zone story - #2310

Merged
marvin-bitterlich merged 1 commit into
mainfrom
ccr-efcafb6c-sxkls9-admin-dates-defaults
Nov 18, 2026
Merged

marvin-bitterlich merged 1 commit into
mainfrom
ccr-efcafb6c-sxkls9-admin-dates-defaults

Conversation

@marvin-bitterlich

Copy link
Copy Markdown
Contributor

Why?

#2305 made the built-in admin views show times in the viewer's locale and time zone. Two of its proofs were weak, as its own description said.

The default locale was proved by a unit test that compared "no locale" with the runtime's own locale. On a machine whose locale is en-US, as this sandbox is, a hard-coded en-US passes it. The default time zone had a screen story for the Users view only.

How?

No behavior changes; the code was right. This adds tests only.

Default locale. Node reads its own locale once, when the process starts, so a test cannot change it the way the kits change TZ. I checked: setting LC_ALL or LANG inside a running process leaves Intl on the old locale. A new small kit, runtimeDates, therefore starts a fresh Node process with LC_ALL and TZ set and has it print timestampText for one instant. Four stories read that text for a German and a Japanese runtime, with and without an explicit time zone. Two different runtime locales mean that a hard-coded locale, whichever it is, fails at least one story. These stories replace the unit test they supersede.

Default time zone. The Sessions and Jobs kits gain the trait the Users kit has: the view opens with no time zone of its own in a browser whose zone is set through TZ. The Sessions story reads the three times of a session in Tokyo time. Job timestamps come from the database clock, so the Jobs story compares each shown time with its own dateTime instant written in Kolkata time. The TZ stand-in moved to one helper that the three kits share.

I checked each new test against a broken formatter:

Formatter change Fails
locale hard-coded to en-US all four runtime stories (the remaining unit tests still pass here)
locale hard-coded to de-DE both Japanese runtime stories
missing time zone treated as UTC the Users, Sessions and Jobs default-zone stories

Decisions

  • A child process, not a stub. The runtime's locale cannot be changed in a running Node process, and a .unit test may not stub the environment. The kit keeps the process start in test-support, and the stories read what the real formatter printed.
  • The superseded unit test is deleted, not kept beside the stories. It proved less than they do.
  • No changeset. Nothing a consumer can notice changes.

Callouts

  • The runtime stories start a child process each, about 0.4 s per story. The child gets only LC_ALL and TZ as its environment.
  • They set LC_ALL, which Node reads on Linux and macOS. On Windows they would not change the locale.
  • The Jobs story takes its expected text from a small test-support helper that writes an instant for en-GB in a named zone. The view under test is given the locale and no zone, so the story proves the zone default and not the format.

Generated by Claude Code

…Jobs get the default-zone story

The default-locale unit test compared no locale with the runtime's own,
so a formatter hard-coded to the machine's locale passed it. Node reads
its locale once at start, so a new runtimeDates kit prints a time from a
fresh process started under a German and a Japanese locale.

The Sessions and Jobs kits gain the trait the Users kit has for a view
that opens with no time zone of its own, through one shared TZ helper.

Tests only; the formatter was right.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VjCSiB3Dk7BRBmjic6wFM5
@marvin-bitterlich
marvin-bitterlich added this pull request to the merge queue Nov 18, 2026
@tally-code-quality

Copy link
Copy Markdown

Coverage 91.9% (−0.1 pts)

No coverable lines added.

28941cc (merged onto 64d4061) vs main at 64d4061 · updated Nov 18, 16:19 UTC · Full report

Merged via the queue into main with commit 5f4f7db Nov 18, 2026
20 checks passed
@marvin-bitterlich
marvin-bitterlich deleted the ccr-efcafb6c-sxkls9-admin-dates-defaults branch November 18, 2026 16:29
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