Skip to content

Place legacy-zone cities by their canonical zone (4.5) - #19360

Open
kill74 wants to merge 2 commits into
omacom:v4-5-0from
kill74:fix/issue-19084-elsewhen-zone-aliases
Open

kill74 wants to merge 2 commits into
omacom:v4-5-0from
kill74:fix/issue-19084-elsewhen-zone-aliases

Conversation

@kill74

@kill74 kill74 commented Nov 18, 2026 •

Copy link
Copy Markdown

Fixes #19084. Backport of the approach in #17855 (by @anandude) to the 4.5 release branch.

Root cause

Elsewhen geocodes a city by name and accepts the top result when none of the results carries the row's zone id. Asia/Calcutta is a legacy tzdata link; the geocoder answers with the canonical Asia/Kolkata, so no result matches — and the top result for "Calcutta" is a hamlet in Mpumalanga, South Africa. That is exactly where the marker lands in the report. The offline zone1970.tab fallback had the same problem: it lists only canonical ids, so Asia/Calcutta found nothing either.

Confirmed against the live API:

Calcutta #1  -24.98317, 31.23485  Africa/Johannesburg  (South Africa)
canonical zone via tzdata.zi: Asia/Calcutta -> Asia/Kolkata

What changes

  • zoneAliases() reads the L <canonical> <alias> lines of /usr/share/zoneinfo/tzdata.zi at runtime, so new/changed links need no code update.
  • canonicalZone() resolves a row's zone through those links; pickGeocode() accepts only a geocode result in the row's canonical zone, so a same-named town on another continent is never adopted.
  • zoneTabCoords() still provides the offline fallback by canonical zone, guarded by fallbackZone() so a link that crosses a country border (e.g. Pacific/Truk → Pacific/Port_Moresby) does not silently move a city to another country.
  • Panel.qml loads tzdata.zi and passes the aliases into the geocode handler.

Verification

  • End-to-end with real data: Asia/Calcutta canonicalizes to Asia/Kolkata, the South-Africa geocode is rejected, and the zone table places the city at 22.58, 88.37 (Kolkata, India).
  • New cases in test/shell.d/elsewhen-model-test.sh fail on the base branch and pass with the fix; all six elsewhen-*-test.sh files pass.
  • git diff --check clean.
  • No visual capture taken: it would require taking over the running shell with a specific legacy-timezone configuration; the coordinate resolution was verified with the real geocoder payload and tzdata instead.

Fixes #17782

Elsewhen geocoded city names and matched the result zone against the
row's zone id. A legacy alias such as Asia/Calcutta never matches the
geocoder's Asia/Kolkata, so the top result was adopted instead: a Calcutta
in South Africa, putting the marker in Mpumalanga.

Resolve tzdata links from tzdata.zi before matching, accept only a geocode
in the row's own (canonical) zone, and read the offline zone table by the
canonical name unless the link crosses a country border. Backported from
open PR omacom#17855 by Anandakrishnan CV.

Co-authored-by: Anandakrishnan CV <ananducv666@gmail.com>
@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain in the reviewed changes.

Summary

Elsewhen resolves legacy time-zone names before choosing coordinates and rejects geocoder results from unrelated zones.

  • Elsewhen places city markers using matching canonical timezones.

Reviews (2) · Last reviewed commit: "Keep Jan Mayen outside its shared clock ..." · Reviewed by Greptile

@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 XHigh in Codex reviewed the diff, the Elsewhen call site, the linked report #19084, and the release branch's contributor rules. I classify this as a bug fix, but the configured classification model, deepseek-v4p1-flash, returned no classification, so the two-model classification remains unsettled. The review service health check answered; no second code review or tests ran. This is waiting for the classification check to be resolved before verification can proceed.

@omarchybot omarchybot added the bug Something isn't working label Nov 22, 2026
The country table inherits Germany from the compiled timezone link. Elsewhen now uses that table to guard geographic fallbacks, so the inherited value sends Jan Mayen to Berlin when geocoding fails. Override it with the country of the place and cover the actual model and greeting-table integration.

Co-Authored-By: GPT-6 XHigh <noreply@openai.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 22, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 XHigh in Codex reproduced the Calcutta error on an ISO worker using the live geocoder and installed timezone data: the base selected South Africa at -24.98317, 31.23485; this head selected Kolkata at 22.5333, 88.3667. Reverting the fix restored the error. CLI and all six Elsewhen test files passed on the corrected tree (515 checks).

Opus 5.5 High found that Jan Mayen's existing country entry let the new fallback place it in Berlin. I pushed 5ba6e92e to keep Jan Mayen in its own country; this also corrects its greeting from German to Norwegian. The integration regression fails without that correction. Opus 5.5 High and muse-wonder via pi, thinking high reviewed the corrected head and agreed this correction is contained; independence is not guaranteed.

One policy decision remains: when geocoding fails or finds no matching zone, same-country aliases still use another city's representative coordinates, including Montreal → Toronto and Currie → Hobart. Both reviewers left choosing that behavior versus a curated rename list to the maintainer. This PR also targets v4-5-0, while the queue requires the default branch quattro for ready. It is verified and waiting on the maintainer's approach and branch decisions.

Before, on the base: Calcutta's marker in southern Africa.

Before: Calcutta tracked under Asia/Calcutta, with its marker in southern Africa

After, on the tested head: Calcutta's marker in India. These captures establish the marker location; they do not establish weather forecast accuracy.

After: Calcutta tracked under Asia/Calcutta, with its marker in India

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants