Repository navigation
fix(timezones): the 27 Etc/GMT* picker labels show the inverted offset, and the comment above them claims otherwise - #742
Conversation
…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
|
🚅 Deployed to the SahajCloud-pr-742 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 address-review · started 16:54Z · attempt 1 · session recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 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) andscheduleMapper.ts:99, which Setsvalue, neverlabel. No cross-repo surface. src/payload-types.tsholds 27Etc/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
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
|
Addressed both adversarial-review threads. Pushed
Lean gate green: lint, typecheck, test typecheck, 1671 unit tests. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
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 |
|
Re-deriving after sydevs/claude-workflow#86. The three Fixed, and |
|
Confirmed, and nothing to change on this branch.
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 |
|
This draft has had no CI activity for hours and no session holds it. Comment or push to wake me. 🤖 sydevs dispatcher |
|
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 |
Summary
Etc/GMT*timezone-picker labels stated the opposite UTC offset. They now state the real one.Etc/GMT-3is UTC+03:00 — and the label's sign was read off the same loop counter that builds the name.values, which are byte-identical, so no schema change and no migration.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
pnpm lint,pnpm typecheck,pnpm typecheck:tests,pnpm test:unit(128 files, 1671 tests, 131s)tests/unit/timezone-options.spec.ts— 11 passedEtc/*zonestimeout 300 pnpm db:migrations:create probe --skip-empty < /dev/nullexits 0 and generates no fileManual verification
Etc/GMT*block.Etc/GMT-3must read(UTC+03:00),Etc/GMT+3must read(UTC-03:00), andEtc/GMTmust read(UTC+00:00).Notes for reviewer
The loop counter deliberately stays on the POSIX axis. Iterating the real offset
-12..14instead would look tidier and drop a variable, but insertion order intobyValueis the Postgres enum order (src/payload-types.ts:577-603bakesEtc/GMT-14 … Etc/GMT+12). Flipping the loop reverses those 27, breaksPINNED_DIGEST, and costs a five-enum drop-and-recreate for no reader benefit.Intlis the test oracle, never the production source. The module readsrawTimeZonesprecisely because host ICU varies and the values are schema. UsingIntlto 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/tzdbbump 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.tsappended the POSIX range with the name and the label derived from one variable: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 — asign = offset <= 0 ? '+' : '-'bandaid would produce the same output while leaving the next reader to re-derivehhwrong.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-3for 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.tsmaps these zones by value (.map(({ value }) => value)into a Set, never readinglabel), 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:Etc/*Europe/London)The Events read passes
where[or][…][schedule.lastDate][exists], which tripsexcludeFinishedEvents' 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/tzdbalias contributes anotherEtc/*value ahead of the loop. Verified against the built list: all 27Etc/*entries come from this loop, and every label now matchesIntl.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.
registrationDetails.ts's privatezoneName()emits ICU short names for email copy — wrong shape, and exporting it would trip the one-consumer rule intests/unit/lib-boundary.spec.ts.Dateout of the per-zone helper) as its own commit. The 27Intl.DateTimeFormatconstructions cost ~35ms — 0.7% of the Tier 1 budget — and cannot be hoisted, sincetimeZoneis baked into the constructor.src/,seeds/,tests/andscripts/was checked for the same inversion and is immune.Intl.DateTimeFormat(…, { timeZoneName: 'longOffset' })specifically.Tooling note
pr-review-toolkitis not installed in this environment, so the review ran as four/simplifylenses plus the checks above rather than the toolkit's six agents. Security review was skipped: no path in the diff matchessecurityReview.triggerPattern.Closes #729
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code