# 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
Shell: SunsetLine (next)"] --> engine["packages/engine
sun.ts: nextSunEvent"] chair["packages/ui
ChairSunset: SunsetLine (sunset)"] --> engine2["packages/engine
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` |