Skip to content

tasks: make the tasks-page test fixtures $TZ-stable (#1808) - #1809

Open
ursasi wants to merge 3 commits into
Agent-Field:devfrom
ursasi:tz-stable-tasks-heading
Open

ursasi wants to merge 3 commits into
Agent-Field:devfrom
ursasi:tz-stable-tasks-heading

Conversation

@ursasi

@ursasi ursasi commented Oct 11, 2026 •

Copy link
Copy Markdown

Closes #1808.

The bug

The tasks-page tests are green on a UTC CI runner but red on any developer box east of UTC. Two fail on a UTC+8 machine today:

$ TZ=Asia/Shanghai go test ./internal/tui3/ -count=1
--- FAIL: TestTheManualQuotesBothTasksOpeningHeadingsExactly
    the tasks page opens with "1 chat · 148 subtasks since aug 12 · $34.10", which the chat manual does not quote   (manual quotes "aug 11")
--- FAIL: TestTheTasksPageGroupsByWhatYouDoNext
    the tasks head line draws no window control: ... "shift+← aug 3 – aug 26 →"   (test asserts "shift+← aug 2 – aug 25 →")

The tasks window buckets days in the viewer's local zone — deliberately: spend and subtask counts are attributed to the writer's own calendar day (usageBucketStart does at.Local(), and SpendToday's "THE DAY IS THE WRITER'S" law depends on it). But every tasks-page test fixture built its clock in a fixed time.FixedZone("fixture", -4h). On a host east enough, that -04:00 clock is read as the next local day, the window shifts a day, and the asserted dates (aug 11, aug 2 – aug 25) no longer match.

The fix

The product behavior is correct and stays. The fixtures were wrong to inject a foreign fixed zone and then assert dates that only match in the author's timezone band. This was one shared cause across five test files — exactly the "fix it, don't describe one of it" lesson from #176 — so build every tasks-page fixture clock in time.Local:

  • tallyrows_test.go, tasksplace_test.go (×4), tasksparked_test.go, tasksconversation_test.go, taskstable_test.go

No production code changes — test-only.

Verification

The 58 tests across those five files are identical green under the full span of host zones:

TZ=Pacific/Pago_Pago   (UTC-11)  ok
TZ=UTC                           ok
TZ=America/New_York              ok
TZ=Asia/Shanghai       (UTC+8)   ok
TZ=Pacific/Kiritimati  (UTC+14)  ok

First-time fork PR — CI needs maintainer approval to run.

…able (Agent-Field#1808)

The window buckets days in the viewer's local zone on purpose (usageBucketStart,
and the "THE DAY IS THE WRITER'S" law on SpendToday). The test built its
fixture clock in a fixed -04:00 zone and asserted the chat manual quotes the
rendered `since aug 11` verbatim, so once that clock was read as local on a
host far enough east it crossed midnight and rendered `aug 12` instead — green
on a UTC runner, red on a UTC+8 box. Build the fixture clock in time.Local so it
agrees with the bucketing; verified identical under TZ from Pago_Pago to
Kiritimati.
…Agent-Field#1808)

The same fixed -04:00 fixture clock lived in five tasks-page test files, and the
window buckets days in the viewer's local zone, so two tests already failed on a
UTC+8 box — TestTheManualQuotesBothTasksOpeningHeadingsExactly on 'aug 11' vs
'aug 12', and TestTheTasksPageGroupsByWhatYouDoNext on the 'shift+← aug 2 – aug
25 →' window control. One shared cause (Agent-Field#176's lesson), so fix it everywhere:
build each fixture clock in time.Local. Verified green across the full span of
host zones from Pago_Pago to Kiritimati.
@ursasi ursasi changed the title tasks: make TestTheManualQuotesBothTasksOpeningHeadingsExactly $TZ-stable (#1808) tasks: make the tasks-page test fixtures $TZ-stable (#1808) Oct 11, 2026
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.

tasks: window-start date depends on host $TZ, so TestTheManualQuotesBothTasksOpeningHeadingsExactly fails east of UTC

1 participant