ci red on main: the #1721 updates-clock tests assume the runner's TZ is UTC — green on the UTC dev server, 10 failures on matou-workstation (GMT-5) and on NZST #1727

Closed
opened 2026-09-22 06:54:27 +00:00 by matou-build-agent · 3 comments

Symptom

ci / seam is red on main at 8a0e9c61 (sandcastle: #1721 — Updates times render WHERE THE OPERATOR IS, the zone named once). 10 dashboard unit tests fail:

tests/unit/updates.test.ts      expected '…21:00–23:00 GMT-5…' to contain '02:00–04:00'
tests/unit/updateReview.test.ts expected '…(21:00–23:00 GMT-5)'  to contain '02:00–04:00'
tests/unit/updatePolicy.test.ts expected 'GMT-5 · every night'   to contain 'UTC'
tests/unit/updatePolicy.test.ts expected '20:00' to be '01:00'   (form seeded local)
tests/unit/updatePolicy.test.ts SetPolicy window {08:00,10:00} vs expected {03:00,05:00}
tests/unit/rollout.test.ts      expected '…started 21:04 GMT-5' to contain 'started 02:04 UTC'
tests/unit/rollout.test.ts      expected '…applied 21:41 GMT-5' to contain 'applied 02:41 UTC'
tests/unit/rollback.test.ts     expected '…· 21:12 GMT-5' to contain '02:12'

Run: https://git.matou.nz/Matou/idss/actions/runs/29905

Root cause — the tests depend on the runner's own TZ

#1721 made these screens render each UTC instant/window where the viewer is
(dashboard/src/lib/localtime.ts). That is the intended behaviour and it works.
But the assertions added/kept alongside it hard-code the UTC strings and assume
the process TZ is UTC. updatePolicy.test.ts:48 says so out loud:

// #1721: … the zone named once (UTC in this test env) …
expect(wrapper.get('[data-field="window-zone"]').text()).toContain('UTC');

Nothing pins TZ — not dashboard/vitest.config.ts, not scripts/seam-smoke.sh,
not .forgejo/workflows/ci.yml. So the suite passes or fails according to which
machine runs it:

TZ result
TZ=UTC (matou-dev-server-01, where the #1721 worker ran and reported green) 5/5 files green, 85 tests
America/Bogota (matou-workstation, the ci runner — verified timedatectl) 10 failed
Pacific/Auckland (Ben's own machine) fails — e.g. 'Window14:00–16:00 NZST…' to contain '02:00–04:00'

Reproduced deterministically by the healer on matou-workstation:

cd dashboard
TZ=UTC npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback}.test.ts   # 85 passed
npx vitest run …same files…                                                                      # 10 failed

tests/unit/localtime.test.ts is the one file that got this right — it pins its
zones, and it passes under every TZ above.

What needs deciding (why this is agent work, not a harness patch)

Two candidate fixes, and the choice is a product call the healer must not make:

  1. Make the assertions zone-explicit — each test pins the zone it means
    (process.env.TZ / vi.stubEnv per file, or assert through the localtime.ts
    helpers rather than against literal clock strings), the way localtime.test.ts
    already does. Keeps the suite honest about the local-rendering behaviour
    #1721 shipped.
  2. Pin TZ: 'UTC' for the whole dashboard suite (test.env in
    dashboard/vitest.config.ts) and keep explicit-zone tests only where the
    zone is the subject. Cheapest, but it makes every clock assertion silently
    mean "UTC" again — the exact ambiguity #1721 set out to remove.

Whichever is chosen, the fix belongs in dashboard/, not in the CI workflow:
pinning TZ only in .forgejo/workflows/ci.yml would turn main green while
leaving pnpm test red for any human not sitting at UTC.

Note playwright.harness.config.ts already pins timezoneId: 'Pacific/Auckland'
for preview renders (#1721 did this deliberately) — the vitest side never got the
matching treatment.

Acceptance

  • dashboard vitest passes under TZ=UTC, TZ=America/Bogota and
    TZ=Pacific/Auckland (all three checked in the ticket's verification).
  • No product behaviour change: #1721's local-zone rendering and the seam's
    gateway-UTC HH:MM storage contract stay exactly as they are.
  • main is green on ci.

Filed by the swarm healer — ci run 29905, signature c1408288ddac,
heal run heal-Matou-idss-1790059949-3987232. Regression from 8a0e9c61 (#1721).

## Symptom `ci` / seam is **red on `main`** at 8a0e9c61 (`sandcastle: #1721 — Updates times render WHERE THE OPERATOR IS, the zone named once`). 10 dashboard unit tests fail: ``` tests/unit/updates.test.ts expected '…21:00–23:00 GMT-5…' to contain '02:00–04:00' tests/unit/updateReview.test.ts expected '…(21:00–23:00 GMT-5)' to contain '02:00–04:00' tests/unit/updatePolicy.test.ts expected 'GMT-5 · every night' to contain 'UTC' tests/unit/updatePolicy.test.ts expected '20:00' to be '01:00' (form seeded local) tests/unit/updatePolicy.test.ts SetPolicy window {08:00,10:00} vs expected {03:00,05:00} tests/unit/rollout.test.ts expected '…started 21:04 GMT-5' to contain 'started 02:04 UTC' tests/unit/rollout.test.ts expected '…applied 21:41 GMT-5' to contain 'applied 02:41 UTC' tests/unit/rollback.test.ts expected '…· 21:12 GMT-5' to contain '02:12' ``` Run: https://git.matou.nz/Matou/idss/actions/runs/29905 ## Root cause — the tests depend on the runner's own TZ #1721 made these screens render each UTC instant/window **where the viewer is** (`dashboard/src/lib/localtime.ts`). That is the intended behaviour and it works. But the assertions added/kept alongside it hard-code the *UTC* strings and assume the process TZ is UTC. `updatePolicy.test.ts:48` says so out loud: ```ts // #1721: … the zone named once (UTC in this test env) … expect(wrapper.get('[data-field="window-zone"]').text()).toContain('UTC'); ``` Nothing pins `TZ` — not `dashboard/vitest.config.ts`, not `scripts/seam-smoke.sh`, not `.forgejo/workflows/ci.yml`. So the suite passes or fails according to which machine runs it: | TZ | result | |---|---| | `TZ=UTC` (matou-dev-server-01, where the #1721 worker ran and reported green) | **5/5 files green, 85 tests** | | `America/Bogota` (matou-workstation, the ci runner — verified `timedatectl`) | **10 failed** | | `Pacific/Auckland` (Ben's own machine) | **fails** — e.g. `'Window14:00–16:00 NZST…' to contain '02:00–04:00'` | Reproduced deterministically by the healer on matou-workstation: ``` cd dashboard TZ=UTC npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback}.test.ts # 85 passed npx vitest run …same files… # 10 failed ``` `tests/unit/localtime.test.ts` is the one file that got this right — it pins its zones, and it passes under every TZ above. ## What needs deciding (why this is agent work, not a harness patch) Two candidate fixes, and the choice is a product call the healer must not make: 1. **Make the assertions zone-explicit** — each test pins the zone it means (`process.env.TZ` / `vi.stubEnv` per file, or assert through the `localtime.ts` helpers rather than against literal clock strings), the way `localtime.test.ts` already does. Keeps the suite honest about the *local-rendering* behaviour #1721 shipped. 2. **Pin `TZ: 'UTC'`** for the whole dashboard suite (`test.env` in `dashboard/vitest.config.ts`) and keep explicit-zone tests only where the zone is the subject. Cheapest, but it makes every clock assertion silently mean "UTC" again — the exact ambiguity #1721 set out to remove. Whichever is chosen, the fix belongs **in `dashboard/`**, not in the CI workflow: pinning TZ only in `.forgejo/workflows/ci.yml` would turn `main` green while leaving `pnpm test` red for any human not sitting at UTC. Note `playwright.harness.config.ts` already pins `timezoneId: 'Pacific/Auckland'` for preview renders (#1721 did this deliberately) — the vitest side never got the matching treatment. ## Acceptance - `dashboard` vitest passes under `TZ=UTC`, `TZ=America/Bogota` **and** `TZ=Pacific/Auckland` (all three checked in the ticket's verification). - No product behaviour change: #1721's local-zone rendering and the seam's gateway-UTC `HH:MM` storage contract stay exactly as they are. - `main` is green on `ci`. --- Filed by the swarm healer — ci run 29905, signature `c1408288ddac`, heal run `heal-Matou-idss-1790059949-3987232`. Regression from 8a0e9c61 (#1721).
Author
Member

swarm-claim host=bens-mac-04 run=29926
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=29926 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

Ruled by agent under ADR 0174 — veto anytime.

Decision: of the two candidate fixes, take Option 1 (make the assertions zone-explicit), not Option 2 (pin TZ=UTC suite-wide).

Ruling: the ten TZ-dependent assertions in updates/updateReview/updatePolicy/rollout/rollback now assert through the localtime.ts helpers (windowPhrase, localInstant, localWindow, localClockToUtc) with the same default zone+anchor the components use — exactly as localtime.test.ts already does. No literal clock string is hard-coded, so the suite is deterministic under TZ=UTC, America/Bogota and Pacific/Auckland, and a regression that dropped the zone marker or the conversion still reds the test (it would no longer match the helper output). No product code changes: #1721 local-zone rendering and the gateway-UTC HH:MM storage contract are untouched.

Why two-way door: revertible by a later commit (test-only change), and provable by the existing suite run under all three TZs. Option 2 was rejected because it would make every clock assertion silently mean UTC again — the exact ambiguity #1721 removed. The fix lives in dashboard/, not .forgejo/, so pnpm test stays green for anyone not on UTC.

What proves it: TZ=UTC|America/Bogota|Pacific/Auckland npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback}.test.ts — all green.

Ruled by agent under ADR 0174 — veto anytime. **Decision:** of the two candidate fixes, take **Option 1 (make the assertions zone-explicit)**, not Option 2 (pin `TZ=UTC` suite-wide). **Ruling:** the ten TZ-dependent assertions in `updates`/`updateReview`/`updatePolicy`/`rollout`/`rollback` now assert **through the `localtime.ts` helpers** (`windowPhrase`, `localInstant`, `localWindow`, `localClockToUtc`) with the same default zone+anchor the components use — exactly as `localtime.test.ts` already does. No literal clock string is hard-coded, so the suite is deterministic under `TZ=UTC`, `America/Bogota` and `Pacific/Auckland`, and a regression that dropped the zone marker or the conversion still reds the test (it would no longer match the helper output). No product code changes: #1721 local-zone rendering and the gateway-UTC `HH:MM` storage contract are untouched. **Why two-way door:** revertible by a later commit (test-only change), and provable by the existing suite run under all three TZs. Option 2 was rejected because it would make every clock assertion silently mean UTC again — the exact ambiguity #1721 removed. The fix lives in `dashboard/`, not `.forgejo/`, so `pnpm test` stays green for anyone not on UTC. **What proves it:** `TZ=UTC|America/Bogota|Pacific/Auckland npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback}.test.ts` — all green.
Author
Member

close-report for #1727 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1727,
  "status": "success",
  "commits": [
    "d996a51e"
  ],
  "changed_files": [
    "STATUS.md",
    "dashboard/tests/unit/rollback.test.ts",
    "dashboard/tests/unit/rollout.test.ts",
    "dashboard/tests/unit/updatePolicy.test.ts",
    "dashboard/tests/unit/updateReview.test.ts",
    "dashboard/tests/unit/updates.test.ts"
  ],
  "tests": [
    {
      "command": "cd dashboard && TZ=UTC npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback,localtime}.test.ts",
      "exit_code": 0
    },
    {
      "command": "cd dashboard && TZ=America/Bogota npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback,localtime}.test.ts",
      "exit_code": 0
    },
    {
      "command": "cd dashboard && TZ=Pacific/Auckland npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback,localtime}.test.ts",
      "exit_code": 0
    },
    {
      "command": "cd dashboard && TZ=America/Bogota npx vitest run",
      "exit_code": 0
    },
    {
      "command": "cd dashboard && TZ=Pacific/Auckland npx vitest run",
      "exit_code": 0
    },
    {
      "command": "npx eslint dashboard/tests/unit/{updates,updateReview,updatePolicy,rollout,rollback}.test.ts",
      "exit_code": 0
    },
    {
      "command": "cd dashboard && npx vue-tsc --noEmit -p tsconfig.json",
      "exit_code": 0
    }
  ],
  "criteria": {
    "dashboard vitest passes under TZ=UTC, TZ=America/Bogota AND TZ=Pacific/Auckland": "full dashboard vitest (139 files, 1785 tests) green under Bogota and Auckland; the five affected files + localtime = 94 tests green under all three TZs (tests array)",
    "No product behaviour change: #1721's local-zone rendering and the seam's gateway-UTC HH:MM storage contract stay exactly as they are": "changed_files are test-only + STATUS.md; no src/ or seam file touched — assertions now go through localtime.ts helpers, the helpers and dashboard/src remain unchanged (commit d996a51e diff)",
    "main is green on ci": "commit d996a51e reachable from origin/main; the 10 previously-failing assertions now pass regardless of runner TZ, verified under UTC/Bogota/Auckland"
  },
  "summary": "Made the ten #1721 updates-clock assertions zone-explicit (assert through the localtime.ts helpers), so dashboard vitest is deterministic under any runner TZ and ci is green on main again.",
  "blockers": []
}
**close-report** for #1727 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1727, "status": "success", "commits": [ "d996a51e" ], "changed_files": [ "STATUS.md", "dashboard/tests/unit/rollback.test.ts", "dashboard/tests/unit/rollout.test.ts", "dashboard/tests/unit/updatePolicy.test.ts", "dashboard/tests/unit/updateReview.test.ts", "dashboard/tests/unit/updates.test.ts" ], "tests": [ { "command": "cd dashboard && TZ=UTC npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback,localtime}.test.ts", "exit_code": 0 }, { "command": "cd dashboard && TZ=America/Bogota npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback,localtime}.test.ts", "exit_code": 0 }, { "command": "cd dashboard && TZ=Pacific/Auckland npx vitest run tests/unit/{updates,updateReview,updatePolicy,rollout,rollback,localtime}.test.ts", "exit_code": 0 }, { "command": "cd dashboard && TZ=America/Bogota npx vitest run", "exit_code": 0 }, { "command": "cd dashboard && TZ=Pacific/Auckland npx vitest run", "exit_code": 0 }, { "command": "npx eslint dashboard/tests/unit/{updates,updateReview,updatePolicy,rollout,rollback}.test.ts", "exit_code": 0 }, { "command": "cd dashboard && npx vue-tsc --noEmit -p tsconfig.json", "exit_code": 0 } ], "criteria": { "dashboard vitest passes under TZ=UTC, TZ=America/Bogota AND TZ=Pacific/Auckland": "full dashboard vitest (139 files, 1785 tests) green under Bogota and Auckland; the five affected files + localtime = 94 tests green under all three TZs (tests array)", "No product behaviour change: #1721's local-zone rendering and the seam's gateway-UTC HH:MM storage contract stay exactly as they are": "changed_files are test-only + STATUS.md; no src/ or seam file touched — assertions now go through localtime.ts helpers, the helpers and dashboard/src remain unchanged (commit d996a51e diff)", "main is green on ci": "commit d996a51e reachable from origin/main; the 10 previously-failing assertions now pass regardless of runner TZ, verified under UTC/Bogota/Auckland" }, "summary": "Made the ten #1721 updates-clock assertions zone-explicit (assert through the localtime.ts helpers), so dashboard vitest is deterministic under any runner TZ and ci is green on main again.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1727
No description provided.