[docs] Sun: Record the sun's review, Phase 1 gaps, Q10, and the polar and DST traps as measured

This commit is contained in:
2026-11-01 23:18:26 +01:00
parent 08bc8b58fa
commit abc5a5c3a8
5 changed files with 78 additions and 5 deletions
+1
View File
@@ -8,4 +8,5 @@ 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 sun: real sunrise, sunset and solar noon on the device; polar day and night | 1 | Merged to `main`; engine only, the app does not show it yet | [sun.md](features/sun.md) | [feature-sun.md](reviews/feature-sun.md) |
| The art pipeline and the art board: STYLE.md (S1–S5 and the fox's F1–F4 approved), the manifest (Phase 1–3, 53 pictures), stand-ins, `tools/art-prep`, the published board | 0 | Merged to `main`; board published (private). The app is unchanged. Gate waits on the first real picture | [art-pipeline.md](features/art-pipeline.md) | [feature-art-board.md](reviews/feature-art-board.md), [art-phase2-3-pictures.md](reviews/art-phase2-3-pictures.md) |
+11
View File
@@ -45,6 +45,16 @@ board exist, and the first real picture is the author's to make.
| G0.27 | The quiet door to real help has no numbers (§5.6 rule 5) | Open. The slot is in `docs/LETTER.md`. Support lines are real-world facts the author must verify, per country, so the door exists only once the letter does. |
| ~~G0.26~~ | ~~Not decided: how the sunset invitation reaches the player on the web~~ | Closed 2026-11-01 by the author (Q6): in-app only on the web, no push server; local notifications through the Tauri shell in Phase 6. Recorded in ROADMAP Phase 0 and CLAUDE.md §8. |
## Phase 1 — The rose alone
**Started 2026-11-01** with the sun, while the Phase 0 gate waits on the author (pictures,
sentences). Nothing in Phase 1 is visible to the player yet.
| Id | Gap | Status / evidence |
|:--|:--|:--|
| ~~G1.1~~ | ~~No module computes the sun (CLAUDE.md §7); polar and DST traps only predicted~~ | Closed 2026-11-01 on `feature/sun`. `engine/src/sun/sun.ts`: 26 published days in 6 cities within 2 min, polar day and night at Tromsø, 50 tests, 5 of 5 put-back bugs caught. Both traps measured (CLAUDE.md §8). |
| G1.2 | The player cannot choose a city; no time-zone guess; no sunset time on screen | Open. A city list on the device (never GPS, never an IP lookup), the device zone as the fallback, the time shown in the garden. |
## Design questions — answered
Raised by GAMEPLAY.md and ROADMAP.md, answered by the author 2026-11-01. Details in
@@ -60,4 +70,5 @@ Raised by GAMEPLAY.md and ROADMAP.md, answered by the author 2026-11-01. Details
| ~~Q6~~ | When the notification decision is due | Phase 0, in-app only (G0.26) |
| ~~Q7~~ | Which phase holds the Amicitia bridge | Phase 3 |
| Q8 | "Nearby days give a little more" | Open as a rule for the Phase 1 Soul review: a gap's cost is never shown |
| Q10 | In polar night, when should the invitation come? | Open. The engine assumes solar noon, when the twilight is brightest (`features/sun.md` D4). In polar day it is the lowest light, as CLAUDE.md §8 suggests. |
| Q9 | May the Letter name the book and its author for the one sentence of inspiration (GAMEPLAY §7)? | Open. `lint:copy` refuses those names in the letter as everywhere in the product. A yes needs a written, letter-only exemption. |
+51
View File
@@ -0,0 +1,51 @@
# Review — `feature/sun`
Adversarial self-review (CLAUDE.md §5.3). Analysis: [`features/sun.md`](../features/sun.md).
Reviewed 2026-11-01 on Node 22.11.0, Windows 10. There is no PR: the only remote is Gitea.
## Gates — counts, not exit codes
| Gate | Result |
|:--|:--|
| `pnpm lint` | exit 0, the engine purity rule included: `src/sun/` reads no clock, no network, no device |
| `pnpm typecheck` | exit 0, `scripts/fetch-sun-golden.ts` included |
| `pnpm test` | **236 passed**: schema 15, content 47, art-prep 56, **engine 102 (+50 sun)**, ui 16 |
| `pnpm test:e2e` / `test:offline` | 7 passed / 1 passed. **The app is unchanged**: nothing imports the sun yet |
**Golden.** 26 published days in 6 cities match the U.S. Naval Observatory's tables within
2 minutes on the city's own clock, for sunrise, solar noon and sunset. Two more days, Tromsø's polar
day and night, match the table's *no event*. The table's clock offset agrees with the IANA zone
database on all 28 days.
**Stable.** The property tests ran three times with fresh seeds, 50 of 50 each time.
## Bug drills — each put back once, in `src/sun/sun.ts`
| Put back | Result |
|:--|:--|
| No refraction: the horizon at 90° instead of 90.833° | CAUGHT: 27 failures, every golden day |
| No equation of time | CAUGHT: 25 failures |
| Polar day and polar night swapped | CAUGHT: 8 failures |
| No local-day correction of solar noon | CAUGHT: 2 failures (Kiritimati, D8) |
| The UTC date derived back from the noon instant (finding 2's bug) | CAUGHT: 3 failures (properties near 180°) |
## Findings
| # | Area | Finding | Resolution |
|:--|:--|:--|:--|
| 1 | Correctness | The published table for Reykjavík on 21 June lists a sunset at 00:04. That is the **previous evening's** sunset. A naive "events within the calendar day" design would tell a player in Reykjavík that tonight's sunset was 00:04 this morning. | **By design (D2)**: today's sunset is the one after today's solar noon. Tested: it falls on 22 June, local. |
| 2 | Correctness | The first draft derived the UTC date back from the noon instant. Near 180° the noon falls on the next UTC date, which would move sunrise and sunset by a whole day. Spotted on re-reading, before any test ran. | **Fixed**: the date is passed in. Drill 5 shows the property tests now catch it. |
| 3 | Correctness | fast-check found a day with no solar noon: at 179.9° W on UTC, noon crosses midnight in late December. | **Defined (D8)** and pinned by a unit test. No real zone is twelve hours off the sun, so the properties use zones that follow longitude. |
| 4 | Correctness | Near the edge of polar day or night the hour angle can leave its range during refinement. | **Clamped (D5).** Accuracy on those few days is not measured: no golden day sits at the edge. Said here and in *not verified*. |
| 5 | Soul | Where the sun never sets or never rises, "every day at sunset" would leave a person with no invitation for months. | **Fixed (D4)**: the lowest light in polar day, noon twilight in polar night. The second is an assumption put to the author (Q10). |
| 6 | Soul | A DST change could make the game look as if the sunset "moved" because of the player, or move the rose's sentence to another day. | The engine works in instants (D3); the day comes only from `localDay`. Tested on all six DST days in the fixture. |
| 7 | Privacy | The golden script calls a US government API with coordinates. | Only by hand, only for six public city centres, never in a test or the app. The tests read the recorded file. |
| 8 | Privacy | A sunset time narrows down where someone is. | It never leaves the device: the module has no I/O and the purity rule forbids any. Phase 4 must never send it (CLAUDE.md §4). |
| 9 | Test honesty | The DST tests read the clock with `Intl` in the test, which is also what `localDay` uses. A bug in the platform's zone data would hide in both. | Cross-checked: the USNO table states each day's offset independently, and a test asserts the zone database agrees on all 28 days. |
## What was not verified
- Accuracy on the days right at the edge of polar day or night (finding 4).
- Latitudes above 72° on ordinary days, other than Tromsø's 69.6°.
- Years far from 2026. The method holds for centuries, but only 2026 is tested.
- The app: choosing a city, the time-zone guess, and showing the time are later in Phase 1 (G1.2).