diff --git a/.agents/FEATURES.md b/.agents/FEATURES.md index 696e30c..c94bff3 100644 --- a/.agents/FEATURES.md +++ b/.agents/FEATURES.md @@ -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) | diff --git a/.agents/GAP_ANALYSIS.md b/.agents/GAP_ANALYSIS.md index 90612df..c1ea454 100644 --- a/.agents/GAP_ANALYSIS.md +++ b/.agents/GAP_ANALYSIS.md @@ -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. | diff --git a/.agents/reviews/feature-sun.md b/.agents/reviews/feature-sun.md new file mode 100644 index 0000000..ccfc58f --- /dev/null +++ b/.agents/reviews/feature-sun.md @@ -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). diff --git a/CLAUDE.md b/CLAUDE.md index bfa789d..3030f1b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -214,7 +214,8 @@ pnpm build # turbo: schema -> engine/content/ui -> pnpm lint # ESLint, incl. the engine-purity rule (§7) pnpm typecheck # tsc + svelte-check, every package plus e2e/ and scripts/ pnpm test # vitest, all packages — quote counts per package -pnpm --filter @rosea/engine test # incl. fast-check property tests (sun golden tests: later) +pnpm --filter @rosea/engine test # incl. fast-check property tests and the sun golden tests +tsx scripts/fetch-sun-golden.ts # re-records the sun's published tables (network; by hand, never in a test) pnpm test:e2e # builds, then Playwright against the BUILT app under /Rosea/ pnpm test:offline # builds, loads once, CLOSES the server, reloads pnpm validate:library # every hope sentence; fixtures must FAIL @@ -488,8 +489,8 @@ No timestamp finer than a day, no precise location, no free text, no link to the | Trap | Why it bites | |:--|:--| | **A PWA cannot schedule a local notification** *(predicted — verify first)* | The sunset invitation is time-based. A web app generally cannot fire a notification at a set time while closed without a **push server** sending it, and a push server that knows when someone's sunset is knows roughly where they are. On iOS, web push works only for a site added to the home screen. **Decided in Phase 0 (2026-11-01):** in-app sunset only for the web build — no push server — and local notifications through the Tauri shell later (Phase 6). | -| **Polar day and polar night** *(predicted)* | Above the Arctic Circle the sun does not set in summer or rise in winter. "Every day at sunset" has no answer there. The engine must return a defined state and the game must have a gentle alternative (e.g. the hour the light is lowest). | -| **DST and the local day** *(predicted)* | Sunset jumps an hour twice a year under a player who did nothing; a day boundary computed in UTC records Monday-evening care as Tuesday's. One module computes the day. | +| **Polar day and polar night** *(measured 2026-11-01)* | Above the Arctic Circle the sun does not set in summer or rise in winter. "Every day at sunset" has no answer there. Measured: the almanac has no rise or set in Tromsø on 21 June and no events at all on 21 December. `engine/sun` returns `polar-day` or `polar-night` and a gentle moment for each (the lowest light; noon twilight) — `.agents/features/sun.md` D4. | +| **DST and the local day** *(measured 2026-11-01)* | Sunset jumps an hour twice a year under a player who did nothing: Prague's is 18:28 on 28 March and 19:29 on the 29th, while the sun moved one minute. A day boundary computed in UTC records Monday-evening care as Tuesday's. One module computes the day; the sun works in instants. | | **Comfort becomes wallpaper** | The same words every day stop meaning anything. Comfort words are occasional; the real trace of a real person is constant. Track repetition in tests. | | **Guilt sneaks in through "gentle" reminders** | "Your rose misses you" is guilt wearing a ribbon. No notification ever refers to neglect — the player's or anyone else's. | | **Streak creep** | Someone will propose "just a small streak". Growth is from total care; a missed day never resets anything. | diff --git a/HANDOVER.md b/HANDOVER.md index f0607e6..b2e2ae2 100644 --- a/HANDOVER.md +++ b/HANDOVER.md @@ -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: 186 (schema 15, content 47, - art-prep 56, engine 52, ui 16). E2E: 7. Offline: 1. `lint:copy`: 12 files, 0 problems. +- **Gates:** all pass on this machine. Unit tests: 236 (schema 15, content 47, + art-prep 56, engine 102, ui 16). E2E: 7. Offline: 1. `lint:copy`: 12 files, 0 problems. `validate:library`: 13 of 13 fixtures rejected. - **Built, not deployed:** there is no host yet. - **Roadmap and gameplay docs:** `docs/ROADMAP.md` and `docs/GAMEPLAY.md` are on @@ -35,6 +35,13 @@ Rewritten at the end of each session (CLAUDE.md §5.1). republish `tools/art-prep/dist/board/` to that URL. Review: [`.agents/reviews/feature-art-board.md`](.agents/reviews/feature-art-board.md). +- **The sun (Phase 1 begins):** merged to `main`. `packages/engine/src/sun/sun.ts` gives + sunrise, solar noon and sunset for a local day and a place, or polar day or night, and the + moment the game invites the player out. It matches the U.S. Naval Observatory's tables within + 2 minutes in Prague, Reykjavík, Tromsø, Quito, Sydney and Anchorage, DST days included. + The app does not use it yet. Analysis: [`.agents/features/sun.md`](.agents/features/sun.md). + Review: [`.agents/reviews/feature-sun.md`](.agents/reviews/feature-sun.md). + **Phase 0 is not finished.** The roadmap's Phase 0 is more than the workspace. Its gate needs 60 verified sentences (G0.18) and one illustration through the art pipeline (G0.24). The pipeline and the board are built; the first real picture is not made yet. Also open: a GitHub remote (G0.13). The Letter slot is built (G0.25). @@ -53,6 +60,8 @@ The notification decision is made: in-app only on the web (G0.26). 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). +6. **Q10:** in polar night, should the sunset invitation come at noon, when the twilight is + brightest? The engine assumes yes. **How this machine works** (not in the code):