Files
Rosea/.agents/reviews/fix-coyhaique.md
T

53 lines
3.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Review — `fix/coyhaique`
Adversarial self-review (CLAUDE.md §5.3) of a data fix to the town list
([`features/sunset-place.md`](../features/sunset-place.md)). 2026-11-17, Node 22.23.4 (tz 2026e).
## What happened
Node on this machine was upgraded from 22.11 to 22.23.4 (the upgrade G0.20 asked for). A content test
then failed: *every zone Intl knows has a guess*: the new Node knows **America/Coyhaique** (created
in 2025 for Chile's Aysén region), and the town list, built under the old Node, had no guess for it.
Rebuilding (`scripts/build-places.ts`, Natural Earth 10m populated places and tzdb 2026f, downloaded
again with Mark's permission) did not fix it, and a town-by-town comparison found more:
| Town | Before | Why |
|:--|:--|:--|
| **Santiago, Valparaíso** | America/Punta_Arenas | Natural Earth files them under **America/Sao_Paulo**. Its fixed UTC−3 matched Chile's fixed-clock southern zone, so the "same clock as one of the country's zones" rule moved Chile's capital onto a clock without daylight saving: its sunset an hour off for half the year. Under the new Node the same rule picked Coyhaique instead. |
| **Coyhaique, Puerto Aisén, Cochrane, Villa O'Higgins** | America/Santiago | Natural Earth predates Aysén's 2025 split. |
| **Punta Arenas, Puerto Natales, Puerto Williams, Río Verde** | America/Santiago | Natural Earth predates Magallanes' 2016 split: wrong since the first build. |
| Yellowknife, Fort Simpson (Canada) | Cambridge_Bay, Dawson_Creek | The rebuild under the new time zone data files them under Edmonton (Mountain time with daylight saving, as both keep). |
## The fix
| # | Change | Why |
|:--|:--|:--|
| C1 | **Another country's own zone is never trusted** for a town, however alike its clock. The town then takes its neighbours' zone. | The clock rule exists to accept old *names* of a country's own zones (Europe/Kiev, Juneau for Anchorage), never a foreign zone. |
| C2 | **Region bands** for southern mainland Chile: 43.7° S – 49° S → America/Coyhaique; south of 49° S → America/Punta_Arenas. Source: zone1970.tab's comments and the regions' borders. | Natural Earth's region names are unreliable (*Ais*, *Aisén…*, Villa O'Higgins under Argentina's *Santa Cruz*); latitude along the real borders is not. Mainland only, so Easter Island keeps Pacific/Easter. |
Twelve towns changed, each listed above; every other town kept its zone. Every zone the new Node
knows has a guess again.
## Bug drills
| Put back | Result |
|:--|:--|
| Another country's zone trusted again | CAUGHT: 2 (Santiago, Valparaíso) |
| No region bands | CAUGHT: 5 |
## Findings
| # | Area | Finding | Resolution |
|:--|:--|:--|:--|
| 1 | Correctness | A player who chose Santiago or Valparaíso before this fix has the wrong zone **saved in their profile** (`sunsetPlace` keeps the town with its zone). | Nobody has: the app is not deployed (G0.13). Recorded so a later data fix knows to ask whether a saved town needs refreshing. |
| 2 | Correctness | Band edges are approximate (the Aysén–Magallanes border is not a straight line of latitude). | Only the towns in the list matter, and each is checked against its region; none lies within 0.5° of an edge except Villa O'Higgins (48.47° S), which is in Aysén, as the band says. |
| 3 | Testing | The original data had this bug since its first build; no test pinned a Chilean town. | Nine towns pinned now (`places.test.ts`); drilled. |
| 4 | Process | The bug surfaced only because a runtime upgrade changed what "every zone" means. | Lesson in `technical.md`: data built against a runtime's time zone data is checked again when the runtime changes. |
| — | Soul, privacy, reachability, offline | Unchanged: the list is bundled and searched on the device. | — |
## Gates
Counts in HANDOVER. The town list is bundled lazily (the `places` chunk): **the app changed** for a
player who searches Chile; rebuilt by the e2e and offline runs; not deployed.