[content] Coyhaique: Merge the town list fix for Chile's clocks
This commit is contained in:
@@ -36,7 +36,7 @@ board exist, and the first real picture is the author's to make.
|
||||
| G0.17 | Manual: install on a phone, open in airplane mode | Open. Needs a hosted build (G0.13). |
|
||||
| G0.18 | The library is empty | Open. **Phase 0 gate**: 60 sentences, each sourced and verified public domain (ROADMAP Phase 0). Release needs ≥ 365. `verifiedBy` is a person, so an agent may propose candidates but never mark one verified (D4). Since 2026-11-02 candidates wait in `content/candidates/`, each with where to read it; the author verifies with `pnpm library:verify <id…> --by <name>` (day-sentence.md P8). |
|
||||
| G0.19 | Event kinds other than `care` | Open. GAMEPLAY.md now exists; each kind arrives with the feature doc that uses it, starting in Phase 1. |
|
||||
| G0.20 | Node 22.11 on the dev machine is below what some pinned dependencies declare | Open. All gates pass on 22.11 today. Upgrade to ≥ 22.13 and unpin (D11). |
|
||||
| G0.20 | Node 22.11 on the dev machine is below what some pinned dependencies declare | Narrowed 2026-11-17: the machine runs **Node 22.23.4** (upgraded by the author). Its newer time zone data exposed a stale town list, fixed on `fix/coyhaique` (Santiago had been on a southern zone's clock since the first build). **Still open:** unpin the dependencies pinned for 22.11 (D11), in their own commit. |
|
||||
| G0.21 | No PNG icons | Open (predicted trap). iOS ignores SVG for `apple-touch-icon`. Comes through the art pipeline. |
|
||||
| G0.22 | No CI | Open. Every gate ran on this machine only. With G0.13. |
|
||||
| G0.23 | Source maps are built and would be published | Open. `sourcemap: true`; maps are not precached. Decide with G0.13 whether the repository is public. If not, use `'hidden'`. |
|
||||
|
||||
@@ -11,7 +11,7 @@ and **how to apply it**.
|
||||
| `design.md` | none yet | Wording, silence, empty states. |
|
||||
| [`art.md`](art.md) | 3 | The image pipeline. |
|
||||
| [`code.md`](code.md) | 3 | TypeScript, Svelte, async ordering, Rust. |
|
||||
| [`technical.md`](technical.md) | 6 | The browser and the build as platforms. |
|
||||
| [`technical.md`](technical.md) | 7 | The browser and the build as platforms. |
|
||||
| [`testing.md`](testing.md) | 10 | What makes a test worth having, and how a passing test lies. |
|
||||
| `privacy.md` | none yet | What could leave the device or make a person findable. (The geocell finding is in the review, not here: it was caught before it cost anything.) |
|
||||
| [`process.md`](process.md) | 4 | Workflow, commits, credentials, honesty about what shipped. |
|
||||
|
||||
@@ -83,3 +83,17 @@ that was imagined, not the one that was built.
|
||||
|
||||
**How to apply it.** Before acting on a predicted trap, write the test that would show it, run it
|
||||
against the built app, and fix what fails. Then rewrite the trap's row with what was measured.
|
||||
|
||||
## Data built against a runtime's time zones goes stale when the runtime changes
|
||||
|
||||
**What happened.** On 2026-11-17 Node went from 22.11 to 22.23.4 and a test found a time zone
|
||||
(America/Coyhaique) with no town guess. Rebuilding the town list then showed far worse: Santiago had
|
||||
sat on a southern zone's clock since the first build, because Natural Earth files it under
|
||||
America/Sao_Paulo and the build trusted any zone whose clock matched one of the country's own.
|
||||
|
||||
**Why it bit.** A build step that consults `Intl` bakes the runtime's time zone data into a file. An
|
||||
upgrade changes the answers silently; only a test that asks *every* zone notices, and then the whole
|
||||
derivation deserves a second look, not just the one zone.
|
||||
|
||||
**How to apply it.** After a Node upgrade, run the content tests first. When generated data changes,
|
||||
diff it item by item (here: every town whose zone moved) and explain each change in the review.
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# 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.
|
||||
+5
-1
@@ -29,7 +29,11 @@ export default [
|
||||
'**/.turbo/**',
|
||||
'**/generated/**',
|
||||
'**/playwright-report/**',
|
||||
'**/test-results/**'
|
||||
'**/test-results/**',
|
||||
// Other sessions' git worktrees live under .claude/worktrees/: separate checkouts,
|
||||
// linted in their own place, never from here (with Rust build output inside).
|
||||
'.claude/**',
|
||||
'**/target/**'
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -45,7 +45,18 @@ describe('the town list', () => {
|
||||
['Anchorage', 'United States of America', 'America/Anchorage'], // Natural Earth: America/Juneau
|
||||
['Kryvyi Rih', 'Ukraine', 'Europe/Kyiv'], // never Simferopol's Moscow time
|
||||
['Apia', 'Samoa', 'Pacific/Apia'], // UTC+13 at 172° W
|
||||
['Pristina', 'Kosovo', 'Europe/Belgrade'] // no ISO code in Natural Earth
|
||||
['Pristina', 'Kosovo', 'Europe/Belgrade'], // no ISO code in Natural Earth
|
||||
// Natural Earth: America/Sao_Paulo, whose fixed UTC-3 once moved the capital onto a
|
||||
// southern zone's clock with no daylight saving (fixed 2026-11-17).
|
||||
['Santiago', 'Chile', 'America/Santiago'],
|
||||
['Valparaíso', 'Chile', 'America/Santiago'],
|
||||
['Puerto Montt', 'Chile', 'America/Santiago'], // north of Aysén: the main clock
|
||||
// Natural Earth predates the regional splits (Magallanes 2016, Aysén 2025).
|
||||
['Coyhaique', 'Chile', 'America/Coyhaique'],
|
||||
['Puerto Aisén', 'Chile', 'America/Coyhaique'],
|
||||
["Villa O'Higgins", 'Chile', 'America/Coyhaique'], // Natural Earth even files it under Argentina's Santa Cruz
|
||||
['Punta Arenas', 'Chile', 'America/Punta_Arenas'],
|
||||
['Puerto Williams', 'Chile', 'America/Punta_Arenas']
|
||||
])('%s, %s, keeps %s', (name, country, zone) => {
|
||||
const t = towns.find((x) => x.name === name && x.country === country);
|
||||
expect(t?.timeZone).toBe(zone);
|
||||
|
||||
+18
-1
@@ -119,10 +119,27 @@ const d2 = (a: { lat: number; lon: number }, b: { lat: number; lon: number }): n
|
||||
*/
|
||||
function trustedZone(neZone: string, country: string, lat: number, lon: number): string | null {
|
||||
if (!neZone || !validZone(neZone) || !fitsLongitude(neZone, lon)) return null;
|
||||
// Another country's own zone is never trusted, however alike its clock: Natural Earth
|
||||
// files Santiago under America/Sao_Paulo, whose fixed UTC-3 matched Chile's fixed-clock
|
||||
// southern zones and moved the capital off its own clock (2026-11-17).
|
||||
const owner = tz.get(neZone);
|
||||
if (owner && !owner.countries.includes(country)) return null;
|
||||
const same = countryZones(country).filter((z) => clockOf(z.zone) === clockOf(neZone));
|
||||
return same.sort((a, b) => d2({ lat, lon }, a) - d2({ lat, lon }, b))[0]?.zone ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Regions that left their country's main clock after Natural Earth's data was made, by
|
||||
* latitude along the region's borders. Source: the time zone database's zone1970.tab
|
||||
* ("Aysén Region", "Magallanes Region") and the regions' borders. Mainland only.
|
||||
*/
|
||||
const REGION_BANDS: readonly { country: string; zone: string; south: number; north: number; west: number }[] = [
|
||||
{ country: 'CL', zone: 'America/Coyhaique', north: -43.7, south: -49.0, west: -76 },
|
||||
{ country: 'CL', zone: 'America/Punta_Arenas', north: -49.0, south: -56.5, west: -76 }
|
||||
];
|
||||
const bandZone = (country: string, lat: number, lon: number): string | null =>
|
||||
REGION_BANDS.find((b) => b.country === country && lat <= b.north && lat > b.south && lon >= b.west && validZone(b.zone))?.zone ?? null;
|
||||
|
||||
/** A name field that a fixed-width DBF did not cut in the middle of a letter. */
|
||||
const clean = (s: string | undefined): string => (s && !s.includes('�') ? s : '');
|
||||
|
||||
@@ -157,7 +174,7 @@ for (const r of raw) {
|
||||
continue;
|
||||
}
|
||||
const country = r['ISO_A2'] === '-99' ? (CLOCK_COUNTRY[r['ADM0NAME'] ?? ''] ?? '') : (r['ISO_A2'] ?? '');
|
||||
towns.push({ r, name, country, lat, lon, zone: trustedZone(r['TIMEZONE'] ?? '', country, lat, lon) });
|
||||
towns.push({ r, name, country, lat, lon, zone: bandZone(country, lat, lon) ?? trustedZone(r['TIMEZONE'] ?? '', country, lat, lon) });
|
||||
}
|
||||
|
||||
// A town without a trusted zone takes the zone most of its five nearest trusted
|
||||
|
||||
Reference in New Issue
Block a user