[tauri] TauriPlatforms: Bring main (the sunrise, Coyhaique) into the branch
# Conflicts: # .agents/GAP_ANALYSIS.md # .agents/lessons/README.md # .agents/lessons/technical.md
This commit is contained in:
@@ -9,6 +9,7 @@ One row per feature, with its analysis document (CLAUDE.md §5.1). Gaps live in
|
||||
| Workspace, contracts, gates, PWA shell | 0 | Merged to `main` 2026-11-01 (`d11d242`); built, not deployed. Phase 0 gate still open | [phase0-workspace.md](features/phase0-workspace.md) | [feature-phase0-workspace.md](reviews/feature-phase0-workspace.md) |
|
||||
| Roadmap and gameplay docs, read against the code | 0 | Merged 2026-11-01; Q1–Q7 answered by the author | — | [docs-roadmap-gameplay.md](reviews/docs-roadmap-gameplay.md) |
|
||||
| The Letter slot: page at `#letter`, empty `docs/LETTER.md` | 0 | Merged to `main`; built, not deployed. Invisible until the author writes | [letter-slot.md](features/letter-slot.md) | [feature-letter-slot.md](reviews/feature-letter-slot.md) |
|
||||
| The sunrise: the line names the real sunrise from sunset until it comes | 1 | Merged to `main`; built, not deployed | [sunrise.md](features/sunrise.md) | [feature-sunrise.md](reviews/feature-sunrise.md) |
|
||||
| Two tabs, one garden: what one tab writes, the others see | 1 | Merged to `main`; built, not deployed | [two-tabs.md](features/two-tabs.md) | [fix-two-tabs.md](reviews/fix-two-tabs.md) |
|
||||
| Thorns: touch her; a rush of taps, and she says she has thorns | 1 | Merged to `main`; built, not deployed | [thorns.md](features/thorns.md) | [feature-thorns.md](reviews/feature-thorns.md) |
|
||||
| The day's sentence: her folded petal, one a day, never lost, best at sunset; candidates and `library:verify` | 1 | Merged to `main`; built, not deployed. Invisible until the author verifies sentences | [day-sentence.md](features/day-sentence.md) | [feature-day-sentence.md](reviews/feature-day-sentence.md) |
|
||||
|
||||
@@ -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. Narrowed 2026-11-17: the apps make PNG/ICO icons from `icon.svg` at build time (`tauri icon`, never committed); the PWA still has none, and the picture is still the placeholder. |
|
||||
| G0.22 | No CI | Open. Every gate ran on this machine only. With G0.13. Since 2026-11-17 the APK and the Windows installer are also built by hand here (G-T7). |
|
||||
| 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'`. |
|
||||
@@ -60,6 +60,7 @@ sentences). Nothing in Phase 1 is visible to the player yet.
|
||||
| ~~G1.6~~ | ~~The in-game sunset: move the chair, watch it again~~ | Closed 2026-11-02 on `feature/chair-sunset`: half a minute with nothing to press, then the real sunset's time; Escape and a tap leave; the offline suite watches one with the server gone. 4 of 4 put-back bugs caught. |
|
||||
| ~~G1.7~~ | ~~Thorns were on the roadmap but undesigned~~ | Closed 2026-11-02 on `feature/thorns`, as the author chose: thorns teach gentleness. `engine/touch` (2 properties: spaced taps are never a rush; one blush a visit); a tremor is one touch; nothing recorded. 6 of 6 put-back bugs caught. |
|
||||
| ~~G1.8~~ | ~~Two tabs (CLAUDE.md §8, predicted)~~ | Closed 2026-11-07 on `fix/two-tabs`. Measured first: two e2e tests failed (an open tab saw neither care nor a town from the other). Storage announces committed writes on a `BroadcastChannel`; the rose and the garden read again, adding to what they show. No lock needed: nothing stored drifts. 7 of 7 put-back bugs caught. |
|
||||
| ~~G1.10~~ | ~~The garden named only the sunset, never the sunrise (ROADMAP Phase 1: *sunset and sunrise*)~~ | Closed 2026-11-17 on `feature/sunrise`: from sunset until it comes, the line names the real sunrise; the in-game sunset still names the sunset. engine `nextSunEvent` with a 300-run property; e2e at 05:00 in Brno; seen on a real Android tablet. 5 of 5 put-back bugs caught. |
|
||||
| G1.3 | Towns have no Czech names (*Vídeň*) | Open. Natural Earth has none; arrives with Czech copy. |
|
||||
|
||||
## The platform track — four versions (from 2026-11-17)
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# The sunrise in the garden
|
||||
|
||||
Status: built on `feature/sunrise`. ROADMAP Phase 1: *the sun: real local sunset **and sunrise**, on
|
||||
device; polar day/night handled.* CLAUDE.md §1, *points beyond the screen: the real sunset, the real
|
||||
sunrise*. The sun module (`sun.md`) has computed sunrise since Phase 1 began; the garden never showed
|
||||
it. Review: [`feature-sunrise.md`](../reviews/feature-sunrise.md).
|
||||
|
||||
## 1. Why and what, in the player's terms
|
||||
|
||||
The line under the garden names the next real thing to look up for:
|
||||
|
||||
| When | The line |
|
||||
|:--|:--|
|
||||
| From midnight until sunrise | *The sun rises at 06:41 in Brno.* |
|
||||
| From sunrise until tonight's sunset | *Tonight the sun sets at 16:12 in Brno.* (as before) |
|
||||
| From sunset until midnight | *Tomorrow the sun rises at 06:43 in Brno.* |
|
||||
| Polar day, polar night | As before: the lowest light; the brightest twilight. |
|
||||
|
||||
Someone awake at three in the morning is told, quietly, when the light comes back; nothing invites
|
||||
them anywhere. The sunset stays the game's invitation (the petal's good moment, the in-game sunset):
|
||||
**the in-game sunset's closing words keep naming the real sunset**, because that is what they are for.
|
||||
|
||||
## 2. Technical architecture
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
shell["packages/ui<br/>Shell: SunsetLine (next)"] --> engine["packages/engine<br/>sun.ts: nextSunEvent"]
|
||||
chair["packages/ui<br/>ChairSunset: SunsetLine (sunset)"] --> engine2["packages/engine<br/>sun.ts: nextInvitation"]
|
||||
```
|
||||
|
||||
| # | Decision | Why |
|
||||
|:--|:--|:--|
|
||||
| R1 | **`nextSunEvent(now, place)`** in `engine/sun`: the next invitation's day; if that day's sunrise is still ahead, the sunrise; else the invitation. Pure, instants only (sun.md D3). | One module computes the sun (CLAUDE.md §7); the UI reads, never decides. |
|
||||
| R2 | Built on `nextInvitation`, so Reykjavík's after-midnight midsummer sunset (sun.md D2) still shows as tonight's sunset, not as a sunrise. | The only subtle case; tested. |
|
||||
| R3 | *Tomorrow* only when the sunrise belongs to a later local day than now, as the sunset line already does. | Same reading of the clock in both. |
|
||||
| R4 | `SunsetLine` gains `of: 'next' \| 'sunset'`; the garden asks for the next event, the in-game sunset for the sunset. | The chair scene tells the player when the real sunset is (chair-sunset.md). |
|
||||
| R5 | Polar day and night are unchanged: no sunrise exists to name. | sun.md D4. |
|
||||
|
||||
## 3. Risk analysis
|
||||
|
||||
| Risk | Answer |
|
||||
|:--|:--|
|
||||
| **Dependence / a nudge at night**: a line that pulls an awake player to the screen. | It is the same quiet line, changed only in what it names; no new notice, no invitation, nothing counted. |
|
||||
| **Guilt**: *you missed the sunrise*. | Nothing ever refers to a missed sunrise; after sunrise the line simply names the sunset. |
|
||||
| Privacy, reachability, offline | Unchanged: computed on the device from the chosen town. |
|
||||
|
||||
## 4. Gap analysis
|
||||
|
||||
Closes the last Phase 1 roadmap item that the screen did not show. Sunrise *mechanics* (sunrise-only
|
||||
visitors, Phase 2; ROADMAP §6 open question) are not designed here.
|
||||
|
||||
## 5. Verification matrix
|
||||
|
||||
| Case | Kind | Where |
|
||||
|:--|:--|:--|
|
||||
| Before sunrise: today's sunrise; after sunrise: tonight's sunset; after sunset: tomorrow's sunrise | unit | `engine/test/sun.test.ts` |
|
||||
| Reykjavík midsummer after midnight, before the late sunset: the sunset, not a sunrise | unit | same |
|
||||
| Polar day and night: unchanged | unit | same |
|
||||
| **Property:** the event is never in the past, and nothing (sunrise or sunset) comes between now and it | property | same |
|
||||
| The garden's line at 05:00, 12:00, 22:00; the in-game sunset's words still name the sunset at 22:00 | unit | `ui/test/sunset.test.ts`, `ui/test/chair-sunset.test.ts` |
|
||||
| Built app at 05:00 in Brno: the sunrise line | e2e | `e2e/shell.spec.ts` |
|
||||
@@ -11,7 +11,7 @@ and **how to apply it**.
|
||||
| [`design.md`](design.md) | 1 | 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) | 8 | The browser and the build as platforms. |
|
||||
| [`technical.md`](technical.md) | 9 | The browser and the build as platforms. |
|
||||
| [`testing.md`](testing.md) | 13 | 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. |
|
||||
|
||||
@@ -84,6 +84,20 @@ 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.
|
||||
|
||||
## A generated project is newer than anything you made before it
|
||||
|
||||
**What happened.** The first Android APK (2026-11-17) carried Tauri's logo. `scripts/icons.ts` copied
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# Review — `feature/sunrise`
|
||||
|
||||
Adversarial self-review (CLAUDE.md §5.3). Analysis: [`features/sunrise.md`](../features/sunrise.md).
|
||||
Reviewed 2026-11-17 on Node 22.11.0, Windows 10. There is no PR: the only remote is Gitea.
|
||||
|
||||
## Gates
|
||||
|
||||
Counts are on the merge; HANDOVER repeats them. New: engine +6 (one property, 300 runs), ui +2
|
||||
(plus one rewritten), e2e +1 (05:00 in Brno).
|
||||
|
||||
**The app changed** (CLAUDE.md §5.4): the line under the garden names the sunrise from sunset until
|
||||
it comes. Rebuilt by the e2e and offline runs; **not deployed** (G0.13).
|
||||
|
||||
## Bug drills
|
||||
|
||||
| Put back | Result |
|
||||
|:--|:--|
|
||||
| The sunrise is never named | CAUGHT |
|
||||
| A sunrise already past is named | CAUGHT: 3 |
|
||||
| The sunrise is looked up on today instead of the next invitation's day | CAUGHT: 3 |
|
||||
| Tomorrow's sunrise is called this morning's | CAUGHT |
|
||||
| The in-game sunset names the sunrise | CAUGHT |
|
||||
|
||||
## Findings
|
||||
|
||||
| # | Area | Finding | Resolution |
|
||||
|:--|:--|:--|:--|
|
||||
| 1 | Correctness | Reykjavík at midsummer: just after midnight the evening's sunset is still ahead; a naive "before sunrise, name the sunrise" rule would name a sunrise there. | The sunrise is taken from the next invitation's own day (R2); tested, and drilled. |
|
||||
| 2 | Correctness | *Tomorrow* for a sunrise. | Compares the sunrise's local day with today's, the one module computing days; drilled. |
|
||||
| 3 | Design | The in-game sunset reused the line; late in the evening it would have named the sunrise. | `of="sunset"` keeps its words on the sunset (R4); tested at 22:00, drilled. |
|
||||
| 4 | Soul | Someone awake at night sees a sunrise time. Could that pull them to the screen? | It is the same line, only naming the next light; no invitation, notice or count. Looked for guilt: nothing ever says a sunrise was missed. |
|
||||
| 5 | Polar | Polar day and night have no sunrise. | Unchanged lines (R5); tested. Near the polar edges the sun module's clamping (sun.md D5) applies to the sunrise too: accuracy there is worse, as before. |
|
||||
| 6 | Process | On 2026-11-17 `node_modules` was missing again (the second time in ten days, cause unknown) and the machine sat at 100 % CPU (other sessions and a virtual machine), so the guard refused the full runs for a while. | Reinstalled from the lockfile; the full runs waited for the guard rather than overriding it (§5.7). |
|
||||
| — | Privacy, reachability, offline | Computed on the device from the chosen town; nothing new is stored or sent. | — |
|
||||
|
||||
## What was not verified
|
||||
|
||||
- A real phone at dawn; Safari's time formatting.
|
||||
@@ -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.
|
||||
+21
-3
@@ -12,8 +12,8 @@ Rewritten at the end of each session (CLAUDE.md §5.1).
|
||||
Gitea hashes match. Analysis: [`.agents/features/phase0-workspace.md`](.agents/features/phase0-workspace.md).
|
||||
Review, with counts and the mutation results:
|
||||
[`.agents/reviews/feature-phase0-workspace.md`](.agents/reviews/feature-phase0-workspace.md).
|
||||
- **Gates:** all pass on this machine. Unit tests: 468 (cpu-guard 13, identity 5, schema 19,
|
||||
content 80, storage 65, art-prep 56, engine 168, ui 62). E2E: 21. Offline: 1. `lint:copy`: 21 files, 0 problems.
|
||||
- **Gates:** all pass on this machine. Unit tests: 489 (cpu-guard 13, identity 5, schema 19,
|
||||
content 88, storage 65, art-prep 61, engine 174, ui 64). E2E: 22. Offline: 1. `lint:copy`: 21 files, 0 problems.
|
||||
`validate:library`: 13 of 13 fixtures rejected; 78 candidates pass.
|
||||
- **Built, not deployed:** there is no host yet.
|
||||
- **Roadmap and gameplay docs:** `docs/ROADMAP.md` and `docs/GAMEPLAY.md` are on
|
||||
@@ -102,6 +102,17 @@ Rewritten at the end of each session (CLAUDE.md §5.1).
|
||||
write on a `BroadcastChannel`; the other tabs read again. No lock: nothing stored can drift.
|
||||
On this date the root `node_modules` was found missing; `pnpm install --frozen-lockfile`
|
||||
restored it. Review: [`.agents/reviews/fix-two-tabs.md`](.agents/reviews/fix-two-tabs.md).
|
||||
- **The sunrise (2026-11-17):** merged to `main`. From sunset until it comes, the garden's line names
|
||||
the real sunrise; the in-game sunset still names the sunset. Seen on a real Android tablet.
|
||||
Review: [`.agents/reviews/feature-sunrise.md`](.agents/reviews/feature-sunrise.md).
|
||||
- **The town list's clocks for Chile (2026-11-17):** merged to `main`. Santiago and Valparaíso had
|
||||
been on a southern zone's clock (no daylight saving) since the first build, and Aysén and
|
||||
Magallanes on Santiago's. Found because the upgraded Node knows America/Coyhaique. Review:
|
||||
[`.agents/reviews/fix-coyhaique.md`](.agents/reviews/fix-coyhaique.md).
|
||||
- **Tested on a real Android tablet (2026-11-17):** the built app over USB (`adb reverse`, the server
|
||||
still on 127.0.0.1), driven through Chrome's DevTools socket: first open, the town, watering by a
|
||||
real held touch, the in-game sunset, and **offline** reloads with the server unreachable all pass.
|
||||
When device testing ends, the app used is stopped at once (the author's rule).
|
||||
- **Phase 1 is built in code.** What remains of it is the author's: verified sentences (the petal
|
||||
appears with them), hosting (G0.13), and the gate itself — two weeks of daily play on a phone.
|
||||
|
||||
@@ -125,7 +136,7 @@ The notification decision is made: in-app only on the web (G0.26).
|
||||
(`Artifact read` with the asset id as `path`), runs `pnpm art:accept`, commits on `art/<set>`,
|
||||
and writes `final` back into the row.
|
||||
4. **A GitHub repository** for Pages, and whether it is public (G0.13, G0.23).
|
||||
5. **Upgrading Node** to ≥ 22.13 on this machine (G0.20).
|
||||
5. **Node is upgraded** (22.23.4); unpinning the dependencies pinned for 22.11 remains (G0.20).
|
||||
6. **The rose's tuning** (`.agents/features/rose.md` R2, R4, R5, R6, all in `ROSE` in
|
||||
`packages/engine/src/rose/rose.ts`): how fast she gets thirsty, how often weeds, petals and wind
|
||||
come, and how many days of care each stage takes (full bloom after 25). Play it for a week,
|
||||
@@ -135,6 +146,13 @@ The notification decision is made: in-app only on the web (G0.26).
|
||||
|
||||
- **The CPU guard:** the full runs wait for this machine to drop to 80 % CPU (§5.7). Other projects'
|
||||
test runs share it, so a wait of a minute or two is normal; three minutes, and the run is refused.
|
||||
On 2026-11-17 two qemu virtual machines held it at 100 % for long stretches; waiting worked.
|
||||
- **Things vanish:** the root `node_modules` (twice, 2026-11-07 and 11-17) and Playwright's browser in
|
||||
`F:\ms-playwright` (11-17) disappeared; the code and history were intact. Restore with
|
||||
`pnpm install --frozen-lockfile` and `pnpm exec playwright install --only-shell chromium` (a
|
||||
download: ask first). The cause is unknown.
|
||||
- **The Android tablet:** WAVE 10C on USB debugging; always `adb -s WAVE10CEEA036785` (an emulator
|
||||
attaches too, and other projects use the same tablet). Stop the app used when testing ends.
|
||||
|
||||
- **Commit identity:** `mnovak <giteatruenasadminacc.from729@passmail.net>`, set in
|
||||
this repository only.
|
||||
|
||||
+15
-1
@@ -3,7 +3,7 @@ import { expect, test, type Page } from '@playwright/test';
|
||||
import { PRODUCT_NAME } from '@rosea/schema';
|
||||
import { en } from '@rosea/ui/copy';
|
||||
import { parseLetter } from '@rosea/ui/letter';
|
||||
import { nextInvitation } from '@rosea/engine';
|
||||
import { nextInvitation, nextSunEvent } from '@rosea/engine';
|
||||
import { searchTowns } from '@rosea/content/places';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { BASE, startStaticServer, type StaticServer } from './static-server.js';
|
||||
@@ -163,6 +163,20 @@ test.describe('the sunset place, in Prague\'s time zone at noon on 29 March 2026
|
||||
expect(requests.some((url) => /\/assets\/places-.*\.js$/.test(url))).toBe(true);
|
||||
});
|
||||
|
||||
test('at five in the morning the garden names the sunrise, not the sunset (sunrise.md)', async ({ page }) => {
|
||||
const early = Date.parse('2026-03-29T05:00:00+02:00');
|
||||
await page.clock.setFixedTime(early);
|
||||
await open(page);
|
||||
await page.getByRole('searchbox', { name: en.sunset.searchLabel }).fill('brno');
|
||||
await page.getByRole('button', { name: /^Brno/ }).first().click();
|
||||
const brno = searchTowns('brno')[0]!;
|
||||
const { at } = nextSunEvent(early, brno);
|
||||
const time = new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: '2-digit', timeZone: brno.timeZone }).format(at);
|
||||
const line = page.locator('.sun p').first();
|
||||
await expect(line).toHaveText(/^The sun rises at .* in Brno\.$/);
|
||||
expect(spaced((await line.textContent()) ?? '')).toBe(spaced(en.sunset.rises(time, 'Brno')));
|
||||
});
|
||||
|
||||
test('"not now" guesses Prague from the device\'s zone and says it is a guess', async ({ page }) => {
|
||||
await page.clock.setFixedTime(NOON);
|
||||
await open(page);
|
||||
|
||||
+5
-1
@@ -32,7 +32,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);
|
||||
|
||||
@@ -3,7 +3,7 @@ export {
|
||||
careEvent, careIdentity, judgeCare, newCare, OWN_TRACE, petalsOn, pour, ROSE, roseAt, seeded, stageFor, weedsOn, windOn,
|
||||
type Judged, type Mood, type Needs, type RoseKeys, type RoseNow, type Stage, type Trend
|
||||
} from './rose/rose.js';
|
||||
export { invitation, nextInvitation, sunDay, type NamedPlace, type Place, type SunDay } from './sun/sun.js';
|
||||
export { invitation, nextInvitation, nextSunEvent, sunDay, type NamedPlace, type Place, type SunDay } from './sun/sun.js';
|
||||
export {
|
||||
goodMoment, newOpened, openedIdentity, PETAL, petalAt, petalOrder, sentenceOpened, type PetalNow, type PetalSentence
|
||||
} from './petal/petal.js';
|
||||
|
||||
@@ -159,6 +159,17 @@ export function nextInvitation(now: number, place: Place): { readonly sun: SunDa
|
||||
throw new Error(`nextInvitation: no invitation within two days of ${today}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* The next thing to look up for (sunrise.md R1): the sunrise of the next invitation's
|
||||
* day while it is still ahead, otherwise the invitation itself. Built on
|
||||
* `nextInvitation`, so Reykjavík's after-midnight sunset stays tonight's (D2).
|
||||
*/
|
||||
export function nextSunEvent(now: number, place: Place): { readonly sun: SunDay; readonly at: number; readonly kind: 'sunrise' | 'invitation' } {
|
||||
const next = nextInvitation(now, place);
|
||||
if (next.sun.kind === 'sun-sets' && next.sun.sunrise >= now) return { sun: next.sun, at: next.sun.sunrise, kind: 'sunrise' };
|
||||
return { ...next, kind: 'invitation' };
|
||||
}
|
||||
|
||||
/**
|
||||
* When the game invites the player outside: the sunset; in polar day the lowest
|
||||
* light; in polar night noon, when the twilight is brightest (D4; decided by the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fc from 'fast-check';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { invitation, nextInvitation, sunDay, type Place, type SunDay } from '../src/sun/sun.js';
|
||||
import { invitation, nextInvitation, nextSunEvent, sunDay, type Place, type SunDay } from '../src/sun/sun.js';
|
||||
import { addDays, localDay } from '../src/time/localDay.js';
|
||||
|
||||
/** Recorded by scripts/fetch-sun-golden.ts from the U.S. Naval Observatory. */
|
||||
@@ -255,3 +255,65 @@ describe('sunDay — refusals', () => {
|
||||
expect(() => sunDay(day, place)).toThrow(message);
|
||||
});
|
||||
});
|
||||
|
||||
describe('nextSunEvent — the next thing to look up for (sunrise.md)', () => {
|
||||
const brno: Place = { lat: 49.1951, lon: 16.6068, timeZone: 'Europe/Prague' };
|
||||
const day = sunDay('2026-03-02', brno);
|
||||
if (day.kind !== 'sun-sets') throw new Error('Brno has a sunset in March');
|
||||
|
||||
it('before sunrise, the sunrise of the same day', () => {
|
||||
const early = Date.parse('2026-03-02T03:00:00+01:00');
|
||||
expect(nextSunEvent(early, brno)).toMatchObject({ kind: 'sunrise', at: day.sunrise });
|
||||
});
|
||||
|
||||
it('from sunrise until the sunset, the sunset, exactly as nextInvitation says', () => {
|
||||
for (const at of [day.sunrise + MINUTE, day.solarNoon, day.sunset]) {
|
||||
expect(nextSunEvent(at, brno)).toEqual({ ...nextInvitation(at, brno), kind: 'invitation' });
|
||||
}
|
||||
});
|
||||
|
||||
it('after the sunset, tomorrow\'s sunrise', () => {
|
||||
const tomorrow = sunDay('2026-03-03', brno);
|
||||
if (tomorrow.kind !== 'sun-sets') throw new Error('Brno has a sunset in March');
|
||||
expect(nextSunEvent(day.sunset + MINUTE, brno)).toMatchObject({ kind: 'sunrise', at: tomorrow.sunrise });
|
||||
expect(localDay(tomorrow.sunrise, brno.timeZone)).toBe('2026-03-03');
|
||||
});
|
||||
|
||||
it('Reykjavík at midsummer, just after midnight: the late sunset still to come, not a sunrise (D2)', () => {
|
||||
const reykjavik: Place = { lat: 64.1466, lon: -21.9426, timeZone: 'Atlantic/Reykjavik' };
|
||||
const midsummer = sunDay('2026-06-21', reykjavik);
|
||||
if (midsummer.kind !== 'sun-sets') throw new Error('Reykjavík has a sunset on 21 June');
|
||||
const justAfterMidnight = Date.parse('2026-06-22T00:01:00Z');
|
||||
expect(justAfterMidnight).toBeLessThan(midsummer.sunset);
|
||||
expect(nextSunEvent(justAfterMidnight, reykjavik)).toMatchObject({ kind: 'invitation', at: midsummer.sunset });
|
||||
});
|
||||
|
||||
it('in polar day and polar night there is no sunrise to name: the invitation, as before', () => {
|
||||
const tromso: Place = { lat: 69.6492, lon: 18.9553, timeZone: 'Europe/Oslo' };
|
||||
for (const at of [Date.parse('2026-06-21T03:00:00+02:00'), Date.parse('2026-12-21T03:00:00+01:00')]) {
|
||||
expect(nextSunEvent(at, tromso)).toEqual({ ...nextInvitation(at, tromso), kind: 'invitation' });
|
||||
}
|
||||
});
|
||||
|
||||
it('property: the event is never in the past, and no sunrise or sunset falls between now and it', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
fc.double({ min: -60, max: 60, noNaN: true }),
|
||||
fc.double({ min: -179, max: 179, noNaN: true }),
|
||||
fc.integer({ min: Date.parse('2026-01-01T00:00:00Z'), max: Date.parse('2026-12-31T00:00:00Z') }),
|
||||
(lat, lon, now) => {
|
||||
const place = zoned(lat, lon);
|
||||
const event = nextSunEvent(now, place);
|
||||
expect(event.at).toBeGreaterThanOrEqual(now);
|
||||
const today = localDay(now, place.timeZone);
|
||||
for (const offset of [-1, 0, 1, 2]) {
|
||||
const s = sunDay(addDays(today, offset), place);
|
||||
if (s.kind !== 'sun-sets') continue;
|
||||
for (const t of [s.sunrise, s.sunset]) expect(t < now || t >= event.at).toBe(true);
|
||||
}
|
||||
}
|
||||
),
|
||||
{ numRuns: 300 }
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -106,6 +106,9 @@ export const en = {
|
||||
choose: 'Choose a town',
|
||||
tonight: (time: string, town: string): string => `Tonight the sun sets at ${time} in ${town}.`,
|
||||
tomorrow: (time: string, town: string): string => `Tomorrow the sun sets at ${time} in ${town}.`,
|
||||
/** The sunrise, named from sunset until it comes (sunrise.md). Only a time: nothing invites. */
|
||||
rises: (time: string, town: string): string => `The sun rises at ${time} in ${town}.`,
|
||||
risesTomorrow: (time: string, town: string): string => `Tomorrow the sun rises at ${time} in ${town}.`,
|
||||
polarDay: (time: string, town: string): string => `In ${town} the sun stays up tonight. The light is lowest at ${time}.`,
|
||||
polarNight: (time: string, town: string): string => `In ${town} the sun stays below the horizon today. The twilight is brightest at ${time}.`,
|
||||
guessed: "A guess from this device's time zone.",
|
||||
|
||||
@@ -81,7 +81,8 @@
|
||||
{#if phase === 'after'}
|
||||
<div class="after-words">
|
||||
{#if place}
|
||||
<SunsetLine {place} {guessed} now={afterAt} />
|
||||
<!-- The real sunset, always: this scene tells the player when it is (sunrise.md R4). -->
|
||||
<SunsetLine {place} {guessed} now={afterAt} of="sunset" />
|
||||
{:else}
|
||||
<p>{en.sunset.noTown}</p>
|
||||
{/if}
|
||||
|
||||
@@ -1,26 +1,36 @@
|
||||
<script lang="ts">
|
||||
import { localDay, nextInvitation, type NamedPlace } from '@rosea/engine';
|
||||
import { localDay, nextInvitation, nextSunEvent, type NamedPlace } from '@rosea/engine';
|
||||
import { en } from '../copy/en.js';
|
||||
|
||||
/**
|
||||
* The next sunset, or its polar alternative, in one sentence. The engine says
|
||||
* when; this only reads it on the town's clock, in the device's own time format
|
||||
* (sunset-place.md P6).
|
||||
* The next real thing to look up for, in one sentence: the sunrise until it comes,
|
||||
* then the sunset, or their polar alternatives (sunrise.md). `of="sunset"` names the
|
||||
* sunset only, for the in-game sunset's closing words. The engine says when; this
|
||||
* only reads it on the town's clock, in the device's own time format (sunset-place.md P6).
|
||||
*/
|
||||
let { place, guessed = false, now }: { place: NamedPlace; guessed?: boolean; now: number } = $props();
|
||||
let {
|
||||
place,
|
||||
guessed = false,
|
||||
now,
|
||||
of = 'next'
|
||||
}: { place: NamedPlace; guessed?: boolean; now: number; of?: 'next' | 'sunset' } = $props();
|
||||
|
||||
const line = $derived.by(() => {
|
||||
const { sun, at } = nextInvitation(now, place);
|
||||
const event = of === 'sunset' ? { ...nextInvitation(now, place), kind: 'invitation' as const } : nextSunEvent(now, place);
|
||||
const { sun, at } = event;
|
||||
const time = new Intl.DateTimeFormat(undefined, { hour: 'numeric', minute: '2-digit', timeZone: place.timeZone }).format(at);
|
||||
const today = localDay(now, place.timeZone);
|
||||
// A sunrise is tomorrow's when it falls on a later local day than now.
|
||||
if (event.kind === 'sunrise') return localDay(at, place.timeZone) > today ? en.sunset.risesTomorrow(time, place.name) : en.sunset.rises(time, place.name);
|
||||
// "Tomorrow" for a sunset only when it belongs to a later day: tonight's sunset may
|
||||
// fall after midnight (sun.md D2).
|
||||
switch (sun.kind) {
|
||||
case 'polar-day':
|
||||
return en.sunset.polarDay(time, place.name);
|
||||
case 'polar-night':
|
||||
return en.sunset.polarNight(time, place.name);
|
||||
case 'sun-sets':
|
||||
// Tonight's sunset may fall after midnight (sun.md D2), so "tomorrow" only
|
||||
// when it belongs to a later day than today.
|
||||
return sun.day > localDay(now, place.timeZone) ? en.sunset.tomorrow(time, place.name) : en.sunset.tonight(time, place.name);
|
||||
return sun.day > today ? en.sunset.tomorrow(time, place.name) : en.sunset.tonight(time, place.name);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -91,6 +91,14 @@ describe('the in-game sunset (chair-sunset.md)', () => {
|
||||
expect(screen.queryByRole('dialog')).toBeNull();
|
||||
});
|
||||
|
||||
it('late in the evening its words still name the real sunset, never the sunrise (sunrise.md R4)', async () => {
|
||||
const late = Date.parse('2026-03-29T22:00:00+02:00');
|
||||
const scene = await openScene({ now: () => late });
|
||||
vi.advanceTimersByTime(SUNSET_MS);
|
||||
await tick();
|
||||
expect(within(scene).getByText(/^Tomorrow the sun sets at .* in Brno\.$/)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('with no town and no guess, the words after it ask for a town', async () => {
|
||||
const scene = await openScene({ guess: null, load: async () => ({ kind: 'device-zone' }) });
|
||||
vi.advanceTimersByTime(SUNSET_MS);
|
||||
|
||||
@@ -89,11 +89,23 @@ describe('the garden remembers', () => {
|
||||
expect(screen.queryByRole('searchbox')).toBeNull();
|
||||
});
|
||||
|
||||
it('after the sunset, it speaks of tomorrow\'s', async () => {
|
||||
it("after the sunset, it names tomorrow's sunrise (sunrise.md)", async () => {
|
||||
const after = invitation(sunDay('2026-03-29', brno)) + 60_000;
|
||||
render(Shell, { sunset: wiring({ saved: { kind: 'town', town: brno }, now: () => after }) });
|
||||
const tomorrow = invitation(sunDay('2026-03-30', brno));
|
||||
expect(await screen.findByText(en.sunset.tomorrow(timeOf(brno, tomorrow), 'Brno'))).toBeTruthy();
|
||||
const tomorrow = sunDay('2026-03-30', brno);
|
||||
if (tomorrow.kind !== 'sun-sets') throw new Error('Brno has a sunrise in March');
|
||||
expect(await screen.findByText(en.sunset.risesTomorrow(timeOf(brno, tomorrow.sunrise), 'Brno'))).toBeTruthy();
|
||||
});
|
||||
|
||||
it('before sunrise, it names this morning\'s sunrise; after it, tonight\'s sunset', async () => {
|
||||
const early = Date.parse('2026-03-29T04:00:00+02:00');
|
||||
const today = sunDay('2026-03-29', brno);
|
||||
if (today.kind !== 'sun-sets') throw new Error('Brno has a sunrise in March');
|
||||
render(Shell, { sunset: wiring({ saved: { kind: 'town', town: brno }, now: () => early }) });
|
||||
expect(await screen.findByText(en.sunset.rises(timeOf(brno, today.sunrise), 'Brno'))).toBeTruthy();
|
||||
cleanup();
|
||||
render(Shell, { sunset: wiring({ saved: { kind: 'town', town: brno }, now: () => today.sunrise + 60_000 }) });
|
||||
expect(await screen.findByText(en.sunset.tonight(timeOf(brno, today.sunset), 'Brno'))).toBeTruthy();
|
||||
});
|
||||
|
||||
it('in polar night it speaks of the noon twilight; in polar day, of the lowest light', async () => {
|
||||
|
||||
+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