Skip to content

fix(timezones): the 27 Etc/GMT* picker labels show the inverted offset, and the comment above them claims otherwise - #742

Merged
Ardnived merged 3 commits into
mainfrom
claude/fix-729-etc-gmt-labels
Sep 10, 2026
Merged

Ardnived merged 3 commits into
mainfrom
claude/fix-729-etc-gmt-labels

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • All 27 Etc/GMT* timezone-picker labels stated the opposite UTC offset. They now state the real one.
  • POSIX inverts the sign in the zone name — Etc/GMT-3 is UTC+03:00 — and the label's sign was read off the same loop counter that builds the name.
  • Label only. The enum members are the values, which are byte-identical, so no schema change and no migration.
  • No stored schedule is affected. Production holds 601 Events and 57 AppCards across 48 distinct zones, and not one is Etc/*. Nothing to migrate, no follow-up ticket.

Preview

https://sahajcloud-sahajcloud-pr-742.up.railway.app — Railway rebuilds it minutes after each push.

Test results

  • Lean gate: ✓ pnpm lint, pnpm typecheck, pnpm typecheck:tests, pnpm test:unit (128 files, 1671 tests, 131s)
  • Targeted specs: tests/unit/timezone-options.spec.ts — 11 passed
  • Existing-data check: 601 production Events (finished included) and 57 AppCards read back — zero Etc/* zones
  • Migration probe: timeout 300 pnpm db:migrations:create probe --skip-empty < /dev/null exits 0 and generates no file
  • Build: N/A — Railway builds the preview

Manual verification

  1. Admin → Events → a schedule → open the timezone picker and scroll to the Etc/GMT* block.
  2. Etc/GMT-3 must read (UTC+03:00), Etc/GMT+3 must read (UTC-03:00), and Etc/GMT must read (UTC+00:00).

Notes for reviewer

The loop counter deliberately stays on the POSIX axis. Iterating the real offset -12..14 instead would look tidier and drop a variable, but insertion order into byValue is the Postgres enum order (src/payload-types.ts:577-603 bakes Etc/GMT-14 … Etc/GMT+12). Flipping the loop reverses those 27, breaks PINNED_DIGEST, and costs a five-enum drop-and-recreate for no reader benefit.

Intl is the test oracle, never the production source. The module reads rawTimeZones precisely because host ICU varies and the values are schema. Using Intl to verify a closed 27-element arithmetic fact carries none of that risk, and it is what the ticket asks for. A second case pins five labels literally so a sign flip in both the module and the oracle still goes red.

One gap I found and did not close: nothing pins the labels of the other 554 zones, so a @vvo/tzdb bump could silently reword them. Left out — labels are not schema, so a digest over them would newly block CI on harmless rewording. Different tradeoff, different ticket.

Detail

The defect

src/lib/timezones/index.ts appended the POSIX range with the name and the label derived from one variable:

for (let offset = -14; offset <= 12; offset++) {
  const value = offset === 0 ? 'Etc/GMT' : `Etc/GMT${offset < 0 ? offset : `+${offset}`}`
  const sign = offset >= 0 ? '+' : '-'      // ← the POSIX sign, not the real one

The counter names the zone. Its negation is the real offset. Separating the two (const utcOffset = -posix) closes the bug class rather than the instance — a sign = offset <= 0 ? '+' : '-' bandaid would produce the same output while leaving the next reader to re-derive hh wrong.

The comment above the loop already claimed the inversion was handled, so a reader was told the opposite of what the code did. It now describes the negation the code performs, and stops there (ac09b62).

Impact, before the fix

An operator picking (UTC-03:00) Etc/GMT-3 for a São Paulo event set UTC+03:00 — six hours off, in the field that decides when a session reminder fires. Etc/GMT (offset 0) was the one correct entry.

seeds/atlas/helpers/scheduleMapper.ts maps these zones by value (.map(({ value }) => value) into a Set, never reading label), so imported data was never affected.

No stored schedule carries one

Read back from production on 2026-09-09 with the client API key, over both collections that use scheduleFields:

Collection Docs Distinct zones Etc/*
Events 601 48 0
AppCards 57 1 (Europe/London) 0

The Events read passes where[or][…][schedule.lastDate][exists], which trips excludeFinishedEvents' opt-out, so finished events are counted too. So correcting the label corrects everything, and there is no wrong data behind it.

⚠ The client key reads published, untrashed documents. An unpublished draft or a trashed event sits outside that view — a gap worth naming rather than papering over, though a draft with an Etc/* zone would still be corrected by re-picking before publication.

Fixture pre-mortem

The spec asserts exactly 27 Etc/GMT* entries. That assumes no @vvo/tzdb alias contributes another Etc/* value ahead of the loop. Verified against the built list: all 27 Etc/* entries come from this loop, and every label now matches Intl.

Regression discipline

Both new cases were watched red against the reintroduced flip (utcOffset = posix), then restored. A green new test proves nothing on its own.

Review pass

Four lenses over the branch diff — reuse, simplification, efficiency, altitude.

  • Reuse: clean. No existing UTC-offset label formatter or Intl test oracle in the repo. registrationDetails.ts's private zoneName() emits ICU short names for email copy — wrong shape, and exporting it would trip the one-consumer rule in tests/unit/lib-boundary.spec.ts.
  • Efficiency: clean. The module loop is unchanged in cost. Applied the one free suggestion (hoist the oracle's Date out of the per-zone helper) as its own commit. The 27 Intl.DateTimeFormat constructions cost ~35ms — 0.7% of the Tier 1 budget — and cannot be hoisted, since timeZone is baked into the constructor.
  • Altitude: clean. No special cases layered on shared infrastructure; every other offset-rendering site in src/, seeds/, tests/ and scripts/ was checked for the same inversion and is immune.
  • Simplification: two nits, both dismissed. (1) Collapsing the name's ternary touches pre-existing, schema-critical text this diff merely re-indented. (2) Dropping the Intl oracle for a literal 27-row table — rejected, the ticket's acceptance criterion names Intl.DateTimeFormat(…, { timeZoneName: 'longOffset' }) specifically.

Tooling note

pr-review-toolkit is not installed in this environment, so the review ran as four /simplify lenses plus the checks above rather than the toolkit's six agents. Security review was skipped: no path in the diff matches securityReview.triggerPattern.

Closes #729

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

…SIX name

All 27 `Etc/GMT*` picker labels stated the opposite offset. POSIX inverts
the sign in the zone NAME — `Etc/GMT-3` is UTC+03:00 — and the label's
sign was derived from the same loop counter that builds the name, so it
repeated the POSIX sign instead of negating it.

The failure this prevents: an operator picking `(UTC-03:00) Etc/GMT-3`
for a São Paulo event set UTC+03:00 — six hours off, in the field that
decides when a session reminder fires. `Etc/GMT` (offset 0) was the one
correct entry.

The comment above the loop already claimed the inversion was handled, so
a reader was told the opposite of what the code did. It now describes the
negation the code performs.

Label only. The enum members are the `value`s, which are untouched, so
`PINNED_DIGEST` and `PINNED_LENGTH` are unchanged and
`pnpm db:migrations:create probe --skip-empty` generates nothing
(verified). `seeds/atlas/helpers/scheduleMapper.ts` maps these zones by
value, so imported data was never affected.

Two spec cases, both watched red against the reintroduced flip:

- every `Etc/GMT*` label against `Intl` with `timeZoneName: 'longOffset'`.
  Intl is a safe oracle for exactly these 27 — fixed offsets, no DST, no
  ICU naming history — and unsafe for membership, which is why the module
  still reads `rawTimeZones`. A zone Intl declines to format fails rather
  than passing vacuously.
- the five measured labels pinned literally, so a sign flip in both the
  module and the oracle still goes red.

Fixture pre-mortem: the count of 27 assumes no tzdb alias contributes
another `Etc/*` value. Verified against the built list — all 27 `Etc/*`
entries come from this loop.

Closes #729

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HRM3ALujqcnyNFHFyzwJrc
…one helper

Per the /simplify efficiency pass: the helper rebuilt the same `Date` on
every one of the 27 calls. A POSIX `Etc/GMT*` zone has no DST, so any
instant answers, and one pinned constant is clearer about that than a
value reconstructed per call.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HRM3ALujqcnyNFHFyzwJrc
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-742 September 9, 2026 16:12 Destroyed
@railway-app

railway-app Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-742 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Sep 9, 2026 at 4:38 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot

sydevs-bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 address-review · started 16:54Z · attempt 1 · session
CI fix 3

recent dispatches
  • 16:54Z address-review · attempt 1 · session
  • 16:44Z fix-ci · attempt 1 · session · done
  • 16:44Z fix-ci · attempt 1 · session
  • 16:40Z fix-ci · attempt 1 · session · done
  • 16:40Z fix-ci · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 Adversarial review

The fix matches #729 exactly — three module lines, no schema movement, and utcOffset = -posix closes the bug class, not the instance. PINNED_DIGEST and the 27 enum members are untouched. The literal-pin spec is the one thing the ticket did not ask for, and it earns its place as a second, underived oracle.

The PR does not say what operators already picked under the old label. Correcting the label does not correct a schedule someone stored six hours out.

Findings

  • should-fix — Etc/GMT* schedules chosen under the inverted label stay wrong (index.ts:60).
  • consider — the comment's last sentence narrates the removed defect (index.ts:54).

What was checked

  • #729's acceptance criteria. All met.
  • Both files read.
  • Consumers: payload.config.ts:105 (admin picker) and scheduleMapper.ts:99, which Sets value, never label. No cross-repo surface.
  • src/payload-types.ts holds 27 Etc/GMT* members, matching the loop range and order.
  • Arithmetic at both ends and zero: -14 → +14, +12 → -12, GMT → +00:00.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/lib/timezones/index.ts Resolved
Comment thread src/lib/timezones/index.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 9, 2026
The last sentence described the bug this PR removed, not what the code
does. `utcOffset = -posix` states the rule one line below, and #729's
acceptance criterion asks the comment to describe the code.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013AHKB72MFYFcrCpqA3KnV5
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-742 September 9, 2026 16:34 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Addressed both adversarial-review threads. Pushed ac09b62.

Lean gate green: lint, typecheck, test typecheck, 1671 unit tests.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 9, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

CI is still red after 3 fix attempts (failing: dispatch / act (sydevs, SahajCloud, sydevs/SahajCloud, pr, 742, review, pull_request_review.submitted, sydev..., dispatch / act (sydevs, SahajCloud, sydevs/SahajCloud, pr, 742, issue_comment, pull_request_review_comment.c...). I have stopped retrying. A comment or a push from you starts me again.

🤖 sydevs dispatcher

@Ardnived

Ardnived commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Re-deriving after sydevs/claude-workflow#86.

The three fix-ci sessions on this PR were chasing nothing. Lint, Test & Smoke passed; the failures the dispatcher saw were its own dispatch / act matrix legs, cancelled by cancel-in-progress. ci.ignoreCheckNames matched by equality and GitHub names a matrix leg dispatch / act (…params…), so the list never matched one.

Fixed, and awaiting cleared. Nothing was wrong with this branch.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 9, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Confirmed, and nothing to change on this branch.

  • Lint, Test & Smoke is green on ac09b62 — success at 16:44Z.
  • The only red legs were dispatch / act matrix jobs, cancelled by cancel-in-progress.
  • Both adversarial-review threads are resolved. No thread waits on a reply.
  • The three fix-ci sessions pushed nothing. Head has been ac09b62 since 16:32Z.

No commit, no push. The PR stands where the adversarial review left it.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 9, 2026
@sydevs-bot
sydevs-bot requested a review from Ardnived September 10, 2026 00:50
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

This draft has had no CI activity for hours and no session holds it. Comment or push to wake me.

🤖 sydevs dispatcher

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

I could not mark ready here — the dispatch token is not allowed to. Everything else on this item is done, so this is the one step left for you.

🤖 sydevs dispatcher

@sydevs-bot
sydevs-bot marked this pull request as ready for review September 10, 2026 01:22
@Ardnived
Ardnived merged commit 8483cb7 into main Sep 10, 2026
47 of 50 checks passed
@Ardnived
Ardnived deleted the claude/fix-729-etc-gmt-labels branch September 10, 2026 01:23
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 10, 2026

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-742 — ac09b623 Deployed Sep 9, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

fix(timezones): the 27 Etc/GMT* picker labels show the inverted offset, and the comment above them claims otherwise

3 participants